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 developer.apple,com
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)
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?
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.
OR is your question as to whether there is a way for the triggered script to directly change the text in the monitoring app?
-Geoff
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.
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:] http://developer.apple.com/qa/qa2006/qa1491.html.