Jim1976 Posted November 26, 2010 Posted November 26, 2010 I have limited experience with AutoIt, and fairly new at programming but I'm trying to use AutoIt to return a value from a lookup table. This would be similar to the VLOOKUP function from Excel. I've tried working with a table in Access and using and Access.au3 UDF I found in the forum, but I can't seem to get it to work. I can provide a table (.dbf, .mdb, .txt) with my lookup value and my return value in separate field in the same record. I just need to return the data from the second field after looking up the match value from the first field. Ex: Cats Dogs Potato Tomato Fish Bird Left Right Yin Yang If the lookup value is "Fish", I want to the value "Bird" returned. Any suggestions?
PsaltyDS Posted November 29, 2010 Posted November 29, 2010 Maybe you just need a scripting dictionary object (associative array)? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
JoHanatCent Posted November 29, 2010 Posted November 29, 2010 Try: #include <Array.au3> Local $arr[6][2] = [["Cats", "Dogs"],["Potato", "Tomato"],["Fish", "Bird"],["Left", "Right"],["Yin", "Yang"],["Black", "White"]] _ArrayDisplay($arr) $Key = InputBox("Choose:", "Type your Lookup key in here!", "Fish") For $x = 0 To UBound($arr, 1) - 1 If $arr[$x][0] = $Key Then MsgBox(0, $Key, "Equal = " & $arr[$x][1]) Exit EndIf Next MsgBox(0, 'Sorry!', 'Nothing found!', 2)
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