This works (prints, for example, "3 arguments"):
to run argv
do shell script "echo " & (count argv) & " arguments"
end run
This is not (only Argument 3: Three prints, not the previous two arguments):
to run argv
do shell script "echo " & (count argv) & " arguments"
repeat with i from 1 to (count argv)
do shell script "echo 'Argument " & i & ": " & (item i of argv) & "'"
end repeat
end run
In both cases, I run the script using osascripton Mac OS X 10.5.5. Call example:
osascript 'Script that takes arguments.applescript' Test argument three
I do not redirect the output, so I know that the script does not throw an error.
If I add the instruction display dialogabove do shell script, it throws a "no user intervention" error, so I know that it is executing the body of the loop.
What am I doing wrong? What is this loop that makes osascript not print anything?
source
share