I am trying to create a script that would mount and demount my Optibay HDD in my Macbook Pro. I'll be using the (remapped) eject key for running this script.
The HDD is an encrypted HFS+ partition named HDD.
I am using the following applescript:
The Applescript editor gives me this output:
I've looked up the error and it seems to be a privilege violation error.
Could anyone elaborate what I am doing wrong and how I am able to fix this error?
The HDD is an encrypted HFS+ partition named HDD.
I am using the following applescript:
Code:
set myVolumeLabel to "HDD"
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
else
do shell script "diskutil eject " & diskDev
end if
end tell
The Applescript editor gives me this output:
Code:
tell application "Finder"
do shell script "diskutil list | grep \"HDD\" | grep -o 'disk[0-9]*' "
[COLOR="Red"]--> error number -10004[/COLOR]
end tell
tell current application
do shell script "diskutil list | grep \"HDD\" | grep -o 'disk[0-9]*' "
--> "disk2"
end tell
tell application "Finder"
exists disk "HDD"
--> false
do shell script "diskutil mountDisk disk2"
[COLOR="Red"]--> error number -10004[/COLOR]
end tell
tell current application
do shell script "diskutil mountDisk disk2"
--> "Volume(s) mounted successfully"
end tell
Result:
"Volume(s) mounted successfully"
I've looked up the error and it seems to be a privilege violation error.
Could anyone elaborate what I am doing wrong and how I am able to fix this error?