• 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
help needed-- probably a scoping problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Re: Impossible "If"?
  • Next by Date: Re: How do I simply quit execution?
  • Previous by thread: help needed-- probably a scoping problem
  • Next by thread: Re: help needed-- probably a scoping problem
  • Index(es):
    • Date
    • Thread