Scripting an Application to Open


Im new to apple scripting and to the forum so forgive me if this has already been covered....

I Just got the Imic for my Ibook, with it I run my tv audio throu my computer and out to my computer speakers, however to do this I need to run an app called linein, What I’m hoping to do is to write a script that tells the computer that if it sees the Imic (which automaticlly puts itself into my sound preferences when plugged in) to turn on linein.
Is this even possible?? any ideas on how to do it or where to go to learn??

Any help you people can give is MUCH appericated…



Ahh, such a seemingly simple request…

It’s very easy to launch an application via AppleScript:

tell application “AppName” to activate

However, the hard part in your request is to run whenever the iMic is attached.

There’s no easy way in AppleScript to ‘hook’ into system events such as devices being attached or removed.

About the only way you can do it is to use a stay-open script that’s always running and periodically checks to see if the device has been attached. Quite how you’d detect this depends on the version of the Mac OS you’re running.


Thanks for the quick responce... really that looks like its overkill for what im trying to do. My new solution is to assign the linein app to one of my fkeys using a preference pane that i dl'd from version tracker. Its called onekey, very cheap and does exactly what it says it does.

thanks again