Re: Variable-bridges through scripts
Re: Variable-bridges through scripts
- Subject: Re: Variable-bridges through scripts
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 04 Apr 2001 08:46:07 -0700
On 4/4/01 6:12 AM, "JJ" <email@hidden> wrote:
>
Let9s say I have a 30 lines applet that, finally, give me an alias:
>
>
"HD:DF:my_alias:" as alias
>
>
I want do this:
>
>
<Lines 31->end of FIRST_APPLET>
>
set The_Property to ("HD:DF:my_alias:" as alias)
>
tell Second_Applet to activate
>
tell me to quit
>
<END FIRST_APPLET>
set f to load script alias "HD:Some Folder:Second_Applet"
set f's My_Property to alias "HD:DF:my_alias:"
store f in file "HD:Some Folder:Second_Applet" replacing yes
tell application "HD:Some Folder:Second_Applet" to run
--FIRST_APPLET quits by itself unless it's a stay-open applet, or: quit
--END FIRST_APPLET-
>
>
Now, the second applet
>
>
<SECOND_APPLET>
>
property My_Property : The_Property -- from first_applet
>
<SCRIPT>
>
<END SECOND_APPLET>
<SECOND_APPLET>
property My_Property : ""
on run -- optional
activate -- if you want it in the front, otherwise no
if My_Property = ""
beep
display dialog "The script is only to be run by FIRST_APPLET!" with
icon 0
return
end if
--script here
set My_Property to "" -- if you don't want it to be run again
--quits by itself unless it's a stay-open applet, or: quit
end run
If you want SECOND_APPLET to be able to be run at other times using the
alias previously supplied by FIRST_APPLET then don't reset its My_Property
to "" at the end, just leave it as it is. If it's only being run immediately
by FIRST_APPLET, you could actually just
set f's My_Property to "HD:DF:my_alias:"
as a string, and then in SECOND_APPLET, have the first line of the real
script (after excluding "") be:
set my_alias to My_Property as alias
but that wouldn't allow you to move the file referred to between times, so
you are in fact better off doing it as you planned if you're going to run
SECOND_APPLET at other times.
--
Paul Berkowitz