lecture on: on 'on open', 'on run' and other functions
lecture on: on 'on open', 'on run' and other functions
- Subject: lecture on: on 'on open', 'on run' and other functions
- From: email@hidden
- Date: Wed, 22 Nov 2000 20:45:59 EST
good morning everybody! happy thanksgiving!
just some info on 'on open', 'on run', and some other stuff
all scripts (not including folder actions) use either 'on run' or 'on open'
or both
usually, they only have 'on run' and you need not type 'on run' if that is
the case
'on open' is what happens when either you drop a file or files on it or
double click on a file of the application **(for more info on this email me,
i cant explin it now)**
'on run' defines what happens when the icon is double-clicked.
global variables are 'declared' at the top of a script and tell the computer
that they may be used in any function. otherwise they can only be used in one.
you may also have other functions that can help organize your program. here
is an example:
global x,y
on open thefiles
repeat with afile in thefiles
doopenstuff(afile)
end repeat
end open
on run
set {x,y} to {3,2}
dorunstuff()
end run
on dorunstuff()
display dialog "x="&x&" and y="&y
end dorunstuff
on doopenstuff(somefile)
display dialog somefile as text
end doopenstuff