Example - Re: Success: Re: can i 'store script' as stay open applet?
Example - Re: Success: Re: can i 'store script' as stay open applet?
- Subject: Example - Re: Success: Re: can i 'store script' as stay open applet?
- From: "Denis G. Marcin" <email@hidden>
- Date: Mon, 10 Sep 2001 12:43:49 -0400
Jason -
i've included the script i used to test the mechanics below. it
implements the suggestion from several folks on this list (see my earlier
thank you for the individual names). the part that i had overlooked when
i first tested this was the last line in the "parent" script - "activate
application...". if i tried to simply double click the applet on the
desktop i got the "quit/run" splash screen. the call from within the
script was the key to get it to work as i wanted it to.
i hope this is understandable. i wrote it as a quick test and didn't take
any time to make it better.
denis
------ my script below
on Make_Program(sayThis)
script an_Applet
property parent : AppleScript
property phrase : sayThis
property cntr : 0
set cntr to cntr + 1
on idle {}
display dialog (phrase & return & cntr) giving up after 2
set cntr to cntr + 1
return 10
end idle
end script
return an_Applet
end Make_Program
set foo to my Make_Program("i'm the first")
class of foo
tell application "Finder"
duplicate file ,
"TIBURON:Desktop Folder:TV program applet shell" to ,
folder "TIBURON:Desktop Folder:"
set name of the file "TIBURON:Desktop Folder:TV program applet shell
copy" to "first script"
end tell
store script foo in file "TIBURON:Desktop Folder:first script" with
replacing
activate application ("TIBURON:Desktop Folder:first script" as text)
----- end of script
but this is nothing more than a rehash of Steven Angier's example that he
provided to my original query which i've included below.
>
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.
>
I would love to see how you did it. Could you post the working code?
>
>
Thanks,
>
>
Jason Bourque
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
>
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><
Denis G. Marcin
Lazarus Engineering Inc.
Malden, MA 02148-1137
781-397-6394
email@hidden