Simucal Posted April 14, 2006 Posted April 14, 2006 Alright, so here is what I am attempting to do. Get the "fixed" drives stored into an array, delete the "C:" drive from the array, and the rest will be check to see if they are NTFS or not. If a drive that is in the array ends up already being NTFS then the item is deleted from the array. However, I am running into trouble when trying to delete the only remaining item in an array. I know this can not be done, but I need a way to account for it. Should I write an If statement to check on _ArrayDelete to see if its @Error code is 2? That just seems a little hackish to me. If someone can show me the way.. it would be appreciated. Here is what I have. $SystemDrives = DriveGetDrive("Fixed") _ArraySort($SystemDrives); arrays must be sorted before they can be searched $DriveC = _ArrayBinarySearch ($SystemDrives, "c:",1); search list of drives and see if c: is in the array If $DriveC <> "" Then _ArrayDelete($SystemDrives,$DriveC); if so, delete the entry EndIf _ArrayDelete($SystemDrives,0); delete the entry with total number of drives, dont need it MsgBox(0,"ubound", UBound($SystemDrives)) For $i = 0 to (UBound($SystemDrives)-1); loop to check which drives has NTFS or not, and format the array accordingly If DriveGetFileSystem($SystemDrives[$i]&"\") = "NTFS" Then _ArrayDelete($SystemDrives, $i) EndIf Next _ArrayDisplay($SystemDrives, "Drives left after NTFS check deletion") AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Valuater Posted April 14, 2006 Posted April 14, 2006 maybe #include <Array.au3> $SystemDrives = DriveGetDrive("Fixed") _ArraySort($SystemDrives, 0, 1); arrays must be sorted before they can be searched $DriveC = _ArrayBinarySearch ($SystemDrives, "c:",1); search list of drives and see if c: is in the array If $DriveC <> "" Then _ArrayDelete($SystemDrives,$DriveC); if so, delete the entry EndIf _ArrayDelete($SystemDrives,0); delete the entry with total number of drives, dont need it MsgBox(0,"ubound", UBound($SystemDrives)) For $i = 1 to (UBound($SystemDrives)-1); loop to check which drives has NTFS or not, and format the array accordingly If DriveGetFileSystem($SystemDrives[$i]&"\") = "NTFS" Then _ArrayDelete($SystemDrives, $i) EndIf Next If IsArray($SystemDrives) And $SystemDrives[0] > 1 Then _ArrayDisplay($SystemDrives, "Drives left after NTFS check deletion") 8)
Simucal Posted April 14, 2006 Author Posted April 14, 2006 (edited) I'm not sure what exactly you are getting at with the $SystemDrives[0] > 1 as it is a string. If you were referring to what DriveGetDrive() usually puts in the [0] position with total number of drives, that is deleted around line 7. And even with just 1 element in it, it is still returning true for being an array. To clarify, I need to in some way account for the last item of an array being removed, even though it cant. I KNOW I can do this using @error codes to see if the _ArrayDelete failed because there are too few items in the array. However, I was looking for a different approach. Because I cant remove the last item from an array, it will still sit there and I need that drive to be gone in some way shape or form. maybe #include <Array.au3> $SystemDrives = DriveGetDrive("Fixed") _ArraySort($SystemDrives, 0, 1); arrays must be sorted before they can be searched $DriveC = _ArrayBinarySearch ($SystemDrives, "c:",1); search list of drives and see if c: is in the array If $DriveC <> "" Then _ArrayDelete($SystemDrives,$DriveC); if so, delete the entry EndIf _ArrayDelete($SystemDrives,0); delete the entry with total number of drives, dont need it MsgBox(0,"ubound", UBound($SystemDrives)) For $i = 1 to (UBound($SystemDrives)-1); loop to check which drives has NTFS or not, and format the array accordingly If DriveGetFileSystem($SystemDrives[$i]&"\") = "NTFS" Then _ArrayDelete($SystemDrives, $i) EndIf Next If IsArray($SystemDrives) And $SystemDrives[0] > 1 Then _ArrayDisplay($SystemDrives, "Drives left after NTFS check deletion") 8) Edited April 14, 2006 by Simucal AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Simucal Posted April 14, 2006 Author Posted April 14, 2006 Nevermind, I took care of it by not deleting the $SystemDrive[0] and leaving it there.. so there will always be at least one element in the array. AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Valuater Posted April 15, 2006 Posted April 15, 2006 Nevermind, I took care of it by not deleting the $SystemDrive[0] and leaving it there.. so there will always be at least one element in the array. i was pretty sure thats what i did 8)
Simucal Posted April 15, 2006 Author Posted April 15, 2006 In the fix you posted, you still had: _ArrayDelete($SystemDrives,0) But I got what you meant, and fixed it accordingly. Thanks valuater AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
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