When interacting with other applications on the Mac, AppleScript is the main option to use. Writing AppleScript to run within an application can be pretty annoying, and there’s no syntax checking unless you write it in AppleScript Editor first and then bring over the code. A good solution is using the ScriptingBridge framework, which will provide you with a class interface to interact directly with a target application. Of course your target application must support Applescript, just as if you were writing the script manually.
In a project I’ve been working on recently I need to interact with other process’ windows on the Mac. The application lets you drag windows around that will ‘bolt-on’ to another application’s window and follow it around the screen