load script question
load script question
- Subject: load script question
- From: "Jason W. Bruce" <email@hidden>
- Date: Fri, 29 Jun 2001 13:33:27 +0000
Loading the script as a parent will also execute the run handler of the
loaded script without a "tell foo to run" statement.
property parent: load script alias "Dora:set x"
Jason Bruce
>
From: email@hidden
>
Reply-To: email@hidden
>
Date: Thu, 28 Jun 2001 19:46:08 -0700 (PDT)
>
To: email@hidden
>
Subject: applescript-users digest, Vol 2 #818 - 15 msgs
>
>
Message: 4
>
Date: Thu, 28 Jun 2001 16:42:15 -0400
>
From: Victor Yee <email@hidden>
>
Subject: Re: load script question
>
To: applescript-users <email@hidden>
>
>
On Thu, 28 Jun 2001 15:43:07 -0400, I wrote,
>
>
> On Thu, 28 Jun 2001 11:02:52 -0700, Michelle Steiner wrote,
>
>
>
>> property loaded_script : alias "Dora:set x"
>
>> set foo to load script loaded_script
>
>> x
>
>
>
> Loading a script does not include running it. Add a "tell foo to run" and you
>
> should get your expected results.
>
>
That sounded rather abrupt... sorry. Telling foo to run will execute its code
>
since "set x to 10" is in an implied run handler. Note that this will set the
>
x of the main script. Without running foo, you get the "not defined" error
>
since the main script's x hasn't been assigned a value.
>
>
Re-reading your post and thinking a little furthur, were you expecting x to be
>
a property of foo? If so, then you would need to declare it as a property in
>
the script to be loaded. Since foo doesn't have an x, you get the "Can't make
>
some data..." error.
>
>
Victor