Re: scope property, parent, load script
Re: scope property, parent, load script
- Subject: Re: scope property, parent, load script
- From: julifos <email@hidden>
- Date: Tue, 29 Apr 2003 09:48:12 +0200
>
At 10:25 PM +0200 28/04/03, julifos wrote:
>
> Script 1, an applescript-studio application:
>
> #####################
>
> kaka's setKaka_s_Var()
>
>
>
> to whatever()
>
> return my kaka's var
>
> end whatever
>
>
>
> script kaka
>
> global var
>
> to setKaka_s_Var()
>
> set var to "pepe"
>
> end setKaka_s_Var
>
> end script
>
> #####################
>
>
>
> Script 2, external applet:
>
> #####################
>
> set k to (load script alias "path:to:Script 1")
>
> display dialog (k's whatever())
>
> #####################
>
>
>
> Error I receive when running this applet (after running "Script 1"): "Can't
>
> get var"
>
>
>
> Is there any way to retrieve kaka's var value?
___________________________
>
The puzzle for me is that it works perfectly, so I imagine your
>
Applescript Studio is causing things to behave differently.
>
>
JD
___________________________
I think so. I'm starting to think that this could be a problem related to a
difference between applescript-data-fork and applescript-resource-fork,
since performance is different when I test this stuff in a stay-open applet,
against an ASS application.
___________________________
>
You ran Script 1, but did you save it before loading it in Script 2?
>
>
As I understand it, you ran one instance and you probed another one.
>
>
Emmanuel
___________________________
I run Script 1 (ASS app). When it is opened (with its pretty main window
with his buttons), I run Script 2. So, global "var" of script "kaka" may be
already defined.
The I get "Can't get var"
I close Script 1 and run it again. Then, again Script 2, again error.
When I save "Script 1" as a "stay-open" applet, to make some tests, Script
2 fails the first time I launch "Script 1". If I close it, then relaunch,
Script 2 works as expected (= changes saved?, though a global shouldn't save
changes).
I can retrieve properties. If I define:
##################
script kaka
property whatever : "whatever"
end
##################
This returns "whatever" when invoked externally:
##################
tell loadedScript to whatever of its kaka
tell loadedScript to var of its kaka
##################
But, when asking for global "var", it doesn't return nothing.
To be more explanatory, in fact I don't need such "var". I need only run a
handler from the loaded script; and this handler is the guy who asks for the
global "var":
##################
tell loadedScript to doWhatever(param1, param2)
##################
Then, this throws "Can't get var", when such "var" is already defined. Seems
as if the handler doesn't know how to find such "var" into its "script
kaka". If I set in this handler a simple:
##################
return (name of my kaka)
##################
It returns "kaka". So, it knows who is calling.
##################
return (whatever of my kaka)
##################
Returns "whatever" (a property). So, it recognizes its script object's
properties.
Finally:
##################
return (var of my kaka)
##################
When asking for its already-defined-global, it doesn't return any value.
Nothing. Nope. No missing value, no errors... Nothing.
JJ
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.