Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Use folder action scripts on a shell scripts folder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use folder action scripts on a shell scripts folder
Authored by: jakacmar on May 03, '04 01:41:37PM
AS Tip: When you're using a repeat that is counting the items in a list as is done in the script in the hint, it's much easier to use "repeat with x in y" then to use "repeat with x from 1 to count of items of y". For instance, the script in the hint could look like:
on adding folder items to this_folder after receiving these_items
	tell application "Finder"
		repeat with this_item in these_items
			set modification date of this_item to (current date)
			set xtension to name extension this_item
			if xtension is not "" then
				set extension hidden of this_item to true
				set the name of this_item 
					to (the displayed name of this_item)
			end if
			do shell script "cd ~/bin; chmod 755 $(ls -1t | head -n 1)"
		end repeat
	end tell
end adding folder items to
This script replaces "repeat with i from 1 to count of items of these_items" with "repeat with this_item in these_items". While functionally the same, I find that using this format is much quicker to write. It takes more work to have to type (item i of these_items) than to just type "this_item". Just a thought.

[ Reply to This | # ]