Re: Scope/Context issue?
Re: Scope/Context issue?
- Subject: Re: Scope/Context issue?
- From: Kurt Klamp <email@hidden>
- Date: Tue, 5 Feb 2008 01:49:49 +0100
Am 05.02.2008 um 01:32 schrieb Skeeve:
The originating question (in German) is here http://www.fischer-
bayern.de/phpBB2/viewtopic.php?t=2665
I have a ScriptA
-- -- -- -- -- -- -- --
property cntr : 0
on run
set my cntr to (my cntr) + 1
No need to use 'my'
a property is visible inside the script as is
display dialog "A says: " & cntr
end run
-- -- -- -- -- -- -- --
Saved as an APPlication
And a ScriptB
-- -- -- -- -- -- -- --
on run
set a to load script file "Macintosh
HD:Users:skeeve:Desktop:iScript:ScriptA.app"
tell a to run
end run
-- -- -- -- -- -- -- --
Now each time I run ScriptA, "cntr" gets incremented.
But running ScriptB, which in turn runs ScriptA, doesn't increment
the counter. Okay. It does, but it's forgotten when you start again.
Can someone explain the background?
ScriptA in ScriptB is just a script object hold by a variable (here a
local too).
I you want script b to be stored with its current state, use a
store script a in file "PathToScriptA"
when finishing ScriptB
on quit -- scriptB
store script a in...
end
-- Kurt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden