Re: Folder Actions
Re: Folder Actions
- Subject: Re: Folder Actions
- From: Mr Tea <email@hidden>
- Date: Wed, 18 Sep 2002 16:10:33 +0100
This from Kinsella, John R. - dated 18-9-02 02.19 pm:
>
OK, let's take folder actions out of the equation for a moment then.
I guess you didn't get my previous reply yet...
>
I want to perform a set of actions (fixing some HTML coding) on a folder full
>
of files. But I haven't been able to get the repeat loop right so that it
>
will go through, open each file one at a time and perform the actions I need.
>
Any ideas for that scenario?
OK. The obvious way to do this is with a script droplet that you can drop
the folder onto.
For this to happen, your script must start with 'on open...', and be saved
as an application. It would look something like this:
on open theFolderList
tell application "Finder"
set theItems to every file of item 1 of theFolderList
repeat with anItem in theItems
set theName to name of anItem as string
say theName
end repeat
end tell
end open
It's easy to check if this is working, because you get the speech feedback.
When you drag stuff onto the droplet, the dropped items are stored as a list
in the variable 'theFolderList', even if only one item is dropped. (Use any
variable name you like instead of theFolderList - doesn't matter what, as
long as it makes sense to you and doesn't conflict with any scripting
terminology.) This example assumes that only one item is being dropped (item
1 of theFolderList) and that that item is a folder.
Using 'set theItems to every file of...' looks only for files and
conveniently ignores any subfolders in the dropped folder. The result is a
list of aliases to the files in the folder, which you can then work through
with your html fixing code in the repeat loop.
HTH
Mr Tea
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.