开发者

OS X: Watching for dialog box creation from an app

Is it possible to get OS X (Leopard or later) to notify you of dialog box creation?

I want to be able to watch for dialog boxes being created by a particular app and then do something depending on the dialog box that is displayed. The "do something" will likely involve Applescript GUI scripting to click on butto开发者_Go百科ns etc.

I have been told that Applescript does not provide notifications/events for window creation. Is this possible with Objective-C or something else?

Thanks.


The Accessibility APIs can be used to do this sort of thing. There are a lot of APIs and the documentation can be a bit daunting, so a third-party developer has a framework called PFEventTaps that purportedly simplifies writing "assistive applications".

Have fun!


Its not possible to have applescript event listeners to "listen" for a dialog. But I have written applescripts for indesign or quark that check for the existance of a dialog using a timeout and try statments to do what I want the dialog to do. But I would put code in to do that in areas of my script where I would anticipate the presence of a dialog

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜