Q: Applescript in Automator - Loops and Variables
Hi to everyone!
I'm trying to create an Automation with a Loop action in which workflow there is an Applescript Action too. What I need to do and I couldn't find anywhere on the net is how to make a variable increase in 1 each times it makes a loop. I will try to explain it again, in case it's not clear.
First Action
Applescript
N=1
Second Action
Loop
So each time it loops, the N variable increases 1 number. First loop, N=1, second loop N=2, third loop N=3 and so on.
Any ideas.
Thank you!
AUTOMATOR, Mac OS X (10.7.2)
Posted on Jan 4, 2012 7:26 PM
there are a couple of different ways of doing this, depending on the specifics, but keep in mind that they are all sort of hacks. Automator's really not designed with that kind of looping in mind. but you can do the following: create a storage variable called V, and use the following actions
Get Value of Variable (V)
Run Applescript
on run {input, parameters}
return input + 1
end run
Set Value of Variable (V)
Loop
the variable V will automatically be initialized to 0, and will increment its way up with each repetition of the loop
Posted on Jan 4, 2012 8:11 PM