Nunos Posted April 28, 2016 Share Posted April 28, 2016 I have a script that runs a defraggler function off a button push in a GUI but I realized that I need to detect all of the Fixed drives and whether or not they are Solid State Drives or old spinners before I run it. The Defraggler Func works great but I am not sure if I have the below code right for detecting ssd's and then skipping them and only running the function on the old spinning types. Not sure if this is 1) Right and 2) Where and how to make it run the other function. #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Local $aArray = DriveGetDrive($DT_FIXED) If @error Then ; An error occurred when retrieving the drives. MsgBox($MB_SYSTEMMODAL, "", "It appears an error occurred.") Else For $i = 1 To $aArray[0] ; Show all the drives found and convert the drive letter to uppercase. ;MsgBox($MB_SYSTEMMODAL, "", "Drive " & $i & "/" & $aArray[0] & ":" & @CRLF & StringUpper($aArray[$i])) DriveGetType($i,$DT_SSDSTATUS) MsgBox($MB_SYSTEMMODAL, "ERROR", "Your drive is a solid state drive. You shouldn't run Defrag on it try the Windows Optimization instead." & $DT_SSDSTATUS) Next EndIf Thank you in advance for any help and direction. Link to comment Share on other sites More sharing options...
Trong Posted April 28, 2016 Share Posted April 28, 2016 (edited) Try This: Local $aArray = DriveGetDrive("FIXED") If @error Then ; An error occurred when retrieving the drives. MsgBox(32, "", "It appears an error occurred.") Else For $i = 1 To $aArray[0] ; Show all the drives found and convert the drive letter to uppercase. ;MsgBox($MB_SYSTEMMODAL, "", "Drive " & $i & "/" & $aArray[0] & ":" & @CRLF & StringUpper($aArray[$i])) If DriveGetType($aArray[$i], 2) <> "" Then MsgBox(48, "ERROR", "Your drive (" & StringUpper($aArray[$i]) & ") is a solid state drive. You shouldn't run Defrag on it try the Windows Optimization instead.") Else MsgBox(32, "OK", "Drive (" & StringUpper($aArray[$i]) & ") not is a solid state drive") EndIf Next EndIf Edited April 28, 2016 by VIP not Regards, Link to comment Share on other sites More sharing options...
Nunos Posted April 28, 2016 Author Share Posted April 28, 2016 Awesome thank you VIP I will try to add it to my script and test on a few different systems. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now