I have an applescript that does something along these lines:
using terms from application "Quicksilver"
on open theseitems
repeat with aitem in theseitems
display dialog aitem as text
end repeat
end open
end using terms from
But what I'd like to do is be able to start running a particular applescript.scpt
file via the Terminal and pass in a variable, like a path to a file.
osascript ~/applescript.scpt /path/to/my/file.txt
and then have the Applescript run with access to that parameter. In this case it would (hopefully) display a dialog with that path, /path/to/my/file.txt
I know I could achieve that by doing something like
osascript -e "display dialog "~/path/to/file.txt"
But the point is not to display a dialog with Applescript, rather it's more about knowing if I would be able to pass a variable in to a script file.
In the script you pass in the arguments with the on run
like this :
on run arg
--do whatever you want with arg
end run
If more than one argument is specified the arg
variable is a list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With