Re: Applescript Studio setting variables
Re: Applescript Studio setting variables
- Subject: Re: Applescript Studio setting variables
- From: Timothy Bates <email@hidden>
- Date: Fri, 01 Feb 2002 09:10:26 +1100
On 1/2/02 5:50 AM, "Bill Cheeseman" <email@hidden> wrote:
>
on 02-01-31 6:39 AM, Paul Strecker at email@hidden wrote:
>
> In other words, is there an easy way to set a variable which is the
>
> contents of a text field or other interface widget in Applescript
>
> studio.
This looked like where I should start :-)
Following Bill's advice I got the following to work (sole handler defined in
the sole script, talking to a window with a button and a text field.
-- Application.applescript
global myWindow
set myWindow to "myWindow"
on clicked theObject
set contents of text field "myName" of window "myWindow" to "hi there"
--works fine
set contents of text field "myName" of window myWindow to "hi there"
--fails: "variable myWindow not defined (err -2753)
end clicked
So, I click, and the first line does its thing, but it is no good having
text names which might change, so I made a global to hold the name of the
current window, but it is not visible from insdie the handler.
What defines scope in an AStudio app?
What is the scope of vars in multiple scripts within a single app?
Tim
Dr Timothy Bates <
mailto:email@hidden>
Macquarie Centre for Cognitive Science (MACCS)
Macquarie University
Ph 61 (2) 9850 8623
Fx 61 (2) 9850 6059