gcue Posted August 13, 2008 Share Posted August 13, 2008 im doing a search within an array and if the search is successful it outputs some values based on your query but if the search is not successful id like to indicate that so im trying to incorporate this into my loop but along the way, the values get switched around and i end up with false outputs If GUICtrlRead($initials) <> $avOut[$u][13] Then MsgBox(0, "", GUICtrlRead($initials) & " was not found.") ExitLoop EndIf here's my for loop For $u = 1 To $avOut[0][0] If GUICtrlRead($initials) = $avOut[$u][13] Then If $avOut[$u][3] <> "LAPTOP" And $avOut[$u][3] <> "COMPUTER" Then $type = "No PCs are associated with " & GUICtrlRead($initials) EndIf If $avOut[$u][3] = "LAPTOP" Then $type = ("L" & $avOut[$u][0]) EndIf If $avOut[$u][3] = "COMPUTER" Then $type = ("D" & $avOut[$u][0]) EndIf MsgBox(0, "", $type) EndIf Next Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 13, 2008 Share Posted August 13, 2008 im doing a search within an array and if the search is successful it outputs some values based on your query but if the search is not successful id like to indicate that so im trying to incorporate this into my loop but along the way, the values get switched around and i end up with false outputs If GUICtrlRead($initials) <> $avOut[$u][13] Then MsgBox(0, "", GUICtrlRead($initials) & " was not found.") ExitLoop EndIf here's my for loop For $u = 1 To $avOut[0][0] If GUICtrlRead($initials) = $avOut[$u][13] Then If $avOut[$u][3] <> "LAPTOP" And $avOut[$u][3] <> "COMPUTER" Then $type = "No PCs are associated with " & GUICtrlRead($initials) EndIf If $avOut[$u][3] = "LAPTOP" Then $type = ("L" & $avOut[$u][0]) EndIf If $avOut[$u][3] = "COMPUTER" Then $type = ("D" & $avOut[$u][0]) EndIf MsgBox(0, "", $type) EndIf Next Just add an ELSE clause to you If/EndIf. (See the help file.) 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 Link to comment Share on other sites More sharing options...
gcue Posted August 13, 2008 Author Share Posted August 13, 2008 yea i did that but along the way the values of $type change so the results are inaccurate the second time around thats why im confused =/ Link to comment Share on other sites More sharing options...
Szhlopp Posted August 13, 2008 Share Posted August 13, 2008 yea i did that but along the way the values of $type change so the results are inaccurate the second time around thats why im confused =/ ElseIF is what you want to do. It's saying "If it is not this, then is it this?" If GUICtrlRead($initials) = $avOut[$u][13] Then If $avOut[$u][3] <> "LAPTOP" And $avOut[$u][3] <> "COMPUTER" Then $type = "No PCs are associated with " & GUICtrlRead($initials) ElseIf $avOut[$u][3] = "LAPTOP" Then $type = ("L" & $avOut[$u][0]) ElseIf $avOut[$u][3] = "COMPUTER" Then $type = ("D" & $avOut[$u][0]) EndIf MsgBox(0, "", $type) EndIf Help? RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
gcue Posted August 13, 2008 Author Share Posted August 13, 2008 this is a query of a computer inventory. so the person inputs an account name ($initials) and hopes to get the PCs that belong to that person i can see two problems happening: 1. the person is not found at all 2. the person does not have any PCs associated to him/her im trying to account for both Link to comment Share on other sites More sharing options...
muhmuuh Posted August 13, 2008 Share Posted August 13, 2008 you can indicate a flag" that will indicate if you have found what you were looking for something like this $flag=False For $u=1 to 10 If <searrch> Than Msg("FOUND") $flag=True Exitloop Endif do something... next if $flag==False Then Msg("I did not found it :(") I hope that helped I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more. Link to comment Share on other sites More sharing options...
gcue Posted August 13, 2008 Author Share Posted August 13, 2008 perfect!! thanks!!!!! 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