I want to write a script that takes action when a document is opened on a certain application, or before an application quits, etc.
Is there a way to attach a script to an event in an application? Does AppleScript support any form of hooks at all?
If not, can I hack my way into getting what I want?
applescript only has certain "event listeners" the are folder action script that might be considered an event listener and indesign has real event listeners which I won't get into at the moment.
if you want a blanket listener for any application to quit you may find what your looking for in a Quickeys though I'm not certain of this as it has been a long time since I have messed around with quickeys.
but all and all the answer is for the most part no.
hth Mike
EDIT more tools that may help brought by kch
FastScripts
QuickSilver
Keyboard Maestro
"Some apps, eg. iChat, have script hooks in the preferences. In iChat, the Alerts preference pane, you can set it to run a script when a certain event is triggered, like message received, file transfer request, etc." – kch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With