Re: Global variables
Re: Global variables
- Subject: Re: Global variables
- From: KOENIG Yvan <email@hidden>
- Date: Sat, 10 Mar 2007 12:46:35 +0100
Le 10 mars 07 à 02:29:22, Malcolm Fitzgerald a écrit :
On 10/03/2007, at 9:57 AM, deivy petrescu wrote:
Deivy>>I run some tests with droplets here and declaring global
or not, makes no difference, the variable will not be defined
if it is set in the top level script
Below is a test I put together that I think illustrates a clear
difference between using declared and undeclared gobals in the
top level.
It can be run from script editor, or saved as an app and double
clicked and run as a droplet.
Can anyone else corroborate that?
When I run the script below as a droplet I get an error on the
open handler.
For what I understand Ed can run it with no errors as a droplet,
which contradicts what I know and what I get.
Thanks
It runs for me OS 10.3.9. I can double click or drop a file. It
uses display dialog to show the user ERROR messages at various
points - different points for each method of running.
I do use globals and I've never experienced any problems with
droplets. It may be that my droplet template has protected me. My
droplets all look like this:
------------------------------
on open selectedFiles
run
end open
on run
-- do things here
end run
------------------------------
It's funny: for years I did the reverse:
on run
open
end run
on open
- do the tasks
end open
Six months ago I changed to
on run
my common
end run
on open
my common
end open
on common
-- do the tasks
end common
I ran the Ed's script under 10.4.8 and it worked flawlessly,
displaying the coded error dialog when necessary.
But, I continue to prefer the use of properties.
Yvan KOENIG _______________________________________________
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