I need an Apple Script that will prevent an external hard disk from spinning down every ten minutes. I have only the slightest AppleScript knowledge (think chimpanzee), so I hope one of you good souls out there will get inspired and do all the work for me.
I should mention that said hard disk does not respond to Energy Saver settings, nor are there jumpers on the drive mechanism that I can reposition. The drive has been coded at the factory to spin down.
I guess you could write a stay-open app that writes a trivial file to the external drive (and immediately deletes it) every 9 minutes or so to ensure it stays active. This could be a 1-byte invisible file:
tell application "Keychain Scripting"
launch
tell current keychain
tell (some generic key whose name is "NoSpindown")
set myPW to password
end tell
end tell
end tell
delay 1
try
do shell script "sudo pmset -a spindown 60" password myPW with administrator privileges
delay 1
do shell script "sudo -k" -- timeout sudo ability
end try
Alternatively, you can just put your administrative password at myPW. I don’t know if spindown 0 is equivalent to never (as it is for screen dimming)