Re: max script size
Re: max script size
- Subject: Re: max script size
- From: Martin Crisp <email@hidden>
- Date: Thu, 20 Mar 2003 9:19:56 +1100
- Organization: Tesseract Computing
On Tue, 18 Mar 2003 21:02:09 +1100, Michael Glasser wrote
(in message <
email@hidden>):
>
Anyone know how big a script can be in OS X? I have one that is
>
pushing 4500 lines and growing... seems OK still, except I have always
No, can't help there, my largest is 2000+ lines. Under OS 9 I had
it split into several scripts...
>
had to run it from the editor (the beta one). Just afraid I am going
Why have you 'had' to run it from the Script Editor? [I only run
scripts in the script editor when testing, and then it's usually
only an abstracted version of what will go into an applet]
>
to hit a wall some time soon. Any good ways to split scripts into sub
>
scripts?
What I had done under OS 9 was split the app up into functional
units, with the 'main' script farming out tasks to subscripts. Any
handler that could be called from multiple subscripts stayed in the
main app, _or_ placed into a 'utilities' subscript which was
invoked via a call from the main script.
e.g. in main I had something like (pseudo code):
on load_scripts() --called as early as possible in main script
set breed_script to load script file <breed_path>
set utils_script to load script file <utils_path>
-- etc.
end
on sort_list(alist)
tell utils_script to sort(alist) returning asortedlist
return (asortedlist)
end
on breed_em()
tell breed_script to breed()
end
and in the various sub_scripts:
sort_list(somelist) returning sortedlist
would be sent to the main script, which would farm that task out to
the utilities script.
If the subscripts needed to refer to properties of the main script
then they needed to refer to 'theProperty of current application'.
I couldn't ever get attempts at sub-sub-scripts to work.
[e.g. I had a 'play_game' subscript, which I wanted to have call an
'assess_hand' subsubscript, but instead had to have the
'assess_hand' script called from main, similar to the sort_list()
example above]
I noticed a substantial speed improvement when I amalgamated my
scripts into a single script, but I can't put a figure on how much
that had to do with the amalgamation and how much to do with the
OS9->X changes I made. That said, the speed differece was a factor
of 3 to 4. On that basis I'd suggest you not split the script up
unless you absolutely have to, but others may have different
experiences...
Have Fun
Martin
--
I have absolutely no reason to complain about "success" with my
work; [...] And yet, from time to time a boundless sense of
inferiority plagues me, a desperate feeling of general failure; how
does a person acquire such bits of lunacy?
- MC Escher
Almost always SMASHed
_______________________________________________
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.