Re: How to deactivate an app
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