Sign in to follow this  
Followers 0
ijourneaux

Script as Scheduled Task dies partway though

5 posts in this topic

#1 ·  Posted (edited)

I am trying to run an complied AutoIt script as a scheduled task every morning at 6:30am. At that time, the PC is logged into as the administrator but the screen in locked to control access.

Although I have tested this script as many ways as I can, it only runs through to completion when I am testing and not when I want to run it at 6:30am.

Here are the three configurations I ahve tried so far

The first uses _GUICtrlToolbar_ClickIndex($hToolbar, 15)

Func SwitchTo3D()
    _FileWriteLog(@ScriptDir & $LogFileName, "In Switch to 3D")

    $hWnd = WinGetHandle("InfoStore Client")
    $hTreeView= ControlGetHandle("InfoStore Client", "", "[CLASS:TreeViewWndClass; INSTANCE:2]")
    $hToolbar= ControlGetHandle("InfoStore Client", "", "[CLASS:ToolbarWindow32; INSTANCE:1]")

    call("WaitForControl", "InfoStore Client", "",  "[CLASS:ToolbarWindow32; INSTANCE:1]", 20)
; Switch to 3D Historical

do 
    _GUICtrlToolbar_ClickIndex($hToolbar, 15)
    Sleep(40000)
until (ControlFocus("InfoStore Client", "",  "[CLASS:ThunderRT6ComboBox; INSTANCE:3]") = 1)

Endfunc

When this didn't work, I thought that this might have problems with the screen being locked so I tried using Controlclick

Func SwitchTo3D()
    _FileWriteLog(@ScriptDir & $LogFileName, "In Switch to 3D")

; Switch to 3D Historical

do 
    Controlclick("InfoStore Client", "",  "[CLASS:ToolbarWindow32; INSTANCE:1]", "", 1, 337,15)
    Sleep(40000)
until (ControlFocus("InfoStore Client", "",  "[CLASS:ThunderRT6ComboBox; INSTANCE:3]") = 1)
Endfunc

Although it worked in testing, that failed at 6:30am as well

There doesn't seem to be anything magical going on a 6:30am in the morning. At that point in time, the screen has been locked for 16hrs or so at that time. The virtual server has not been rebooted and it is not configured to go to sleep or hibernate.

Today I tried

Sleep(1000)
    WinMenuSelectItem("InfoStore Client", "", "&View", "&Graphs", "SENA Scrolling &3D")
    call("WaitForControl", "InfoStore Client", "",  "[CLASS:ThunderRT6ComboBox; INSTANCE:3]", 200)

I am not sure why this would work and the ControlClick I tried before didn't.

Edited by ijourneaux

Share this post


Link to post
Share on other sites



Sounds like an issue with the fact it is locked. I have similar problem with my TAS backup script.

Put this at the start of the script to replicate the machine at 6.30

Run(@SystemDir & "\rundll32.exe user32.dll,LockWorkStation")

I use a commandline program called logon.exe to unlock the PC before the script runs and then relock it with the above scriptlet.

Share this post


Link to post
Share on other sites

Sounds like an issue with the fact it is locked. I have similar problem with my TAS backup script.

Put this at the start of the script to replicate the machine at 6.30

Run(@SystemDir & "\rundll32.exe user32.dll,LockWorkStation")

I use a commandline program called logon.exe to unlock the PC before the script runs and then relock it with the above scriptlet.

Thanks apprecaite the comment.

Last night, I was able to confirm that

WinMenuSelectItem("InfoStore Client", "", "&View", "&Graphs", "SENA Scrolling &3D")

worked when the machine was locked but I have other places in the script where I might need to take advantage of your approach.

Take Care

Share this post


Link to post
Share on other sites

Sounds like an issue with the fact it is locked. I have similar problem with my TAS backup script.

Put this at the start of the script to replicate the machine at 6.30

Run(@SystemDir & "\rundll32.exe user32.dll,LockWorkStation")

I use a commandline program called logon.exe to unlock the PC before the script runs and then relock it with the above scriptlet.

Hello,

I want to unlock an Xp machine before executing an AutoIt application. The application uses Send and ContolClick commands. Please help me with syntax to call logon.exe and link to download logon.exe.

I have downloaded the logon utility from http://www.softtreetech.com/24x7/archive/51.htm and tried with the following syntax but failed.

run(@scriptdir&"\Logon.exe -p password")

Please help.

Share this post


Link to post
Share on other sites

Hi,

I have used a bat file to execute the logon.exe and it works fine on a scheduled time to unlock an Xp machine.

Regards,

Pooja.

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