Re: store script bloats saved files?
Re: store script bloats saved files?
- Subject: Re: store script bloats saved files?
- From: Malcolm Fitzgerald <email@hidden>
- Date: Fri, 26 Apr 2002 08:45:24 +1000
I was under the mistaken impression that the handlers had to be
contained within a "script" block prior to being saved as a library
or script object. Following Arthur Knapp's patient advice (below) I
no longer make that mistake illustrated:
script wodaLib <-- wrong ! no block needed
handler_one()
handler_two()
end script <-- wrong !
Now I've just saved the handlers as run-only compiled script files,
using Smile, of course :-) The results speak for themselves.
wrong method wrong method
compiled run-only handler library
Name text Smile Script Editor Smile
FileLib (Serge) 12K 788K 28K 8K
PrefsLib 20K 324K 16K 4K
AstidLib 24K 244K 16K 8K
WebLib 44K 364K 32K 16K
WodaLib 56K 388K 128K 36K *
---------------------------------------------------------
156K 2108K 220K 72K
* bigger because it calls in all above
That's a saving of 2030K over the code that I was trying to run
previously. Thank you Arthur!
I'm trying to create script libraries, I was under the impression
that it was necessary to generate the script object and store it on
the disk, like so:
script little_so_and_so
store script little_so_and_so in (choose file name{})
OH, NO, my friend !!!
Is there another way?
OH, YES, my friend !!!
A "script library" is just a phrase of conveince. There is no
difference between a saved compiled script and a so called "library".
Just create normal scripts with the handlers and properties that you
want to use, save them to disk, and then load them into your other
scripts:
-- Load at runtime, (like a "plug-in"):
--
on run
set myLib to load script alias "MacHD:Folder1:SavedCompiledScript"
-- Load once at compile-time:
--
property myLib : load script alias "MacHD:Folder1:SavedCompiledScript"
The only purpose for the "store script" command is to save changes
to a script object:
on run
set myLibFile to "MacHD:Folder1:SavedCompiledScript"
set myLib to load script myLibFile
set someProperty of myLib to somethingElse
store script myLib in myLibFile replacing yes
This way, one script can load a compiled script, modify it, and then
resave it, perhaps for the benefit of other scripts which might then
load and use the compiled script:
--
--
Malcolm Fitzgerald email@hidden
Database Manager
http://www.asauthors.org
The Australian Society of Authors ph: 02 93180877 fax: 02 93180530
_______________________________________________
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.