Re: Script application "bundles" that are read-only: error when quitting
Re: Script application "bundles" that are read-only: error when quitting
- Subject: Re: Script application "bundles" that are read-only: error when quitting
- From: has <email@hidden>
- Date: Sun, 7 Aug 2005 16:57:31 +0100
Paul Berkowitz wrote:
> > on main()
>> -- [main code here]
>> return
>> end main
>>
>> on run
>> local scpt
>> copy me to scpt
>> scpt's main()
> > end run
>
>The copy scpt is unnecessary.
Only if the applet contains no writable top-level properties. Otherwise you definitely do need it. Compare:
-------
property l : {1} -- property's state persists between runs
on main()
repeat 14 times
set l to l & l
end repeat
return
end main
on run
main()
end run
-------
with:
-------
property l : {1} -- property's state doesn't persist between runs
on main()
repeat 14 times
set l to l & l
end repeat
return
end main
on run
local scpt
copy me to scpt
scpt's main()
end run
-------
The first applet blows up upon closing because AS can't serialise the really big list stored in the script's top-level property. The second one doesn't blow up upon closing because the really big list isn't stored in the script's top-level property. If you want to retain selected state, use something like:
-------
property i : 1 -- persist between runs
property l : {1} -- don't persist between runs
on main(orig)
display dialog orig's i
set orig's i to orig's i + 1
repeat 14 times
set l to l & l
end repeat
return
end main
on run
local scpt
copy me to scpt
scpt's main(me)
end run
-------
It's kludgy, but it works.
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden