• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Script application "bundles" that are read-only: error when quitting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: Script Menu in Tiger: non-persistent property bug?
  • Next by Date: Finder Info to get real audio media source URL
  • Previous by thread: Re: Script application "bundles" that are read-only: error when quitting
  • Next by thread: Script Menu in Tiger: non-persistent property bug?
  • Index(es):
    • Date
    • Thread