jaberwacky Posted January 16, 2014 Share Posted January 16, 2014 (edited) I'm sure this has been asked before but again I don't really know how to search for this because I don't know what it would be called. I was thinking that because we can do this: For $var in $array ... Next Would it make a good feature request to ask for this: For $var1 in $array1, $var2 in $array2, ... ... Next Or whatever the best syntax would be? Edited January 16, 2014 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
guinness Posted January 16, 2014 Share Posted January 16, 2014 Is your request limited to just For...In loops? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
jaberwacky Posted January 16, 2014 Author Share Posted January 16, 2014 (edited) Well, that was the original intent but if you have anything to offer please do so. Edited January 16, 2014 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jchd Posted January 16, 2014 Share Posted January 16, 2014 N-dimensional collection For loop? What would that sugar bring that we don't already have (beyond saving few keystrokes)? For $var1 In $collection1 For $var2 In $collection2 ... Next Next This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
jaberwacky Posted January 16, 2014 Author Share Posted January 16, 2014 For $var1 In $collection1 For $var2 In $collection2 ... Next Next I think it's a little different from nested loops. The inner loop will run through $collection2 on the first $var1, and then on the 2nd $var1 it owuld run through $collection2 again, repeat. The idea I have is to have them both go through the collections at the same time. Here is the difference in output in our snippets: Local $array1[5] = [1, 2, 3, 4, 5] Local $array2[5] = ['a', 'b,' 'c', 'd', 'e'] For $var1 in $array1, $var2 in $array2 ConsoleWrite($var1 & @TAB & $var2 & @CRLF) Next 1 a 2 b 3 c 4 d 5 e Local $collection1[5] = [1, 2, 3, 4, 5] Local $collection2[5] = ['a', 'b,' 'c', 'd', 'e'] For $var1 In $collection1 For $var2 In $collection2 ConsoleWrite($var1 & @TAB & $var2 & @CRLF) Next Next 1 a 1 b 1 c 1 d 1 e 2 a 2 b 2 c 2 d 2 e 3 a 3 b 3 c 3 d 3 e 4 a 4 b 4 c 4 d 4 e 5 a 5 b 5 c 5 d 5 e Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jchd Posted January 16, 2014 Share Posted January 16, 2014 Ha, you intended that to be a N-parallel collection For loop, then, or an inner join on implicit iterators. That will need to solve the obvious pitfall of collections having different cardinalities: Local $array1 = [1, 2, 3, 4, 5] Local $array2 = ['a', 'b,' 'c', 'd'] For $var1 in $array1, $var2 in $array2 ConsoleWrite($var1 & @TAB & $var2 & @CRLF) Next 1 a 2 b 3 c 4 d what to do next? stop here or raise error or: 5 Null Anyway I don't see much use for such a construct, but you certainly have something in mind. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
jaberwacky Posted January 16, 2014 Author Share Posted January 16, 2014 hhhrrrrnnnngggg, why didn't that ever occur to me??!?!? Okies, get back to work everyone. Nothing to see here. Thanks jchd. =D Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 18, 2014 Share Posted January 18, 2014 I'm not familiar with any language that actually allows parallel looping like that. I've seen pairs of objects being enumerated, but never objects from different collections at the same time. Can you give me an example where you've seen this before? Link to comment Share on other sites More sharing options...
jaberwacky Posted January 18, 2014 Author Share Posted January 18, 2014 (edited) I don't think I have (and for good reason it turns out). Edited January 18, 2014 by jaberwacky Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Mat Posted January 18, 2014 Share Posted January 18, 2014 This should be possible though: Local $a[][] = [[1, "A"], [2, "B"], [3, "C"], [4, "D"], [5, "E"]] For $n, $c in $a ConsoleWrite($n & " " & $a & @LF) Next jaberwacky 1 AutoIt Project Listing Link to comment Share on other sites More sharing options...
jaberwacky Posted January 18, 2014 Author Share Posted January 18, 2014 Absolutely, that would be pretty freakin' cool. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 19, 2014 Share Posted January 19, 2014 This should be possible though: Local $a[][] = [[1, "A"], [2, "B"], [3, "C"], [4, "D"], [5, "E"]] For $n, $c in $a ConsoleWrite($n & " " & $a & @LF) Next Yes, this is something I have seen plenty of times. Link to comment Share on other sites More sharing options...
jchd Posted January 19, 2014 Share Posted January 19, 2014 The possibility of accessing a partial-dimensional sub-array as a first-class array by itself would be much more powerful and useful in many more situations than just sugar in a For loop: Local $a[3][2][2] = [ _ [ _ [ "A_000", "A_001" ], _ [ "A_010", "A_011" ] _ ], _ [ _ [ "A_100", "A_101" ], _ [ "A_110", "A_111" ] _ ], _ [ _ [ "A_200", "A_201" ], _ [ "A_210", "A_211" ] _ ] _ ] Local $b = $a[1] ; should be a 2D array ; ; A_100 A_101 ; ; A_110 A_101 Local $c = $a[1][1] ; should be a 1D array ; ; A_110 A_111 ; For $elem In $a[2][0] ConsoleWrite($elem[0] & ', ' & $elem[1] & @LF) Next ; A_200, A_201 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) 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