Re: Dodge .DS_Store files in Folder Action
Re: Dodge .DS_Store files in Folder Action
- Subject: Re: Dodge .DS_Store files in Folder Action
- From: John Stewart <email@hidden>
- Date: Fri, 28 Jan 2005 16:32:02 -0500
On 01/28/05 at -0000 Simon Troup said this
>I've got a big chunk of folder action code that works fine apart from the fact that .DS_Store files
>seem to keep getting included into the list of dropped files.
>
>I'm trying to find a way to dodge those files from being processed even if they get included in the
>list.
>
>The stuff in brackets is either explanatory or pseudo code for what I'm trying to do. Thanks in
>advance for your patience, I know this is a bit newbie, I gave it about three hours (don't laugh!)
>before throwing the towel in.
>
>---
>
>on adding folder items to this_folder after receiving these_files
> repeat with i from 1 to number of items in these_files
>
> if [filename of i is .DS_Store] then
> [delete it!]
> else
> [large bit of working script edited out]
> end if
>
> end repeat
>end adding folder items to
You can ignore the .DS_Store files or most anything else with a construct similar to this. It acts like a "next repeat" does in some languages. I didn't test this before posting it but it compiles correctly and I've used the method before.
--> Cut <--
on adding folder items to this_folder after receiving these_files
repeat with i from 1 to number of items in these_files
repeat 1 times
tell application "Finder"
if name of item i of these_files is ".DS_Store" then exit repeat
end tell
-- [large bit of working script edited out]
end repeat
end repeat
end adding folder items to
--> Cut <--
Any line in this script which starts at the left margin has been wrapped.
You may need to manually append such a line to the end of the preceeding line if it's a "hard" wrap.
JBS
--
If people from Poland are called Poles, why aren't people from Holland called Holes? - George Carlin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden