• 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: How to deactivate an app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to deactivate an app


  • Subject: Re: How to deactivate an app
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Wed, 01 Feb 2012 13:44:49 +0700

On 1 Feb 2012, at 11:33, Leo wrote:

> If I understand your goals correctly, you can send the following AppleScript script:
>
> tell application "System Events" to set frontmost of process yourApp to true

I tried the following in AppleScript Editor:

set appList to "processes"
tell application "System Events"
	set proCount to count of processes
	set appList to appList & "(" & proCount & "): "
	repeat with x from (1) to (proCount)
		set appName to name of process x
		set appList to appList & appName & ", "
	end repeat
end tell
log appList


But the resulting list of apps has only a very rough resemblance to the list displayed by Command-Tab.

So the following:
NSString *source = @"tell application \"System Events\" to set frontmost of process 2 to true";
NSAppleScript *appleScript = [ [ NSAppleScript alloc ] initWithSource: source ];
NSDictionary *errorInfo;
NSAppleEventDescriptor *aed = [ appleScript executeAndReturnError: &errorInfo ];
[ appleScript release ];

does work in that is activates some app, but process 2 is NOT the previous active app.

Kind regards,

Gerriet.



_______________________________________________

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: 
 >How to deactivate an app (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: How to deactivate an app (From: Leo <email@hidden>)

  • Prev by Date: Re: iCloud On OSX - Cannot save changes
  • Next by Date: Re: NSDateFormatter, timezones and early dates
  • Previous by thread: Re: How to deactivate an app
  • Next by thread: Window/Controller, View/Controller, View ?
  • Index(es):
    • Date
    • Thread