Re: Bug or Feature?
Re: Bug or Feature?
- Subject: Re: Bug or Feature?
- From: email@hidden
- Date: Tue, 11 Dec 2001 21:32:24 -0500
On Tue, 11 Dec 2001 07:31:34 -0700, Gnarlodious <email@hidden>
asked,
>
Am I correct in assuming that in order to use the "Property" statement the
>
script must run as an Application?
No, it works fine in scripts running in a script editor or attached to another
application.
property N : 10
repeat with i from 1 to N
display dialog "The number " & i & " squared is " & i*i
end repeat
In this example, its little different from "set N to 10", but the scoping is
different, so the N declared above is visible throughout the script, while the N
produced by a set command is only visible inside the thing (handler, or script
object, or script) that performed the 'set' command.
Now, the usage
someProperty of application "MyScript"
doesn't mean anything if the script isn't saved as an application, although you
can 'load script' it, and then the script is a script object, so you can say,
load script alias "Disk:path:myScriptFile" returning myScript
someProperty of myScript
And, if you define a script object outright, you can work with its properties:
script DouglasAdams
property theUltimateAnswer : 42
end script
theUltimateAnswer of DouglasAdams
--> result: 42
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden