PowerCat Posted April 10, 2013 Share Posted April 10, 2013 Sup autoit forums! I'm trying to make a loop to search values from an array into another array #include <file.au3> #include <array.au3> Dim $ArrayAllSources _FileReadToArray("allsources.csv", $ArrayAllSources) Dim $ArrayList _FileReadToArray("list.txt", $ArrayList) _ArrayDisplay($ArrayAllSources) ; array of about 1000 items, [0] contains the total amount of item _ArrayDisplay($ArrayList) ; array of about 10 items, [0] contains the total items For $i = 1 to $ArrayList[0] ; from 1 to 10, should loop 10 times $ItemToSearch= $ArrayList[$i] ConsoleWrite($ItemToSearch & @CRLF) ; correctly returns the item at line number For $i = 1 to $ArrayAllSources[0] $pos = StringInStr($ArrayAllSources[$i], $ItemToSearch ) if $pos > 0 then ConsoleWrite($pos & @CRLF) ; corretly returns the line number where the first item was found Else EndIf Next ; but then it never loops, just exits there! Next Can you guys spot my mistake? I can't see it. It should work. Thanks! Link to comment Share on other sites More sharing options...
water Posted April 10, 2013 Share Posted April 10, 2013 You use $i for both loops. Use another variable for the inner loop. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
PowerCat Posted April 10, 2013 Author Share Posted April 10, 2013 Hahaha nice. Such a noobish mistake Thanks! Link to comment Share on other sites More sharing options...
water Posted April 10, 2013 Share Posted April 10, 2013 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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