|
|
#1 |
|
Prospect
Join Date: May 2012
Location: TX, United States of America
Posts: 7
|
Folder Action runs twice
For my work I have to change file extensions... A LOT. Were talking hundreds a day. So I'm trying to make a folder action that will let me drop items into a folder, change it to what I specify and then, ask me where to move the items to (usually the drop box of whomever needs the file.)
I've got the script set up perfectly. My only problem is that when ever I drop a group of files (even just 3, one page Word documents) into the folder, one of them always moves before the others. This makes the folder action run twice. The second run-through will start midway during the first and cancel out the first's dialog boxes and postpone the move command until I quit the second. Anybody else had this problem? Has anyone found a way to script around this or is there maybe a plist in finder or something I could modify to make them drop at the same time. Any help would be greatly appreciated! My mac runs 10.6.8 |
|
|
|
|
|
#2 |
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,945
|
I've never had any luck with the sort of FA you're hoping to run. The second run-through almost certainly starts when you change the file extension -- the Finder views that as a new file in the folder and triggers the FA on it.
What you can do to get around this is to abandon the folder action in favor of a fixed dumb folder and an AppleScript to do what you want to its contents. Either that, or move the file first and then change its name (remember that the extension is part of the name.)
__________________
17" MBP, OS X 10.8.3; 27" iMac, OS X 10.8.3 |
|
|
|
|
|
#3 |
|
League Commissioner
Join Date: Aug 2006
Posts: 5,040
|
There are plenty of little free or shareware utilities that will do this well.
Alternatively, you could make an AppleScript droplet app to drag the files onto, rather than a folder with a Folder Action. |
|
|
|
|
|
#4 |
|
Prospect
Join Date: May 2012
Location: TX, United States of America
Posts: 7
|
Thanks NovaScotian for clearing up why that was happening. I didn't know that it checked the name of the contents of the folders to tell when new items were added; I figured it used the item count. And thanks to both of you... I'll mess around with all of your suggestions and see which one I like the best.
|
|
|
|
|
|
#5 |
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,945
|
Folder Actions are a very early construction in AppleScript that relies on the Finder. Benwiggy's suggestion of a droplet is a better way to go (although they can have problems too if you drop too much on at a time. If you've not used one, they go like this example and are saved as an application:
on open these_items -- could be this_Junk; it's up to you.
__________________
17" MBP, OS X 10.8.3; 27" iMac, OS X 10.8.3 |
|
|
|
|
|
#6 |
|
Prospect
Join Date: May 2012
Location: TX, United States of America
Posts: 7
|
Thank you so much. I could not, for the life of me, figure out how to get a droplet to do this. This is exactly what I needed except for the fact that I need to give different groups of files different new extensions. But that should be as simple as setting a variable named (theVariable) to prompt for a text (where I can type the extension), setting (theReply) to text returned of theVariable, and changing the 2nd line to: set the PDFsuffix to "theReply."
I still don't completely understand droplets so please feel free to let me know if that won't work. Thanks again for your help. Last edited by mitchmac24; 06-22-2012 at 10:24 PM. |
|
|
|
|
|
#7 |
|
MVP
Join Date: Apr 2008
Location: Berkeley CA USA
Posts: 1,010
|
Rather than ask for the extension every time, make a separate droplet for each possible extension: one for adding ".txt", one for ".rtf", etc.
Or at least do one for each extension you commonly add, plus one that asks to handle the odd cases. |
|
|
|
|
|
#8 |
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 4,945
|
You can also make it a choose from list so the user doesn't have to type anything and your code doesn't have to check if the entry was a legal extension:
set newExt to (choose from list {"txt", "pdf", "rtf", "doc", "rtfd"} with title "Extension List" without empty selection allowed and multiple selections allowed) as text
__________________
17" MBP, OS X 10.8.3; 27" iMac, OS X 10.8.3 |
|
|
|
|
|
#9 |
|
Prospect
Join Date: May 2012
Location: TX, United States of America
Posts: 7
|
Good ideas... thanks so much guys. Ya'll are life savers
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|