Transferring another application window on Mac to C

How do I add another Mac application window in C / C ++? I have a pid application. I found solutions for AppleScript, but I am not familiar with AppleScript. (and also not for the purpose of C) Thank you!

edit: I cannot use Carbon in this program, because it must be 64-bit binary. edit2: I'm also interested in Carbon and Cocoa solutions. I could add this to a 32 bit application to use Carbon.

+3
source share
1 answer

You can do it as follows:

#include <stdlib.h>

system("osascript -e \"tell application \\\"Address Book\\\" to activate\"");

This will also launch the application (the address book in this example) if it is not already running.

+1
source

Source: https://habr.com/ru/post/1756070/


All Articles