Connect a launchd agent to an AppleScript Studio application


I guess this is only possible with Obj-C.
How can I connect an launchd agent to an AppleScript Studio application?

For example, there is a launchd agent installed which watches the /Volumes folder.
In my ASS application I need to display continuously the presence of a certain volume.

Ok, I can poll the folder /Volumes with the idle handler, but this is quite CPU-expensive.

Is there a any (Obj-C) sample code to do this? I couldn’t find anything at,com

did you get any where with this?
I’m struggling to find any info as I’m looking into a similar thing.

Unfortunately not.

I found out, that DiskArbitration framework would provide this function,
but I have no idea how to talk to it respectively to get the information

I don’t know if I can help with the specifics, but I found this thread interesting:

Incuding ‘RunAtLoad’ in the .plist of your bundled app and running a unix job or applescript might be the thing you’re looking for…

Hoping this helps you along.


Thanks Geoff, but this is not what I mean.

I’d like to change the value of a text field depending on the presence of a certain volume.
The WatchPaths parameter triggers the script, so the RunAtLoad parameter is useless for this purpose.

Including the DiskArbitration framework in the project a launchd agent is actually not needed,
but the framework can’t be controlled by AppleScript (as far as I know)

[Trying to get a handle on what your’re doing]…

You would; “like to change the value of a text field depending on the presence of a certain volume.” Thus when a volume is say; connected/disconnected, you’d like a text field updated in a monitoring program to reflect the volume’s status. Is this basically the idea?

What is the script triggered by WatchPaths doing?

  1. Is the triggered script writing out to the system log file or a tmp file with a date/timestamp+volume’s status? All the monitoring program would have to do is grep search the system log file or tmp file for the latest volume’s status.
  2. OR is your question as to whether there is a way for the triggered script to directly change the text in the monitoring app?


Browser: Safari 419.3
Operating System: Mac OS X (10.5)


It’s no problem to write a script which will be triggered by the launchd agent and change the text field in the application,
but it’s not reliable. If the application will be moved, the script will fail (path to application can fail also, if you have two
applications with the same name but different version).

Maybe the original question is not clear enough. :wink:
I’d like to get the information / notification with DiskArbitration framework, but my Obj-C skills are almost zero.

I also see that networked volumes [TimeCapsule?] are not formally part of the DiskArbitration framework, so you will have to perhaps add that as well with; DiskArbDiskAppearedWithMountpointPing_auto [ref:]

Sorry, I can’t be of more help.