I’d like to trigger a Keyboard Maestro macro whenever Safari opens a new window. Is there a way to detect this without running a stay-open script to poll for it? Is there an Apple event I could access?
unfortunately no, there is no way to get notified
Probably Safari is not fully attachable for good reasons. But I seem to remember that there was some way to launch Safari and wait for the reply. Or maybe it was with unix. If this doesn’t turn out then disregard.
To see if applications sends events or not for certain actions you can launch the application in the terminal and set the AppleEvent log on.
For safari you need to type the following commands in the terminal:
I can tell you that Safari doesn’t sends out events when a new window is opened.
That’s interesting. The only way to do it is with a monitored
If it is any help, this file is updated OMM (10.9.3) each time a Safari window is opened.
Maybe have launchd watch this file.
The only way I know of to detect that via AppleScript is Bill Cheeseman’s UI Actions.