Saving handler-defined scripts without source code
Saving handler-defined scripts without source code
- Subject: Saving handler-defined scripts without source code
- From: Steven Angier <email@hidden>
- Date: Sat, 11 Jan 2003 00:11:06 +1100
Hi all,
Does anyone know how to save a handler-defined script so that its source
code is not stored in the file? I have several rather large objects wrapped
in constructor functions which tip the scales at around 100 KB when they
should only be around 20 KB.
It seems that AppleScript does not compile these script objects in the same
way as a top-level script object; though this may be the trade-off for the
dynamic inheritance rules that apply to handler-defined scripts.
Example:
on InitSomething()
script Something
property someProperty : {}
property someOtherProperty : {}
property yetAnotherProperty : {}
on GetSomeProperty()
return someProperty()
end GetSomeProperty
on GetSomeOtherProperty()
return someOtherProperty()
end GetSomeOtherProperty
on GetYetAnotherProperty()
return yetAnotherProperty()
end GetYetAnotherProperty
end script
return Something
end InitSomething
--> 2,588 bytes (saved as run only)
And when called from another script:
InitSomething()
--> Source code:
property someProperty : {}
property someOtherProperty : {}
property yetAnotherProperty : {}
on GetSomeProperty()
return someProperty()
end GetSomeProperty
on GetSomeOtherProperty()
return someOtherProperty()
end GetSomeOtherProperty
on GetYetAnotherProperty()
return yetAnotherProperty()
end GetYetAnotherProperty
Versus:
script Something
property someProperty : {}
property someOtherProperty : {}
property yetAnotherProperty : {}
on GetSomeProperty()
return someProperty()
end GetSomeProperty
on GetSomeOtherProperty()
return someOtherProperty()
end GetSomeOtherProperty
on GetYetAnotherProperty()
return yetAnotherProperty()
end GetYetAnotherProperty
end script
--> 1,348 bytes (saved as run only)
Mac OS X 10.2.3 / AppleScript 1.9.1
Steven Angier
Macscript.com
_______________________________________________
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.