Jump to content
Sign in to follow this  
xinfinity

Script will not complete if computer is locked?

Recommended Posts

xinfinity

I have searched the forums, but cannot seem to find the answer. If the answer is located somewhere, please point me to the appropiate forum/post.

I am trying to run the following code as a scheduled task when my pc is locked. I am running XP Pro on a 2k network. The script is flawless when my pc is unlocked. The script will open Crystal Reports, but will not proceed when locked? Any suggestions would be greatly appreciated.

Thanks in advance,

x∞

My Code:

CODE
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.10.0

Created: 1.9.2008

Last Modified: 1.9.2008

Script Function:

Open the 1stlnres.rpt enter the current date range between eight hour period, connect to the DB, and save the results with the report.

#ce ----------------------------------------------------------------------------

; Script Start

Run("C:\Program Files\Crystal Decisions\Crystal Reports 10\crw32.exe") ;execute crystal reports 10

Sleep(10000) ;Pause 10 seconds for cryatal to load

Send("!fo") ;send alt-f-o to open the report

Send("C:\Crystal\1stlnres.rpt{Enter}") ;enters the location of the report sends enter command

WinWaitActive("Crystal Reports - [1stlnres.rpt]") ;wait for report to open

Send("!fv") ;send "alt-f-v" to preview the report

WinWaitActive("Enter Parameter Values") ;wait for date range parameters window

Sleep(2000) ;pause 2 seconds for parameters window to open

Send("@MDAY/@MON/@YEAR{Tab}8:00:00 AM{Tab}") ;sends the current date at 8:00 AM

Send("@MDAY/@MON/@YEAR{Tab 3}5:00:00 PM{Enter}") ;sends the current date at 5:00 PM

WinWaitActive("OLE DB (ADO)") ;wait for database connection screen

Send("+{Tab}sqlusr{Tab}passwd") ;tabs up to the DB username field then tabs to the DB password field

Send("{Tab 5}{Enter 1}") ;tabs 5 times to the finish button and enters

Sleep(10000) ;pause 10 seconds allows connection to the database to load

WinWaitActive("Crystal Reports - [1stlnres.rpt]") ;wait for report screen to load

Send("!fw") ;sends alt-f-w to save data with report

Sleep(2000) ;pause 2 seconds for menu to close otherwise will pause script

Send("!fa") ;sends alt-f-a to save as...

WinWaitActive("Save As") ;wait for save as... screen to open

; Send("\\serverprod\CrystalReports\1stlnres.rpt{Enter}") ;sends the location of the file and file name to be saved as

Send("\\servertest\1stlnres.rpt{Enter}") ;sends the test location of the file and file name to be saved as

Sleep(2000) ;pause 2 seconds otherwise script will pause

send("{Enter}")

Sleep(2000) ;pause 2 seconds otherwise script will pause

WinWaitActive("Save As") ;wait for save as screen asking to replace the document

Send("{Tab}{Enter}") ;sends tab and enter to confirm yes to repalce the document

WinActivate("Crystal Reports - [1stlnres.rpt]") ;makes the report screen active

winclose("Crystal Reports - [1stlnres.rpt]") ;close crystal reports window

;Script End

Edited by xinfinity

Share this post


Link to post
Share on other sites
NewBe

most likely impossible in my opinion unless you inject some code in to explorer.exe :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.