• 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
Try to open an app from a screensaver
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Try to open an app from a screensaver


  • Subject: Try to open an app from a screensaver
  • From: Juanjo Conti <email@hidden>
  • Date: Fri, 24 Apr 2015 19:40:04 -0300

I'm developing a screensaver. I want to achieve the following: then the
user hits the key 's', stop the screensaver and open a program.

Handling the key stroke is done, and I'm launching the program as:

(the following code search runningApplications to see if the app is already
running, if not it's open with launchApplicationAtURL. Finally I take it to
foreground with activateWithOptions)

            var app: NSRunningApplication?
            for a in NSWorkspace.sharedWorkspace().*runningApplications*
as! [NSRunningApplication] {
                if a.localizedName!.isEqual("App Name") {
                    app = a
                    break
                }
            }
            if app == nil {
                app =
NSWorkspace.sharedWorkspace().*launchApplicationAtURL*(NSURL(fileURLWithPath:
UsualApplicationPath)!, options: NSWorkspaceLaunchOptions.Default,
configuration: [:], error: nil)!
            }
            var foreground = false
            while !foreground {
                foreground = app!.*activateWithOptions*
(NSApplicationActivationOptions.ActivateIgnoringOtherApps)
            }

After that i raise the event that finish the screensaver.

The problem is that sometimes, if there is a Finder window open, my app
ends at the bottom of it (!) Anybody knows why can this be happening?

--

Juanjo Conti <jjconti <http://goog_2023646312>@carouselapps.com
<email@hidden>>

Software Engineer - Carousel Apps <https://carouselapps.com>

--
Carousel Apps Limited, registered in England & Wales with registered number
7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket
Street, London SE1 3HN. Any communication sent by or on behalf of Carousel
App Ltd or any of its subsidiary, holding or affiliated companies or
entities (together "Watu") is confidential and may be privileged or
otherwise protected. If you receive it in error please inform us and then
delete it from your system. You should not copy it or disclose its contents
to anyone. Messages sent to and from Watu may be monitored to ensure
compliance with our internal policies and to protect our business. Emails
are not secure and cannot be guaranteed to be error free. Anyone who
communicates with us by email is taken to accept these risks.
_______________________________________________

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


  • Follow-Ups:
    • Re: Try to open an app from a screensaver
      • From: Stephane Sudre <email@hidden>
    • Re: Try to open an app from a screensaver
      • From: Graham Cox <email@hidden>
    • Re: Try to open an app from a screensaver
      • From: Juanjo Conti <email@hidden>
  • Prev by Date: RE: Window Size and Location
  • Next by Date: Re: Try to open an app from a screensaver
  • Previous by thread: RE: Window Size and Location
  • Next by thread: Re: Try to open an app from a screensaver
  • Index(es):
    • Date
    • Thread