• 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: Stay-open applet - problems on quitting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stay-open applet - problems on quitting


  • Subject: Re: Stay-open applet - problems on quitting
  • From: Richard Morton <email@hidden>
  • Date: Tue, 18 Nov 2003 17:17:05 +1100

On Friday, November 14, 2003, at 09:31 PM, julifos wrote:
It would be fine if it actually quit, but it returns to what it was
doing before. I guess there'll be a way of dealing with it...

Perhaps I'd try a simple try... end try, would be less intensive. For
example, if you observe that errors are allways about "undefined varialbes",
you can use this:

######################
on idle
try
getBaseData()
on error msg number n
if n = -2753 then --> undefined var
quit --> go to quit handler
else
--> let the user know?

This would work, but I was trying to avoid it because it would catch any undefined var error - too big a net. I've done this sort of thing before & have found it can make for a particularly ugly debugging experience. ;)


Or define a global checking:

###################### * untested code...

I ended doing something along these lines:

property haveCleanedUp : false

on run
set haveCleanedUp to false -- first up, reset the flag
-- the init stuff
end run

on idle
try
-- the idle stuff
on error errStr number errNum
if haveCleanedUp then
-- we've already been through the quit handler & done the cleanup stuff - ignore the error
else
-- handle the error
quit
end if
end try
end idle

on quit
try
if not haveCleanedUp then
-- the cleanup stuff
set haveCleanedUp to true
end if
on error errStr number errNum
-- handle the error
end try
continue quit
end quit


With this structure and under the conditions that were causing the problem, this is what happens:

(1) Enters idle processing
(2) Quit is invoked by user
(3) Quit handler executes
(4) Idle processing resumes, finishes &/or errors out
(5) Applet actually quits - quit handler is not executed again

Thanks Don, jj & kai for the suggestions.

Cheers,

Thurston Lastout
_______________________________________________
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.

References: 
 >Re: Stay-open applet - problems on quitting (From: julifos <email@hidden>)

  • Prev by Date: Mount Volume
  • Next by Date: D'oh-plicate terminology
  • Previous by thread: Re: Stay-open applet - problems on quitting
  • Next by thread: Utility tip
  • Index(es):
    • Date
    • Thread