Simucal Posted April 14, 2006 Posted April 14, 2006 (edited) Alright, when I do a binary search on an array that has the drive letters of the system on it, why does it give me an Error code #2? How is "c:" out of bounds? $SystemDrives = DriveGetDrive("Fixed") _ArraySort($SystemDrives) _ArrayDisplay( $SystemDrives, "sorted" ) $DriveC = _ArrayBinarySearch ($SystemDrives, "c:") If Not @error Then Msgbox(0,'Entry found',' Index:' & $DriveC) Else Msgbox(0,'Entry Not found',' Error:' & @error) EndIf Always get the error code 2. Parameters $avArray The 1-dimensional sorted array to search on. $iKey String or number to search for in the array. $i_Base Optional: Start Array index for sort, normally set to 0 or 1. Return Value Success: Returns the key (index of where item is in the array). Failure: Returns an empty string. @Error: 0 = No error. 1 = $avArray isn't an array. 2 = $iKey is out of bounds. 3 = If the item wasn't found in the array. 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)
Developers Jos Posted April 14, 2006 Developers Posted April 14, 2006 (edited) Skip the first entry of the array because that contains a numeric entry: #include<array.au3> $SystemDrives = DriveGetDrive("Fixed") _ArraySort($SystemDrives,0,1) _ArrayDisplay( $SystemDrives, "sorted") $DriveC = _ArrayBinarySearch ($SystemDrives, "c:",1) If Not @error Then Msgbox(0,'Entry found',' Index:' & $DriveC) Else Msgbox(0,'Entry Not found',' Error:' & @error) EndIf Edited April 14, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Simucal Posted April 14, 2006 Author Posted April 14, 2006 Ahhh, gotchya. Thanks a ton JdeB 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