I want my macbook to run a script each time it resumes from sleep mode.
My code is extremely simple:
tell application "Finder"
if exists (disk "HDD") then
do shell script "diskutil eject HDD"
else
do shell script "diskutil mount HDD"
do shell script "diskutil eject HDD"
end if
end tell
I have a second HDD installed in the cd-rom bay and each time I resume from sleep mode I can hear the drive spinning even though it's current state is not mounted. But forcing a mount/eject command on the drive solves this issue. The only drawback is that I have to do this manually; which now I want to overcome.
Could someone help me on this matter?
There are several options in this page:
https://apple.stackexchange.com/questions/27036/possible-to-run-scripts-on-sleep-and-wake
It seems that the Scenario app could be of some help-