Jump to content

Send calendar dates to notepad


Iurie
 Share

Recommended Posts

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 = 0
While $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] + 1
EndIf
If $iCount > 62 Then
$month[0] = $month[2]
$date[0] = $date[1]
EndIf
if $iCount > 90 Then
$month[0] = $month[3]
$date[0] = $date[1]
EndIf


And 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
*****
1FEB2016
2FEB2016
***** till
31DEC2016
and then I need so the year got changed to 2017 and send once again all the dates.
1JAN2017
2JAN2017 etc

Could someone help me with this loop in a loop in a loop problem?

 

Edited by Iurie
Link to comment
Share on other sites

?

#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

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...