Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

i.shaun

macrumors 6502a
Original poster
May 1, 2008
784
0
Canada
How do I write an apple script to attach to a particular folder that will:

-re-name files in order as they arrive to a number "0001" "0002" or, just attach the number to the beginning of the current file name.



I tried reading some stuff on apple script, but It seems very confusing to me. I Like using them, especially the iTunes ones I have found. I just don't know how to properly write one.
 
Alright, how about some script help here. I tried the "Record" feature to get something to go off of.

It says:

set name of document file "file.jpg"....

..to "0001_file.jpg"



---------------------
How do I:

-make it set name of most recently added file (this will be a folder action after all)
-set a sequence of numbers that it can add to the files as they come (ie: 0001_file.jpg 0002_file.jpg, etc..)

----------------------------

I'm trying but I can't seem to get these commands to work as I'm basically guessing what commands do what, or even work at all for that matter. The sequence seems to be the most complex part, there has to be some special code for that.
 
So far I got:
------------
tell application "Finder"
activate
set prefix of document files of folder "C&H" of folder "Photos" of folder "Files" of folder "Shaun" of folder "Users" of startup disk to "ThisPartWorks_"
end tell

-------------
Finder Got an error: can't set prefix of every document file of folder "C&H" of folder "Photos" of folder "Files" of folder "Shaun" of folder "Users" of startup disk to "ThisPartWorks_"

--------


I wanted to change the prefix of the one file I have in there to that, so I can confirm the first part of the script works. Then I was going to move on to the number sequence thing.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.