• 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: Application Bundle won't quit at Shutdown
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Application Bundle won't quit at Shutdown


  • Subject: Re: Application Bundle won't quit at Shutdown
  • From: Yvan KOENIG <email@hidden>
  • Date: Tue, 15 Dec 2009 10:38:28 +0100


Le 14 déc. 2009 à 23:51, email@hidden a écrit :

There is something very hokey with your script's design if you feel a need to 'kill' it. You wouldn't happen to have an infinite loop with a 'delay' command, by any chance? If so, it'll permanently block your app's main event loop, preventing it from handling incoming events (e.g. quit), and you need to replace it with an 'idle' handler, which won't.

Here's the script so that everyone can see what I'm trying to accomplish:

global gScriptName

tell application "Finder"
-- Get this scripts name for the 'on quit' handler below.
set scriptPath to path to me
set scriptNameFull to name of file scriptPath as text

-- Get name of this script, minus the extension
if (offset of "." in scriptNameFull) > 0 then
set gScriptName to (text items 1 thru -2 of scriptNameFull) as string
end if
end tell

I wish to say that it would be a good idea to stop speak to Finder when it's not required.


global gScriptName

-- Get this scripts name for the 'on quit' handler below.
set scriptPath to path to me

tell application "Finder"
set scriptNameFull to name of file scriptPath as text
end tell

-- Get name of this script, minus the extension
if (offset of "." in scriptNameFull) > 0 then
set gScriptName to (text items 1 thru -2 of scriptNameFull) as string
end if

Would be better but original and edited ones are bugguy.
They are supposed to remove the extension name but they remove only the last character.

My alternative would be :

-- Get this scripts name for the 'on quit' handler below.
set scriptPath to path to me

tell application "Finder"
set scriptNameFull to name of scriptPath -- no need for 'file' & no need for 'as text'
set theExt to name extension of scriptPath
end tell

-- Get name of this script, minus the extension
if theExt is not "" then
set gScriptName to (text items 1 thru -(2 + (length of theExt)) of scriptNameFull) as string
end if

Yvan KOENIG (VALLAURIS, France) mardi 15 décembre 2009 10:38:01



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Application Bundle won't quit at Shutdown [Solved]
      • From: email@hidden
References: 
 >Re: Application Bundle won't quit at Shutdown (From: has <email@hidden>)
 >Re: Application Bundle won't quit at Shutdown (From: email@hidden)

  • Prev by Date: Re: Application Bundle won't quit at Shutdown
  • Next by Date: alias list and class alst
  • Previous by thread: Re: Application Bundle won't quit at Shutdown
  • Next by thread: Re: Application Bundle won't quit at Shutdown [Solved]
  • Index(es):
    • Date
    • Thread