Hi guys i have a script finished but having trouble with looping something.
The script needs to mount an external hard drive
wait until a process is no longer running then unmount the disk
this is what i have so far using so far.
i just don't know how to make the script keep going until the process has ended. Once it has ended i want it to unmount
The script needs to mount an external hard drive
wait until a process is no longer running then unmount the disk
this is what i have so far using so far.
Code:
set myVolumeLabel to "disk1s2"
on ApplicationIsRunning(BreakTime)
tell application "System Events" to set appNameIsRunning to exists (processes where name is BreakTime)
return appNameIsRunning
end ApplicationIsRunning
tell application "Finder"
set diskDev to do shell script "diskutil list | grep \"" & myVolumeLabel & "\" | grep -o 'disk[0-9]*' "
if not (disk myVolumeLabel exists) then
do shell script "diskutil mountDisk " & diskDev
end if
end tell
if ApplicationIsRunning("BreakTime") then
delay 5
else
tell application "Finder"
eject disk "10.5 Time Machine"
end tell
end if
end
i just don't know how to make the script keep going until the process has ended. Once it has ended i want it to unmount