litlmike Posted January 2, 2020 Share Posted January 2, 2020 (edited) How do I finish this loop? I want it to reset the month name to January after each December, and keep the counter going to 13 and beyond. I could keep explaining, but I think you'll understand what I mean. #include <date.au3> $iNum = 0 $sYear = 2016 For $iCC = 1 To 100 $sMonth = _DateToMonth($iCC + 2, 0) $sString_PartOne = "(" & $iNum & ")" $sString_PartTwo = $sMonth $sString_PartThree = $sYear $sStringFinal = $sString_PartOne & " " & $sString_PartTwo & " " & $sString_PartThree ConsoleWrite($sStringFinal & @CRLF) $iNum += 1 ;~ DirCreate("d:\" & $sStringFinal) If $sMonth = "December" Then $sYear += 1 EndIf Next Edited January 2, 2020 by litlmike _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Subz Posted January 2, 2020 Share Posted January 2, 2020 Like this maybe? #include <date.au3> $iNum = 1 $sYear = 2016 For $iCC = 1 To 13 For $i = 1 To 12 $sMonth = _DateToMonth($i, 0) $sString_PartOne = "(" & $iNum & ")" $sString_PartTwo = $sMonth $sString_PartThree = $sYear $sStringFinal = $sString_PartOne & " " & $sString_PartTwo & " " & $sString_PartThree ConsoleWrite($sStringFinal & @CRLF) $iNum += 1 If Mod($iCC, 12) = 0 Then $sYear += 1 Next $sYear += 1 Next litlmike 1 Link to comment Share on other sites More sharing options...
mikell Posted January 2, 2020 Share Posted January 2, 2020 The same with one loop only #include <date.au3> $iNum = 1 $sYear = 2016 For $iCC = 1 To 100 $m = Mod($iCC, 12) $sMonth = _DateToMonth(($m = 0) ? 12 : $m, 0) $sString_PartOne = "(" & $iNum & ")" $sString_PartTwo = $sMonth $sString_PartThree = $sYear $sStringFinal = $sString_PartOne & " " & $sString_PartTwo & " " & $sString_PartThree ConsoleWrite($sStringFinal & @CRLF) $iNum += 1 If $m = 0 Then $sYear += 1 Next litlmike 1 Link to comment Share on other sites More sharing options...
litlmike Posted January 2, 2020 Author Share Posted January 2, 2020 2 hours ago, Subz said: Like this maybe? #include <date.au3> $iNum = 1 $sYear = 2016 For $iCC = 1 To 13 For $i = 1 To 12 $sMonth = _DateToMonth($i, 0) $sString_PartOne = "(" & $iNum & ")" $sString_PartTwo = $sMonth $sString_PartThree = $sYear $sStringFinal = $sString_PartOne & " " & $sString_PartTwo & " " & $sString_PartThree ConsoleWrite($sStringFinal & @CRLF) $iNum += 1 If Mod($iCC, 12) = 0 Then $sYear += 1 Next $sYear += 1 Next Thanks! _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
litlmike Posted January 2, 2020 Author Share Posted January 2, 2020 2 hours ago, Subz said: Like this maybe? #include <date.au3> $iNum = 1 $sYear = 2016 For $iCC = 1 To 13 For $i = 1 To 12 $sMonth = _DateToMonth($i, 0) $sString_PartOne = "(" & $iNum & ")" $sString_PartTwo = $sMonth $sString_PartThree = $sYear $sStringFinal = $sString_PartOne & " " & $sString_PartTwo & " " & $sString_PartThree ConsoleWrite($sStringFinal & @CRLF) $iNum += 1 If Mod($iCC, 12) = 0 Then $sYear += 1 Next $sYear += 1 Next Thanks! _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
litlmike Posted January 2, 2020 Author Share Posted January 2, 2020 49 minutes ago, mikell said: The same with one loop only #include <date.au3> $iNum = 1 $sYear = 2016 For $iCC = 1 To 100 $m = Mod($iCC, 12) $sMonth = _DateToMonth(($m = 0) ? 12 : $m, 0) $sString_PartOne = "(" & $iNum & ")" $sString_PartTwo = $sMonth $sString_PartThree = $sYear $sStringFinal = $sString_PartOne & " " & $sString_PartTwo & " " & $sString_PartThree ConsoleWrite($sStringFinal & @CRLF) $iNum += 1 If $m = 0 Then $sYear += 1 Next Thanks! _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Nine Posted January 2, 2020 Share Posted January 2, 2020 You do not need to quote the whole post from Mikell, he knows what he has suggested to you. But thanking him THREE times, I think it is truly excessive ! “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
litlmike Posted January 3, 2020 Author Share Posted January 3, 2020 Ha, thanks! Sorry for the double post, it was an accident and I couldn't figure out how to delete it. _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
mikell Posted January 4, 2020 Share Posted January 4, 2020 On 1/3/2020 at 12:06 AM, Nine said: But thanking him THREE times, I think it is truly excessive ! But so pleasant... and a nice compensation for all the times where I got nothing while spending hours to provide an incredibly clever answer 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