Sign in to follow this  
Followers 0
sriKnight

Resolved - Setting a date range paramater

10 posts in this topic

#1 ·  Posted (edited)

In my on going trial and error of writing a script that will automatically run some end of the month reports for me I have run into another issue.

For two reports that I have to run I must select a date range of records that want to view. For example at the end of May when I run the report I will need the Range to be 5/1/2012 - 5/31/2012. Next month will be 6/1/2012 - 6/30/2012.

Before a date can be entered the check boxes must be marked.

Is there a for me to tell AutoIT, "Hey, Look up what calender month we are in and check these two boxes and enter the first day of that month and the last day of that month?"

I have added a screen shot of the window I am working with and a summary of the information.

post-71959-0-83054500-1336155019_thumb.p

Edited by sriKnight

No, I'm not a programer.Yes, I am a noob.You know what the difference is between you and me?I make this look good.

Share this post


Link to post
Share on other sites



Check out the Time and Date Macros section of the helpfile. This should give you what you want.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Make your own function to perform that check =D.

$iStart = 01
Switch @MON
    Case 01, 03, 05, 07, 08, 10, 12
      $iEnd = 31
    Case 02
      If IsInt(@YEAR / 4) Then
         $iEnd = 29
      Else
         $iEnd = 28
      EndIf
    Case 04, 06, 09, 11
      $iEnd = 30
EndSwitch
Edited by mechaflash213

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok, So that will function will do the math, how do I turn that into two seperate dates then input one instance at a time? I order to navigate around some of the windows in my software I have to use a lot of

send("{DOWN}")

send("{SPACE}")

send("{RIGHT}")

send("<Current Month>"

send("{RIGHT}")

Send("<First day of current Month>")

How can I tie all of this together?

Edited by sriKnight

No, I'm not a programer.Yes, I am a noob.You know what the difference is between you and me?I make this look good.

Share this post


Link to post
Share on other sites

The calculation for february is not 100% correct. But it doesn't matter for the next 88 years ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

There is plenty you can do with these macros and math (try out @Mon - 4 for example). However, it is a little difficult to give you application for your specific needs without seeing the code (hint hint) ;)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Jlogan,

idk why but you last post just flipped the swithc to the logic center of my brain which i turned off for friday. I have one last portion of this script to complete and that is to get the file to save as a pdf.

WinActivate("CORRIDOR")

;;navigates to first report (WIP)(I know its not very clean, but the software is a pain!!)
Send("{ALT}r")
Sleep(500)
Send("{UP 2}")
Sleep(500)
Send("{RIGHT}")
Sleep(500)
Send("{UP}")
Sleep(500)
Send("{ENTER}")
WinWaitActive("Work Order WIP Report")
ControlClick("Work Order WIP Report", "Print", 3523, "left")
WinWaitActive("Report Output WorkInProcess.rpt")
WinActivate("Report Output WorkInProcess.rpt")
;kicks off an export from the GUI
Send("{DOWN 2}")
Sleep(500)
Send("{ENTER}")
WinWaitActive("Export Report")
WinActivate("Export Report")
;saves the file
$hWnd = WinWait("Export Report", "")
ControlSetText($hWnd, "", "[CLASSNN:Edit1]", "TJCWIP" & @YEAR & "-" & @MON & "-" & @MDAY)
;for these three lines I am able to see the dropdown show and then hide, but it still will not select pdf as a file type.
ControlCommand($hWnd, "", "[CLASSNN:ComboBox2]", "ShowDropDown", "")
ControlCommand($hWnd, "", "[CLASSNN:ComboBox2]", "SelectString", 'PDF (.pdf)')
ControlCommand($hWnd, "", "[CLASSNN:ComboBox2]", "HideDropDown", "")
ControlClick($hWnd,"","[CLASSNN:Button1]")
WinActivate("Export Report", "Export completed.")
WinWaitActive("Export Report")
ControlClick("Export Report", "OK", 2, "left")

WinActivate("CORRIDOR")
;Navigate to next report to be run from the schema (WO Invoice Register)
Send("{ALT}r")
Sleep(500)
Send("{UP 2}")
Sleep(500)
Send("{RIGHT}")
Sleep(500)
send("{DOWN 9}")
sleep(500)
send("{Enter}")
;wait for the date paramter field to apear
WinWaitActive("Work Order Invoice Register Report")
WinActivate("Work Order Invoice Register Report")
ControlClick("Work Order Invoice Register Report", "From:", 13308, "left")
;sets the first date paramter to the first day of the month
send("{Space}")
sleep(500)
send("{RIGHT}")
sleep(500)
send(@Mon)
sleep(500)
send("{RIGHT}")
sleep(500)
send("01")
sleep(500)
;sets the second date paramter to the currect date that the reprots are being run.
send("{TAB}")
sleep(500)
send("{Space}")
sleep(500)
send("{RIGHT}")
sleep(500)
send(@Mon)
sleep(500)
send("{RIGHT}")
sleep(500)
send(@Mday)
sleep(500)
sleep(500)
send("{TAB}")
;kicks off the export to file
ControlClick("Work Order Invoice Register Report", "Print", 3523, "left")
WinWaitActive("Report Output WorkOrderInvoiceRegister.rpt")
WinActivate("Report Output WorkOrderInvoiceRegister.rpt")
send("{DOWN 2}")
sleep(500)
send("{ENTER}")
saves the file
$hWnd = WinWait("Export Report", "")
ControlSetText($hWnd, "", "[CLASSNN:Edit1]", "TJC WO Invoice REG_" & @YEAR & "-" & @MON & "-" & @MDAY)
;for these three lines I am able to see the dropdown show and then hide, but it still will not select pdf as a file type.
ControlCommand($hWnd, "", "[CLASSNN:ComboBox2]", "ShowDropDown", "")
ControlCommand($hWnd, "", "[CLASSNN:ComboBox2]", "SelectString", 'PDF (.pdf)')
ControlCommand($hWnd, "", "[CLASSNN:ComboBox2]", "HideDropDown", "")
ControlClick($hWnd,"","[CLASSNN:Button1]")
WinActivate("Export Report", "Export completed.")
WinWaitActive("Export Report")
ControlClick("Export Report", "OK", 2, "left")

you can see in the comments just where I am having trouble with the file type.


No, I'm not a programer.Yes, I am a noob.You know what the difference is between you and me?I make this look good.

Share this post


Link to post
Share on other sites

Is that the same issue you are discussing in If so, I would stick to one thread per issue so we don't get confused. If your OP in this thread is resolved, I would mark it as so.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Yes it and I will.

How do I mark a topic as resolved?


No, I'm not a programer.Yes, I am a noob.You know what the difference is between you and me?I make this look good.

Share this post


Link to post
Share on other sites

#10 ·  Posted

Edit the first post of the thread, click on "use full editor" and you can change the title of the thread.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0