set h to "" --Set global variables set answer to "" set outcome to "" --This section determines if the Finder is up and running repeat while answer is not "Finder" tell application "System Events" set procs to processes as list set x to count of items of procs repeat with i from 1 to x set y to item i of procs set yname to y's name if yname is "Finder" then set answer to "Finder" if yname is "Finder" then exit repeat end repeat end tell end repeat set answer to "" repeat while answer is not "SystemUIServer" tell application "System Events" set procs to processes as list set x to count of items of procs repeat with i from 1 to x set y to item i of procs set yname to y's name if yname is "SystemUIServer" then set answer to "SystemUIServer" if yname is "SystemUIServer" then exit repeat end repeat end tell end repeat delay 10 --Once the Finder and the User Interface Servers are up and running, the script delays x seconds for things to stabilize, beeps three times to get te user's attention, then pop-up a dialog to let the user know that SMART Status is being checked for all mounted drives. Change it to suit your system. beep delay 0.5 beep delay 0.5 beep tell application "Finder" display dialog "Checking the SMART status of all mounted disks. It can take up to thirty seconds to complete the check." & return & return & "Please be patient" with icon note giving up after 10 buttons "OK" default button 1 end tell do shell script "diskutil list | grep /dev/" -- get mounted disks using the disk utility CLI command set disklist to paragraphs of result set x to count of items of disklist repeat with i from 1 to x set CurrentDisk to item i of disklist try do shell script "diskutil info " & CurrentDisk & " | grep SMART" --get SMART status using the disk utility CLI command set status to result if status is not " SMART Status: Verified" then set g to words of status set f to count of items of g if f = 3 then set h to item 3 of g else repeat with i from 3 to f set h to h & item i of g & " " end repeat end if beep tell application "Finder" display dialog "A hardware problem has been detected on mounted drive: " & CurrentDisk & return & "Status is: " & h & return & return & "You need to check this drive further." & return & return & "Press OK to continue checking SMART status of other mounted drives" with icon stop buttons "OK" default button 1 end tell set outcome to outcome & CurrentDisk & ": " & status & return else set outcome to outcome & CurrentDisk & ": Verified" & return end if on error set outcome to outcome & CurrentDisk & ": isn't SMART capable" & return end try end repeat beep delay 0.5 beep delay 0.5 beep tell application "Finder" --Report a summary display dialog "All nounted disks checked." & return & return & "Summary:" & return & outcome & return & return & "Click OK to quit the script." & return with icon note buttons "OK" default button 1 end tell