osascript parameters

Hi,

How do you send parameters through osascript to the run handler of a compiled script without using ‘run script’. I thought that Apple had implemented this.

Thanks,

Do you mean like this?

do shell script "osascript ~/Documents/Scripts/'Internet Session.scpt' Rogers >/dev/null 2>&1 &"

where “Rogers” is a parameter.

Hi billearl,

I did that with the arguments following the file path, but it did n’t work. I’ll try again. Thanks for confirming that it should work.

Model: MBP
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

Hi billearl,

It’s working now. This is the main script saved to the desktop as Compiled Script “Incrx”:


property n : 0
property m : 1
on run param_list
	set m to item 1 of param_list
	set n to n + 1
	set p to m * n
	tell application "System Events"
		display dialog p
	end tell
end run

When ‘run script’ is run from the script Editor with this:


set desk_path to (path to desktop) as string
run script ((desk_path & "Incrx.scpt") as alias) with parameters {2}

the properties of the script aren’t saved. When I run the script with osascript from Script Editor, the properties are saved.


set desk_path to (path to desktop) as string
set pp to POSIX path of desk_path
set sp to pp & "Incrx.scpt"
set ss to "osascript " & (quoted form of sp) & " 2"
do shell script ss

It’s like creating an instance of a script while deleting the old one.

Thanks a lot,

Model: MBP
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)