set get_name to "/Volumes/" & (do shell script "dru_get=`drutil status -drive internal| grep -ie Name| awk -FName:\\ ' {print $2}'`;df -h |grep $dru_get |awk -F\"/Volumes/\" ' {print $2}' ")
do shell script "open " & quoted form of get_name
We use drutil status -drive internal and grep to find the /dev/disk number of the dvd drive, awk, df -h and grep to get the volume path.
On 21 Nov 2014, at 19:51, Bill Cheeseman < email@hidden> wrote:
On Nov 21, 2014, at 2:01 PM, Stockly, Ed < email@hidden> wrote:
He inserts a CD, and when that's ejected, he removes it and inserts the next, with no more interaction.
Here's a thought, which I have tested only up to a point.
The accessibility API, which underlies GUI Scripting, has a notification called, in plain English, 'row count changed'. So, open a Finder window, set it to show the Desktop, put it in list view, and tell your person to leave it alone. Then set up my UI Actions product < http://pfiddlesoft.com/uiactions> to launch a script whenever the Finder issues the 'row count changed' notification. That will happen every time a disk is inserted or ejected, because the Finder window will add or remove the inserted or ejected disk from the list in the window.
I used my UI Browser product just now to confirm that the notification is issued under these circumstances. In fact, several notifications are issued for each insertion. You can use certain filters in UI Actions to control the circumstances under which an action is triggered. However, you will likely have to do some filtering in the triggered script itself -- such as distinguishing between a disk inserted and disk ejected event (the count goes up or down). One way to get around the multiple notifications per insertion event is to prevent the script from executing if it already executed in the last x seconds, and work out the threshold interval so it is shorter than the time it takes to perform the operation you're performing on each disk.
|