• 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: NSWorkspace launchApplication: vs NSAppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWorkspace launchApplication: vs NSAppleScript


  • Subject: Re: NSWorkspace launchApplication: vs NSAppleScript
  • From: Matt Neuburg <email@hidden>
  • Date: Wed, 31 May 2006 07:05:06 -0700
  • Thread-topic: NSWorkspace launchApplication: vs NSAppleScript

On Tue, 30 May 2006 22:33:23 +0300, Nir Soffer <email@hidden> said:
>According to the documentation, NSWorkspace -launchApplication should
>launch an app synchronically, and returns a boolean result.
>
>However, this code does return a success, but checking for the active
>application little later does not return the expected result. This
>happen randomly, sometime it works and sometime not.
>
>     if (! [[NSWorkspace sharedWorkspace]
>launchApplication:@"Microsoft PowerPoint"])
>         STFail(@"SkipTest: can't launch Microsoft PowerPoint");
>
>This code works:
>
>     NSAppleScript *script = [[NSAppleScript alloc] initWithSource:
>         @"tell application \"Microsoft PowerPoint\" to activate"];

>I'm activating in a fixture setUp, and verify the active application
>using NSWorkspace -activeApplication in a test method.

But you are comparing apples with oranges, since -activeApplication checks
to see what application is *frontmost*. AppleScript "activate", too, makes
an application frontmost. But launchApplication: is like AppleScript
"launch"; it tries to guarantee that the application is *running*, but
nothing else. m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSWorkspace launchApplication: vs NSAppleScript
      • From: Nir Soffer <email@hidden>
  • Prev by Date: Re: some events are missing
  • Next by Date: [OBJC Newbie] - MD5 Digest
  • Previous by thread: NSWorkspace launchApplication: vs NSAppleScript
  • Next by thread: Re: NSWorkspace launchApplication: vs NSAppleScript
  • Index(es):
    • Date
    • Thread