help needed-- probably a scoping problem
help needed-- probably a scoping problem
- Subject: help needed-- probably a scoping problem
- From: Ken Victor <email@hidden>
- Date: Sat, 19 May 2001 08:23:10 -0700
i have a script that basically is as follows:
script main
property a : missing value
property b : missing value
on run
---
(* set properties a and b to some values *)
--
end run
on initProperties()
(* set properties a and b to some values *)
end initProperties
end script
on run
-- time 1
display dialog ("time 1 property a = " & ((a of main) as string))
display dialog ("time 1 property b = " & ((b of main) as string))
initProperties() of main
-- time 2
display dialog ("time 2 property a = " & ((a of main) as string))
display dialog ("time 2 property b = " & ((b of main) as string))
run script main
-- time 3
display dialog ("time 3 property a = " & ((a of main) as string))
display dialog ("time 3 property b = " & ((b of main) as string))
end run
when i run this, the dialogs at time 1 show both variables (a & b) as
missing value. this is correct.
at time 2, the dialogs show both variables as they are set by the
initProperties handler of the script main. this is again correct.
at time 3 however, the dialogs show both variables to have the same
values that they had at time 2 and don't reflect any changes made by
running the script main. this is not what i was expecting and is
causing me all sorts of problems. am i doing something wrong? is this
a scoping problem of some sort? and if so, could someone please
explain this to me?
i am running OS 9.1 on a G4 733 MHz machine with Applescript 1.6.
thanx,
ken