georgec Posted September 8, 2011 Share Posted September 8, 2011 I have some reports that I would like my PC to have already printed before I come in to work. I am on Windows 7 and CR 2008. I have the AutoIt job of mine built and set to kick off with Windows scheduler. Unfortunately, the report doesn't run while the screen is locked. I come in and unlock the screen and have to click on the printer icon in CR to make the script continue to run. I have seen the FAQ about this issue but, I am not understanding the proper syntax when I try and replace my Send() commands with the ControlSend() for instance. My sample code is below. I would appreciate any guidance on making this work without my interaction each morning. expandcollapse popupShellExecute ("c:\spool_stop.bat") Sleep(7000) ShellExecute ("c:\spool_start.bat") Sleep(7000) #region ---Au3Recorder generated code Start --- Opt("WinWaitDelay",100) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) ShellExecute ("\\iomega1\user files\scheduled_reports\crystalrpts\pdloans30.rpt") WinWait("Crystal Reports - [pdloans30.rpt]") Send("{CTRLDOWN}p{CTRLUP}") WinWait("Print Setup") Send("{ENTER}") WinWait("Crystal Reports - [pdloans30.rpt]") Sleep(6000) Send("{ALTDOWN}{F4}{ALTUP}") ShellExecute ("\\iomega1\user files\scheduled_reports\crystalrpts\pdloans30CL.rpt") WinWait("Crystal Reports - [pdloans30CL.rpt]") Send("{CTRLDOWN}p{CTRLUP}") WinWait("Print Setup") Send("{ENTER}") WinWait("Crystal Reports - [pdloans30CL.rpt]") Sleep(6000) Send("{ALTDOWN}{F4}{ALTUP}") ShellExecute ("\\iomega1\user files\scheduled_reports\crystalrpts\pdloans45CL.rpt") WinWait("Crystal Reports - [pdloans45CL.rpt]") Send("{CTRLDOWN}p{CTRLUP}") WinWait("Print Setup") Send("{ENTER}") WinWait("Crystal Reports - [pdloans45CL.rpt]") Sleep(6000) Send("{ALTDOWN}{F4}{ALTUP}") ShellExecute ("\\iomega1\user files\scheduled_reports\crystalrpts\pdloans30listing.rpt") WinWait("Crystal Reports - [pdloans30listing.rpt]") Send("{CTRLDOWN}p{CTRLUP}") WinWait("Print Setup") Send("{ENTER}") WinWait("Crystal Reports - [pdloans30listing.rpt]") Sleep(6000) Send("{ALTDOWN}{F4}{ALTUP}") ShellExecute ("\\iomega1\user files\scheduled_reports\crystalrpts\pdloans30CLlisting.rpt") WinWait("Crystal Reports - [pdloans30CLlisting.rpt]") Send("{CTRLDOWN}p{CTRLUP}") WinWait("Print Setup") Send("{ENTER}") WinWait("Crystal Reports - [pdloans30CLlisting.rpt]") Sleep(6000) Send("{ALTDOWN}{F4}{ALTUP}") ShellExecute ("\\iomega1\user files\scheduled_reports\crystalrpts\pdloans45CLlisting.rpt") WinWait("Crystal Reports - [pdloans45CLlisting.rpt]") Send("{CTRLDOWN}p{CTRLUP}") WinWait("Print Setup") Send("{ENTER}") WinWait("Crystal Reports - [pdloans45CLlisting.rpt]") Sleep(6000) Send("{ALTDOWN}{F4}{ALTUP}") #region --- Internal functions Au3Recorder Start --- Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc #endregion --- Internal functions Au3Recorder End --- #endregion --- Au3Recorder generated code End --- Link to comment Share on other sites More sharing options...
Zedna Posted September 8, 2011 Share Posted September 8, 2011 You must use Au3Info tool to check ClassNameNN of controls to which you want to send keystrokes by ControlSend() "C:\Program Files\AutoIt3\Au3Info.exe" Resources UDF ResourcesEx UDF AutoIt Forum Search 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