Jump to content

Save as file type


Recommended Posts

One of my other projects that I need to automate is running certain reports for month end. These are crystal reports that need to be run via our software interface. After doing some easy navigation I will eventually get a popup window to chose the file type that I want to save it as and the file name I wish to give it.

the Window ID says this is a combo box but when I try to select a string from that combo box it will not work.

As I am still a noob to AutoIT can someone point me in a direction for working with this window?

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.

Link to comment
Share on other sites

No its not a crystal report window. The report is run inside my software's GUI. I have attached a screen shot of the window I am having trouble navigating though and the window info summery screen. Also, is it possible when saving the file to give it a file name of the current date?

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.

Link to comment
Share on other sites

this gets me 90% there.

The Default file type that this report will export as is .rpt. In "ComboBox2" is an option for .pdf. I can figure out a way to get pdf selected prior to saving.

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.

Link to comment
Share on other sites

Link to comment
Share on other sites

here is the code as it is so far. Everything works great except the file still saves a .rpt

WinActivate("CORRIDOR")

;navigates to my desired report(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]", "Report_" & @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")

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.

Link to comment
Share on other sites

I noticed that as I have been trying different combinations of commands and that has had no effect.

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.

Link to comment
Share on other sites

Here is my script as it stands right now. All is resolved minus this setting the file type issue.

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")

sleep(500)
WinActivate("CORRIDOR")
Send("!r")
Sleep(500)
Send("{UP 5}")
Sleep(500)
Send("{RIGHT}")
Sleep(500)
send("{UP}")
sleep(500)
send("{Enter}")
;wait for the date paramter field to apear
WinWaitActive("Invoice Register Report")
WinActivate("Invoice Register Report")
ControlClick("Invoice Register Report", "From:", 12103, "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("Invoice Register Report", "Print", 1983, "left")
WinWaitActive("Report Output SalesOrderInvoiceRegister.rpt")
WinActivate("Report Output SalesOrderInvoiceRegister.rpt")
send("{DOWN 2}")
sleep(500)
send("{ENTER}")
;saves the file
$hWnd = WinWait("Export Report", "")
ControlSetText($hWnd, "", "[CLASSNN:Edit1]", "TJC SO 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")

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.

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...