d0n Posted August 17, 2009 Share Posted August 17, 2009 (edited) I have something like this i want to put in a loop, however the return for the StringRegExp is also an array, how should i go at this? $aMatch1A = StringRegExp($Lines[$a], $Skill_1A, 1) $aMatch1B = StringRegExp($Lines[$a], $Skill_1B, 1) $aMatch2A = StringRegExp($Lines[$a], $Skill_2A, 1) $aMatch2B = StringRegExp($Lines[$a], $Skill_2B, 1) Edit: what i am trying to do is to make this code better, by looping those repetitive lines For $a = $Start To $Lines[0] $aMatch1A = StringRegExp($Lines[$a], $BossMod_Skill_1A, 1) $aMatch1B = StringRegExp($Lines[$a], $BossMod_Skill_1B, 1) $aMatch3A = StringRegExp($Lines[$a], $BossMod_Skill_3A, 1) $aMatch3B = StringRegExp($Lines[$a], $BossMod_Skill_3B, 1) Select Case $aMatch1A <> 0 AND $aMatch1A[1] = $target GUICtrlSetData($BossMod_Editbox1, $aMatch1A[0]&" - 1 Start"&@CRLF,GUICtrlRead($BossMod_Editbox1)) Case $aMatch1B <> 0 AND $aMatch1B[1] = $target GUICtrlSetData($BossMod_Editbox1, $aMatch1B[0]&" - 1 Over"&@CRLF,GUICtrlRead($BossMod_Editbox1)) Case $aMatch3A <> 0 AND $aMatch3A[1] = $target GUICtrlSetData($BossMod_Editbox1, $aMatch3A[0]&" - 2 Start"&@CRLF,GUICtrlRead($BossMod_Editbox1)) Case $aMatch3B <> 0 AND $aMatch3B[1] = $target GUICtrlSetData($BossMod_Editbox1, $aMatch3B[0]&" - 2 Over"&@CRLF,GUICtrlRead($BossMod_Editbox1)) EndSelect Next Edited August 17, 2009 by d0n Link to comment Share on other sites More sharing options...
BrettF Posted August 18, 2009 Share Posted August 18, 2009 Maybe something like this (untested) Dim $aAllMatches[4] $aAllMatches[0] = StringRegExp($Lines[$a], $Skill_1A, 1) $aAllMatches[1] = StringRegExp($Lines[$a], $Skill_1B, 1) $aAllMatches[2] = StringRegExp($Lines[$a], $Skill_2A, 1) $aAllMatches[3] = StringRegExp($Lines[$a], $Skill_2B, 1) For $i = 1 To UBound($aAllMatches) - 1 $tarray = $aAllMatches[$i] If IsArray($tarray) Then MsgBox (0, "", $tarray[0]) For $x = 1 To $tarray[0] If $tarray[$x] = $target Then ConsoleWrite("[" & $i & "] is what we want." & @CRLF) Else ConsoleWrite("[" & $i & "] is not what we want. (" & $tarray[$x] & ")" & @CRLF) EndIf Next Else ConsoleWrite("[" & $i & "] is not an array." & @CRLF) EndIf Next Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
d0n Posted August 18, 2009 Author Share Posted August 18, 2009 is it not possible to loop the stringregExp part because of array? 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