• 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: Relaunch App (Quit, Relaunch If Quit)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Relaunch App (Quit, Relaunch If Quit)?


  • Subject: Re: Relaunch App (Quit, Relaunch If Quit)?
  • From: "Chunk 1978" <email@hidden>
  • Date: Wed, 14 Jan 2009 11:03:05 -0500

thanks!  your way seems much easier :)

On Wed, Jan 14, 2009 at 10:36 AM, Jean-Daniel Dupas
<email@hidden> wrote:
> The proper way to do it is probably to listen for Finder death using a
> timeout, not polling the process list.
>
> You can either use the NSWorkspaceDidTerminateApplicationNotification or use
> the low level kqueue function which provide such facility.
>
> Le 14 janv. 09 à 16:25, Chunk 1978 a écrit :
>
>> my goal is to quit an app, check to see if it has quit, and then
>> relaunch the app if it has quit successfully.  i'm sending
>> quit/relaunch commands with applescripts (tell application "Finder" |
>> quit | end tell, tell application "Finder | launch | end tell), and
>> i'm attempting to make this code work without using any type of delay
>> mechanism but i'm lost.
>>
>> the following code works very well on quitting and relaunching the
>> Finder, except if the Finder is busy (copying a file, or something),
>> the program will continuously try to quit the finder while the finder
>> prompts that it's busy - it's a continuous loop... a bad scene...
>>
>> essentially i need to somehow figure out how to have this loop quit
>> the finder, but stop the loop if it's busy...
>>
>> -=-=-=-
>>
>> - (IBAction)restartFinder:(id)sender
>>        {
>>        //Quit Finder
>>        NSDictionary* errorDict = nil;
>>        NSAppleEventDescriptor *returnDescriptor = nil;
>>        returnDescriptor = [quitFinderScriptObject
>> executeAndReturnError:&errorDict];
>>
>>        //Check To See If Finder Has Quit
>>        NSWorkspace *ws = [NSWorkspace sharedWorkspace];
>>        NSArray *runningAppDictionaries = [ws launchedApplications];
>>        NSDictionary *aDictionary;
>>
>>        for (aDictionary in runningAppDictionaries)
>>                {
>>                //If Finder Hasn't Quit Then Return
>>                if ([[aDictionary
>> valueForKey:@"NSApplicationBundleIdentifier"]
>> isEqualToString:@"com.apple.finder"])
>>                        {
>>                        [self restartFinder:nil];
>>                        return;
>>                        break;
>>                        }
>>                }
>>
>>        //If Finder Has Quit Then Continue To Relaunch Finder
>>        NSDictionary* errorDict = nil;
>>        NSAppleEventDescriptor *returnDescriptor = nil;
>>        returnDescriptor = [startFinderScriptObject
>> executeAndReturnError:&errorDict];
>>        }
>>
>> -=-=-=-
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Relaunch App (Quit, Relaunch If Quit)? (From: "Chunk 1978" <email@hidden>)
 >Re: Relaunch App (Quit, Relaunch If Quit)? (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: Capture video from core animation (QC)
  • Next by Date: Re: KVC error from bound SortDescriptor
  • Previous by thread: Re: Relaunch App (Quit, Relaunch If Quit)?
  • Next by thread: NSTableView
  • Index(es):
    • Date
    • Thread