Because I didn't know about NSWorkspace or NSRunningApplication :-) Thanks! Wow, that's a lot of learning time wasted^h^h^h^h^h^h used unproductively on Scripting Bridge :-) So with this new knowledge, the code might be, like,
NSRunningApplication *previousApp;
int getPreviousApp(void) {
// previousApp = ???;
return SUCCESS;
}
int restorePreviousApp() {
if ([previousApp activateWithOptions:NSApplicationActivateIgnoringOtherApps] == NO)
return FAILURE;
return SUCCESS;
}
How would I set previousApp to the app to the "current application", the one that has focus when my program starts? Perhaps using runningProcessWithProcessIdentifier, but I still don't know how to identify the process that has focus (is frontmost) when my application starts.
- Pete