Jump to content

Automatic printing of Crystal report while screen locked


georgec
 Share

Recommended Posts

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.

ShellExecute ("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

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