Iurie Posted November 3, 2015 Posted November 3, 2015 (edited) Hi Everyone, I just started to learn AutoIt and cant figure it out how I could make loops in a loop.I need to send to notepad strings with dates and other variables that are changing based on some rule.Example Send($date[0] & $month[0] & "$variable"& "{ENTER}")I tried to define arrays like this:Global $month[12] = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]Global $date[31] = [1, 2, 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]Global $type[3] = [2016, 2017, 2018]Local $iCount = 0While $iCount < 100 ; Increase the count by one $iCount = $iCount + 1 _WinWaitActivate("filedate","")_WinWaitActivate("","")Send($date[0] & $month[0] & "$type[0]"& "{ENTER}") $date[0] = $date[0] + 1;If $iCount > 31 Then$month[0] = $month[1]$date[0] = $date[0] + 1EndIfIf $iCount > 62 Then$month[0] = $month[2]$date[0] = $date[1]EndIfif $iCount > 90 Then$month[0] = $month[3]$date[0] = $date[1]EndIfAnd I cant figure it our how could I fix thix working properly so I could send all dates to notepad, and this is only the dates...I also need to change a variable after I finish to send all dates for first type, and start once over again.1JAN2016 2JAN2016*****1FEB20162FEB2016***** till31DEC2016and then I need so the year got changed to 2017 and send once again all the dates.1JAN20172JAN2017 etcCould someone help me with this loop in a loop in a loop problem? Edited November 3, 2015 by Iurie
Gianni Posted November 3, 2015 Posted November 3, 2015 ?#include <date.au3> Run("notepad.exe") $hNotepad = WinWaitActive("[CLASS:Notepad]", "") For $iYear = 2016 To 2018 For $iMonth = 1 To 12 For $iDay = 1 To 31 If _DateIsValid($iYear & "/" & $iMonth & "/" & $iDay) Then ; $sDate = StringFormat("%02s", $iDay) & " " & _DateToMonth($iMonth) & " " & $iYear & _ " (" & _DateDayOfWeek(_DateToDayOfWeek($iYear, $iMonth, $iDay)) & ")" & @CR ControlSend($hNotepad, "", "Edit1", $sDate) ; EndIf Next Next Next Iurie 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
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