Does anyone know if it is possible to pass the default script parameters and/or the custom parameters to an applescript?
It's easy enough to pass to a shell script, but I can't quite seem to figure out any syntax that will use the script parameters in an applescript.
If you've managed to do this could you give a quick sample of the syntax you used to utilize the parameter as a variable?
Best answer by mscottblake
@jasonaswell@bentoms This takes parameter 4 ($4 in bash) if it was passed and prompts for the value if it wasn't. Useful for things like Self Service scripts that you would also like to make usable with Casper Remote.
on run argv
if (count of argv) > 3then
set result to item 4of argv
else
set result to text returned of (display dialog "Enter the Username to be made an admin:"default answer "")
end if
....
end run
I can get it to work if I do a shell script with an osascript call inside of it, but I'm currently writing something in Applescript that's too long to reasonably be nested within a shell script.
@jasonaswell@bentoms This takes parameter 4 ($4 in bash) if it was passed and prompts for the value if it wasn't. Useful for things like Self Service scripts that you would also like to make usable with Casper Remote.
on run argv
if (count of argv) > 3then
set result to item 4of argv
else
set result to text returned of (display dialog "Enter the Username to be made an admin:"default answer "")
end if
....
end run
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.