Re: when is a global not a global?
Re: when is a global not a global?
- Subject: Re: when is a global not a global?
- From: Tetsuro KURITA <email@hidden>
- Date: Wed, 15 Sep 2010 18:07:02 +0900
I recommend to use property instead of global variable at the top-level
script as follows.
property tvpi2crontabP : "/DVR/scripts/tvpi2crontab.app"
property tvpi2crontab : (load script POSIX file tvpi2crontabP)
...
property recDir : missing value
A value of a global variable in a script object is share with a value of
a property at the top-level script.
I can't explain difference of behavior between Script Editor and Applet,
but your problem can be solved above code.
=======================================================
Tetsuro KURITA
E-mail: email@hidden
http://homepage.mac.com/tkurita/scriptfactory/en
=======================================================
On 2010/09/15, at 5:43, tom wible wrote:
> when it's run in script editor:-(
>
> i recently had to run an app bundle in s.e. to debug it, and the same code that runs perfectly when it runs standalone fails in s.e.:
>
> property tvpi2crontabP : "/DVR/scripts/tvpi2crontab.app"
> property tvpi2crontab : (load script POSIX file tvpi2crontabP)
> ...
> global recDir
> ...
> tvpi2crontab's init() -- this initializes recDir, which is also declared global in tvpi2crontab
> log recDir
>
> running the above code as a standalone app bundle works perfectly, but when i run it in s.e. the globals aren't seen:
>
> "The variable recDir is not defined."
>
> bita by s.e. again, but a simple work-around:
>
> set recDir to tvpi2crontab's recDir -- only needed when running in s.e.
>
>
>
> _______________________________________________
> 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
_______________________________________________
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