Re: can i 'store script' as stay open applet?
Re: can i 'store script' as stay open applet?
- Subject: Re: can i 'store script' as stay open applet?
- From: Steven Angier <email@hidden>
- Date: Thu, 06 Sep 2001 09:51:25 +1000
- Organization: Macscript.com
>
on 9/5/01 3:48 PM, Denis G. Marcin, Lazarus Engineering Inc. wrote:
>
>
> Hi Everyone!
>
>
>
> i've been researching this question for days on google, this lists
>
> archives and several A/S sites but have found no mention of it.
>
>
>
> the subject is basically the question -
>
>
>
> can i from within one script create, store and eventually trigger
>
> stay-open classic applets? basically, i want to create a system of
>
> independent scripts that maintain state, respond to stimuli and trigger
>
> separate events.
>
>
Yes, though not directly.
You can use the "store script" command to store a "scpt" resource in any file
with a resource fork, including a pre-saved empty AppleScript application.
If you save a script as an application, you can then make copies of this
application and store scripts into them.
As an example, open a new script window, type the space bar, and save it is an
application.
Then in another script window run the following script:
-----------------------------------------------------------------------
script Wrapper
script Test
property parent : AppleScript
on run
display dialog "I am running."
end run
end script
end script
--choose the empty app shell to save into
set theFile to choose file
--store the script in the shell
store script (Test of Wrapper) in theFile replacing yes
--launch the application
activate application (theFile as text)
------------------------------------------------------------------------
The purpose of the Wrapper script and the parent assignment is to prevent the
store script command from saving the entire script in the file. This method
ensures that only the script Test is stored.
This should get you on the right track. Your next challenge becomes: how to
build the script to save in the first place :-)
Kind regards,
Steven Angier
Macscript.com