Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

qpple

macrumors newbie
Original poster
Sep 9, 2007
2
0
Hello I'm trying to make a simple script. The applescipt is called from the command line as an ordinary shell script : admin$ ./scipt.app "hello"

And the Applescript is looking like this :

set message to system attribute "$1"
tell application "Finder"
display dialog message
end tell

Now my problem is that the dialog returns an empty message, where there should be "hello" displayed. Is this something that can be done with an Applescript ? I know that I can use osascript but that isn't an option.

I hope there is a simple sollution.

Qpple
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Why isn't osascript an option? You're already at the command line.

osascript works fine. I couldn't get your method working when you run the .app directly.

Code:
on run message
	tell application "Finder"
		display dialog message
	end tell
end run

Run it like so:

$ osascript script.scpt hello
 

qpple

macrumors newbie
Original poster
Sep 9, 2007
2
0
Why isn't osascript an option? You're already at the command line.

osascript works fine. I couldn't get your method working when you run the .app directly.

Code:
on run message
	tell application "Finder"
		display dialog message
	end tell
end run

Run it like so:

$ osascript script.scpt hello

Let me elaborate why I'm trying to do:
In Apple Remote Desktop (ARD) there is an option to perform a script when a task is complete (in preferences > tasks > "Enable task notification script"). The option calls a shell script with 2 arguments/parameters classname and execution state.
Now I want to create an AppleScript that can accept those 2 arguments that are passed on via the command line and do something with them in the AppleScript. As you can see the osascript isn't an option because I can't alter ARD.
There is an option but not that beautiful because there will be 2 files needed. One shell script file wich redirects the parameters to an AppleScipt with osascript.

Now my question is : Is this possible ?

I would like to be able to call an AppleScript like this : $ ./script.scpt hello

Qpple
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
There is an option but not that beautiful because there will be 2 files needed. One shell script file wich redirects the parameters to an AppleScipt with osascript.

This is what I'd do. Just have a shell script that redirects the arguments to osascript.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.