How to read in-parameters to an applescript-application?

Hi,
This is probably very simple, but I’m new to this and couldn’t find the answer by surfing around the web…

I have made a script that calls the application Thinking Home to turn on one of my lamps (using X10). It looks like this:

tell application “Thinking Home”
turn on the “A3”
end tell

Then I saved this script as an application called “turnA3onApp” from the Script Editor so that I can execute the script from work using SSH:

./turnA3offApp
It works fine, but I natuarly don’t want to make an application for each lamp I got (A1,A2,A3…). So instead of hardcode “A3” in my script I want to pass an parameter in to this application so that I can do something like this:
./turnOn A3
./turnOn A2

Thx.

/D

Handling passed parameters in applescript is so easy:

on executesomething(whit_this_parameter)
   display dialog with_this_parameter
end executesomething

I don’t know about SSH, but you must find the propper syntax to pass parameters to the app with the apple event (depending on the apple event, if SSH gives your app a simple “run”, you can’t do anything, but if it sends a “run with parameters x”, you can handle the parameters:

on run with_parameters
   tell app "Thinking Home" to turn on with_parameters
end run

Perhaps (while somebody who know how does it work SSH gives you the correct answer) you could try anything such as:

./turnOn A3
Will this “run” app “turnOn” with parameters “A3”?

Thank you for the replay jj.

I tried to make an application from this script


on run with_parameters 
  display dialog "[" & with_this_parameter & "]"
end run 

and then ran the application from the terminal, but I didn’t get it to work.
“Could not build string” or something like that. I guess it didnt get in any parameter when I ran it from the terminal.

Any ideas?

/D