Re: Variables and command-line args
Re: Variables and command-line args
- Subject: Re: Variables and command-line args
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 2 Jun 2008 14:36:43 -0400
Your set command is backwards; the var or prop you are changing comes
first. Remmeber, you set the thermostat to 70 degrees; you don't set
70 degrees to the thermostat.
On 6/2/08, Kevin Walzer <email@hidden> wrote:
> I'm trying to pass an argument to an AppleScript from the command line,
> but keep running into problems with scope. Here's a simple example:
>
> property myName : [] --initialize the variable
>
> on run args
> set item 1 of args to myName -- pass the value of arg 1 to myName
> return myName
> end run
>
> I run this script in Terminal with this command:
>
> osascript name.applescript Name
>
> I expect to get the value "Name" as output. Instead, I get a blank line,
> apparently because I have set the value of myName to [] when defining it
> as a property.
>
> I thought that setting myName as a property would make it global in
> scope, and that the value could be reset from within a handler. How can
> I pass the value of arg 1 to the myName variable?
>
> --
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Sent from Gmail for mobile | mobile.google.com
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden