0

I have an app that generates key commands in another app. I used to do it in Applescript studio but I have rewritten in Obj-C. Now I can't figure out how to make the other active in the foreground so I can start generating key commands.

Currently I am just running an Applescript call:

key = [[NSAppleScript alloc] initWithSource:@"tell application \"Pro Tools\" to activate"];
[key executeAndReturnError:nil] ;

The PID for Protools is 14925. I was thinking I could use NSApplications, but I don't think that is the right call.

Thoughts?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Brian Slack
  • 13
  • 1
  • 5

1 Answers1

0

Try this...

[[NSRunningApplication runningApplicationWithProcessIdentifier:PID] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
regulus6633
  • 18,848
  • 5
  • 41
  • 49