Sign in to follow this  
Followers 0
spikehartunian

Newbie needs help

12 posts in this topic

dear all,

I am just a few days old when it comes to scripting, so please be gentle with the techie speak! :-)

I absolutely love the program but need help with something. I have a script that I need to run overnight. Problem is my computer is locked and the script just goes into pause. I looked at other Forum entries regarding this but they seemed quite old so thought I would ask again in case there was some new information.

Essentially, is there either a way to force a script to run while a PC is locked or can you unlock a PC within the script, run and then lock the PC back up again? Unfortunately, the script does require some kind of user input in the middle, which I have added into the script.

Any help gratefully received.

Share this post


Link to post
Share on other sites



How is the computer locked? What happens when it is locked. Do you have to log in again?

Is there a program doing this?

Does the computer hibernate?

What is your OS?

Share this post


Link to post
Share on other sites

How is the computer locked? What happens when it is locked. Do you have to log in again?

Is there a program doing this?

Does the computer hibernate?

What is your OS?

the computer is locked by pressing ctrl-alt-del and then selecting lock this computer under Windows XP. It sits on a network domain so when you unlock it you type in your network username and password which is the same account you locked it under. The computer doesn't hibernate, it sits there locked.

Hope this answers your question.

Share this post


Link to post
Share on other sites

I don't have XP but from what I have seen it should let your script run as long as it does not need GUI interaction.

maybe you could try this little script in SciTe. Lock your computer, wait a few secs then log in back and analyze the output.

HotKeySet("{ESC}", "Terminate")
Local $count = 0
Local $start = TimerInit()
Do
    dbg(Round(TimerDiff($start),0))
    $count += 1
    sleep(1000)
Until $count = 1000
Func Terminate()
    Exit
EndFunc
Func dbg($msg, $line=@ScriptLineNumber, $err=@error, $ext=@extended)
    ConsoleWrite("(" & $line & ") := (" & $err & ")(" & $ext & ") : " & $msg & @CRLF)
EndFunc

Share this post


Link to post
Share on other sites

I don't have XP but from what I have seen it should let your script run as long as it does not need GUI interaction.

maybe you could try this little script in SciTe. Lock your computer, wait a few secs then log in back and analyze the output.

HotKeySet("{ESC}", "Terminate")
Local $count = 0
Local $start = TimerInit()
Do
    dbg(Round(TimerDiff($start),0))
    $count += 1
    sleep(1000)
Until $count = 1000
Func Terminate()
    Exit
EndFunc
Func dbg($msg, $line=@ScriptLineNumber, $err=@error, $ext=@extended)
    ConsoleWrite("(" & $line & ") := (" & $err & ")(" & $ext & ") : " & $msg & @CRLF)
EndFunc
Thanks, but unfortunately user GUI interaction is needed. My script logs onto another application, does some stuff, logs off and manipulates the data and emails it using outlook.

Share this post


Link to post
Share on other sites

And the other application is not halted?

Which other application? The one I am trying to use in the script? It doesn't get that far, as soon as the script starts it pauses and sits in my systray.

Share this post


Link to post
Share on other sites

OK, something else is on. Time for you to post some code I'm afraid!

What was the result when you tried the code I provided?

Share this post


Link to post
Share on other sites

OK, something else is on. Time for you to post some code I'm afraid!

What was the result when you tried the code I provided?

Can't try the code you posted until Tuesday as I need to be at work. Here is the code though, don't laugh, I did say I was new to this! :-) I've had to blank out passwords and emails.

;Launch MT

Run("C:\Program Files\MEDITECH\Workstation3.x\T.exe")

WinWaitActive("MEDITECH Remote Workstation")

Sleep(1000)

;Log in

Send("1{ENTER}")

Sleep(500)

Send("username{ENTER}")

Sleep(500)

Send("password{ENTER}")

Sleep(500)

;LAB NPR

Send("8{ENTER}")

Sleep(500)

Send("11{ENTER}")

Sleep(500)

Send("LAB.L.SPEC{ENTER}")

Sleep(500)

Send("andi.lab.outstanding{ENTER}")

Sleep(500)

Send("4{ENTER}")

Sleep(500)

Send("{ENTER}")

Sleep(500)

Send("T{ENTER}")

Sleep(500)

Send("T-28{ENTER}")

Sleep(500)

Send("ATDump{ENTER}")

Sleep(120000)

Send("{ENTER 3}")

;Copy ATDump

FileCopy("C:\ATDump.txt", "C:\LABCensus.txt", 1)

Sleep(10000)

;MIC NPR

Send("LAB.M.SPEC{ENTER}")

Sleep(500)

Send("andi.lab.outstanding{ENTER}")

Sleep(500)

Send("4{ENTER}")

Sleep(500)

Send("T{ENTER}")

Sleep(500)

Send("T-28{ENTER}")

Sleep(500)

Send("ATDump{ENTER}")

Sleep(120000)

Send("{ENTER 3}")

;Copy ATDump

FileCopy("C:\ATDump.txt", "C:\MICCensus.txt", 1)

Sleep(10000)

;PTH NPR

Send("LAB.P.SPEC{ENTER}")

Sleep(500)

Send("andi.lab.outstanding{ENTER}")

Sleep(500)

Send("4{ENTER}")

Sleep(500)

Send("T-28{ENTER}")

Sleep(500)

Send("ATDump{ENTER}")

Sleep(120000)

Send("{ENTER 8}")

;Copy ATDump

FileCopy("C:\ATDump.txt", "C:\PTHCensus.txt", 1)

Sleep(10000)

;Launch Outlook

Run("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE")

WinWaitActive("Inbox - Microsoft Outlook")

Sleep(3000)

;Create email

Send("^M")

Sleep(500)

Send("xxx@xxx.xxx;{ENTER}")

Sleep(1000)

Send("{TAB 3}")

Send("Lab Outstanding Test Census")

Send("{TAB}")

Send("A message for the body of the email")

;Attach files

Send("{ALTDOWN}")

Sleep(500)

Sleep(500)

Send("I")

Sleep(500)

Send("F")

Send("{ALTUP}")

Sleep(2000)

Send("C:\LABCensus.txt")

Sleep(500)

Send("{ENTER}")

Sleep(500)

Send("{ALTDOWN}")

Sleep(500)

Send("I")

Sleep(500)

Send("F")

Send("{ALTUP}")

Sleep(2000)

Send("C:\MICCensus.txt")

Sleep(500)

Send("{ENTER}")

Sleep(500)

Send("{ALTDOWN}")

Sleep(500)

Send("I")

Sleep(500)

Send("F")

Send("{ALTUP}")

Sleep(2000)

Send("C:\PTHCensus.txt")

Sleep(500)

Send("{ENTER}")

Sleep(500)

;Send email

Send("!S")

Sleep(2000)

;Quit outlook

Send("{ALTDOWN}")

Send("F")

Sleep(500)

Send("X")

Send("{ALTUP}")

; Finished!

Share this post


Link to post
Share on other sites

This window will never become active WinWaitActive("MEDITECH Remote Workstation").

Better rewrite your script to use ControlSend(..)

Share this post


Link to post
Share on other sites

This window will never become active WinWaitActive("MEDITECH Remote Workstation").

Better rewrite your script to use ControlSend(..)

So how does ControlSend work?

Share this post


Link to post
Share on other sites

:shocked: Your installation did not come with a help file? If it did not, reinstall..:(

You can find the controlID's with au3info.exe in the AutoIt folder.

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