1

I installed a 2nd HDD in my 2012 macbook pro 13" about a year ago, and i used this script that i found online to put my drive to sleep and wake it up:

tell application "Finder"   
if not (exists the disk "HDD") then   
do shell script "diskutil mountDisk 'disk1'"      
else   
do shell script "diskutil eject 'disk1'"      
end if   
end tell

That worked out just fine until I upgraded to El Capitan. Now I can still put my disk to sleep, but after 10-20 seconds it spins back up. I have tried all tips from this thread, by setting idle time to one minute, preventing spotlight from indexing and searching the disk and now I am completely out of ideas. Do anyone have any ideas?

  • I've noticed some changes in functionality in my Applescripts as well in this OS version. Have you tried debugging in the script editor? – SaxDaddy Mar 10 '16 at 1:04
  • I am quite new to this whole programming world, and have never written a word in applescript before this, so I don't really know how to debug. I read some about script debugger, but that is way to expensive for one task. Can I do it from within apple script? – Erlend Mar 11 '16 at 6:45
  • Yes you can. Just launch Script from the Applications/Utilities and use the debug.print feature in AS to print variables to the debug window while your code is running. I also use dialogue boxes to show variable states since they require interaction from me and pause the processing until I hit OK. The downside is you don't have a trail like you do with the debug window. – SaxDaddy Apr 26 '16 at 23:06
0

This seems to work for me using script editor:

tell application "Finder" if (exists disk "Momentus_XT_750GB") then try tell application "ejectHDD" to activate end try else try do shell script "diskutil mountDisk 'disk0'" end try end if end tell

I used automator to make the ejectHDD app following this link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.