I have a script that I want to write. I want from a master script to call a helper script and pass in an array of numbers. In the helper script I want to process the array of numbers, and type DownArrow the number of times represented by the value in the array. For example:
put (1,3,4) into myarray
DoIt myarray
DoIt should:
type DownArrow
type DownArrow, DownArrow, DownArrow
type DownArrow, DownArrow, DownArrow, DownArrow
I cant seem to get the syntax just right:
repeat with each column in columns
repeat until column is 0
typetext DownArrow
subtract 1 from column
end repeat
end repeat
I got an error when I try and subtract from my counter, saying the value is not a number.
Something doesn’t seem quite right there. Double-check that you’ve spelled everything correctly and aren’t mixing up “column” and “columns” anywhere. If your DoIt.script looks exactly like the code I posted last, and you call it like this it should work:
put (1,3,4) into myarray
DoIt myarray
If that doesn’t seem to work for you, try stepping through in debug mode to see exactly what you’re getting in your variables.
I gave it a second look, and it was user error the second time. I hadnt declared columns in my params statement so it was null, or something. Its working fine now, thanks!