Variables and command-line args
Variables and command-line args
- Subject: Variables and command-line args
- From: Kevin Walzer <email@hidden>
- Date: Mon, 02 Jun 2008 14:09:36 -0400
- Organization: WordTech Communications LLC
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