• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Global variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >RE: Global variables (From: "Stockly, Ed" <email@hidden>)
 >Re: Global variables (From: deivy petrescu <email@hidden>)
 >Re: Global variables (From: Malcolm Fitzgerald <email@hidden>)

  • Prev by Date: Encoded file URL to Mac or Posix path...
  • Next by Date: Re: Encoded file URL to Mac or Posix path...
  • Previous by thread: Re: Global variables
  • Next by thread: Re: Global variables
  • Index(es):
    • Date
    • Thread