RE: In a pickle with simple resize script
RE: In a pickle with simple resize script
- Subject: RE: In a pickle with simple resize script
- From: Joe Kelly <email@hidden>
- Date: Tue, 18 Dec 2001 15:28:12 -0800
Folder actions only work if the folder's window is open (Omitted: Rant about
how promising folder actions could be, but how utterly useless they actually
are...)
What you want to do instead is "watch" the directory for any changes:
property pFolder:""
on run
if (pFolder is "")
set pFolder to (choose folder with prompt "Where's that
*special* folder?") as string
end if
CheckFolder()
end run
on idle
CheckFolder()
return 3600 -- call idle handler again in an hour
end idle
on CheckFolder()
set deleteList to {}
tell application "Finder"
repeat with i in folder pFolder
ProcessTheFile(i)
set deleteList to deleteList & i
end
repeat with i in deleteList
delete i -- or you can simply move them to an
archive folder
end
end tell
end CheckFolder
on ProcessTheFile(inFile)
... do your image converter stuff here...
end
save this as a classic applet, with "Stay Open" checked on. You can store an
alias to the script in your Startup Items folder and forget about it.
The reason I store stuff in deleteList is in case another picture gets
dropped in the folder while the script is running -- you only delete those
items you've processed. The newly added file(s) will get processed when idle
gets called again.
A (possibly) more elegant solution would be to compare the modification date
of folder pFolder which changes when stuff is added.
I've never scripted image converter, so I can't help you there.
joe