• 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
global declarations for many variables: is there a better way?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

global declarations for many variables: is there a better way?


  • Subject: global declarations for many variables: is there a better way?
  • From: Chris Adams <email@hidden>
  • Date: Thu, 05 Apr 2001 10:44:20 -0400

I am stuck in a way that works, but I think that there must be a better way.

I have variables that I would like to make reference to in a number of
routines within a script. What works for me is to declare the variables at
the beginning:

property height:100
property width:200

global numberOfPictures
global aspectRatio
global fileName
global caption
etc.

This works for me. I feel that somehow I should figure out ways to program
so that I do not need so many global variables, but Applescript seems to
"need" them more than some of the other languages that I am familiar with if
I am performing many functions on a single folder or file, etc.

What I end up with is a column of declarations at the top of my script and I
end up declaring every variable as global that gets used in more than one
routine.

1) Is there a way to define a variable as global automatically or from
within a routine or via a list? I end up declaring most of the variables
that I use as Global.

2) I am using only Script Editor so far. Which third party script editors
work well with variables?

Thank you.

--
Chris Adams
Cypress Lake Studios
Hypermedia, Quicktime, and Internet Design
http://www.cypresslakestudios.com
email@hidden


  • Follow-Ups:
    • Re: global declarations for many variables: is there a better way?
      • From: Sander Tekelenburg <email@hidden>
  • Prev by Date: New Folder with date
  • Next by Date: Copy Mac files to Windows NT4
  • Previous by thread: Re: New Folder with date
  • Next by thread: Re: global declarations for many variables: is there a better way?
  • Index(es):
    • Date
    • Thread