I’m still struggling with a folder action to change a name and move an item into a containing folder. Right now I am just trying to get the moving part down. In this case I’m moving it to the trash as a test because I havenb’t been able to get the containinig folder part to work.
What happens is that the script (below) works fine when the folder window is open, but if the folder window is closed the file just sits in the folder. It works okay if I drag the file to the closed folder but if I save to it the folder has to be open for the script to work. Why?
I’ve tried it with and without the timeout but the result is the same. I’m trying to learn this stuff, but things like this are a brick wall. Any ideas? Thanks.
on adding folder items to theFolder ¬
after receiving stuff
tell application “Finder”
with timeout of 500 seconds
repeat with aFile in stuff
if the name of aFile contains " copy" then
move aFile to the trash
end if
end repeat
end timeout
end tell end adding folder items to
: I’m still struggling with a folder action to change a name and move an item
: into a containing folder. Right now I am just trying to get the moving
: part down. In this case I’m moving it to the trash as a test because I
: havenb’t been able to get the containinig folder part to work.
: What happens is that the script (below) works fine when the folder window is
: open, but if the folder window is closed the file just sits in the folder.
: It works okay if I drag the file to the closed folder but if I save to it
: the folder has to be open for the script to work. Why?
- Folder actions only work when attached to folders with OPEN windows. It’s just the way it is. HOWEVER, you can overcome this limitation by using “Folder Actions Plus”, a Classic system extension. Available via MacScripter’s “Scripting Tools” section.
Ah. Thanks for clearing that up. I thought I was going crazy.
: * Folder actions only work when attached to folders with OPEN windows. It’s
: just the way it is. HOWEVER, you can overcome this limitation by using
: “Folder Actions Plus”, a Classic system extension. Available via
: MacScripter’s “Scripting Tools” section.
Cool! Thank you.