I’m getting the error referenced in the subject line with my script that I want to, first warn users to eject any external media, then reboot the machine. I’ve been searching on this error, but I haven’t found anything that is helpful. Apparently, my syntax is incorrect, but I’m not sure what the problem is. Any help would be appreciated!
tell application "Finder"
do shell script
-- boolean is set to true if user needs to eject disk
set test_for_Eject to false
-- get list of volumes
set the_Disks to (list disks)
-- loop through list of volumes looking for ejectable disks
repeat with disk_Name in the_Disks
tell application "Finder"
if ejectable of (disk disk_Name) is true then
set test_for_Eject to true
display alert "Eject Disk" message "Please eject your disk " & (disk_Name) & " before logging out." as warning
end if
end tell
end repeat
-- proceed to reboot if no ejectable disk present
if test_for_Eject is false then
ignoring application responses
-- uncomment the next line to ask if the user is sure
-- tell application "loginwindow" to «event aevtrrst»
-- uncomment the next line to force reboot
tell application "loginwindow" to «event aevtrrst»
end ignoring
end if
end tell
Model: iMac
AppleScript: 2.4.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.7)