Hi Guys, I’m pretty newbie at Automator, I’ve made a couple of my own simple Automator Actions for movs and use third party ones fairly regularly.
I have been trying to find a way to re-number a series of sequential images within a Folder, randomly, in order to ‘muddle up’ the images
into a new random sequence for some animation workshops I’m running and came across the NoRandomNumber Action which looks perfect.
I would like to output the image sequence ‘out of order’ from the sequence it was shot in.
I’ve managed to ‘Get the value of Variable’ from NoRandom and create a variable but cannot add the resulting numeric variable to any of the fields
in Rename Finder Items which seem fixed in their intent.
I have just discovered the ‘placeholder’ type result which running the workflow gives but can’t figure out where to use that.
I also found a post here somewhere that had the idea of using the Copy To and Get Clipboard contents for the output of NoRandom which sounded a good plan
but generally I keep coming up against my non-programming lack of understanding as regards variables as well as the general sequence of actions and am back at square one.
What is the best way to use the output of NoRandomNumbers?
Is using variables the way to go? If not what?
Is there any other way to rename files other than using ReName Finder Items?
I’m now at that hell point reserved for people with just enough knowledge to get somewhere but not enough to finish.
Any help gratefully accepted, many thanks.
This sort of thing is a bit over Automator’s head. Automator is designed to work on a single item through a workflow, whether that item is a file or a group of files does not matter; it will not go through a group of files and treat each one individually unless you set up a Run AppleScript or Do Shell Script action.
For what you want to do, a stand alone AppleScript may work, or it can be modified to fit inside of a Run AppleScript action as well. Try this and see if it close to what you want:
set image_folder to choose folder
set ct to 1
tell application "Finder"
set count_er to count (get every file in image_folder)
set new_nums to my GetRandomNumbers(count_er)
repeat with each_file in (get every file in image_folder)
set name of each_file to ("NewName" & (item ct of new_nums as text) & ".jpg")--This assumes that all the files are jpg, you can change this to the proper file extension.
set ct to ct + 1
end repeat
end tell
to GetRandomNumbers(x)
set random_set to {}
repeat until ((random_set's length) = x)
set new_rand to random number from 1 to (x * 10)
if random_set does not contain new_rand then set end of random_set to new_rand
end repeat
return random_set
end GetRandomNumbers
Craig, that’s fantastic. I’m not sure what you/I’ve done but I opened the scriptlet in Text Wrangler
and ran it and Hey Presto!
Very happy Automator noodler here, can’t thank you enough.
I learned lots trying to get Automator to do what I wanted so it wasn’t time wasted at all …
And it’s good to know the Automator limitation you mention.
Do you mind if I share this Script with students and a.n.other if the moment arises?
Glad to hear it worked, Gareth. Feel free to share it however you like, but please include my name and email address for anyone that needs help with it. (You can get the email by clicking the highlighted E-mail link next to my posts.)