Jump to content

Unable to run script remotely using task schedular


Recommended Posts

Dear All, Good Day

I have created an Autoit script which runs perfectly on local machine,but when i call the same script from a remote machine it failed (window in disable mode, every time when i click manually the screen the script will work). Even i tried mouseclick but failed, please advise. 


Note: My ultimate aim is to automate the task using a automation scheduler which installed on a separate system.

Please check my below script

Run("C:\Program Files (x86)\ITProgararm\prgm.exe")
WinWaitActive("Log into Database Server")

WinWaitActive("ITProgararm - Program Monitor","")
WinWaitActive("ITProgararm - Program Monitor - [Authorizers]","")
WinWaitActive("ITProgararm - Program Monitor - [Authorizer VASA Information]","")


Thanks in advance



Link to comment
Share on other sites

Hi Ganesh,

To clarify what you're saying so we're on the same page. Yes if your application relies on GUI elements, such as sending keys to a visible window (can be hidden as well) then it will not work when the session is entirely in the background. For example, an executable that relies on task manager to execute it when the user is no longer logged on will not work. 


There are several ways around this that I've found.

  1. Make the application not rely on GUI elements, programs usually have some sort of command line console that you can work with, websites and webforms have the invoke web request with powershell which AutoIT has a version of.
  2. Leave your session logged in. This may or may not work depending on your application, but leaving your profile logged in in the lock position will allow some GUI dependent executables to run without a problem. As for disconnecting, I have not had any success with it, although I am open to the possibility.
  3. Get a virtual machine involved.

Also, instead of simply using the send function. I would recommend that you use the ControlSend function. In fact I recommend trying this out first. This is a sample from a working IE script I am using:


Local $hWnd = _IEPropertyGet($oIE, "hwnd")
    _IEAction($oSubmit, "focus")
    ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")

ControlSend sends the keys directly to the control itself and doesn't rely on an application being in focus so that perhaps might help you in a combination of the above possibilities.

If you are intent on using control send, you could always use the AU3Info tool under Tools in SciTE to better scout out the controls.


Link to comment
Share on other sites

ControlClick, and ControlSetText...and keep this in mind:


If you are actually working on a desktop...then instead of waiting for a window to become active (winwaitactive), you can wait for it to exist, or loop until wingethandle returns a handle, and then winactivate it.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Thanks, it worked with ControlSend and ControlClick

Dear BananaFish and JDELANEY,

Have A Good Day

Thanks for your comments.

I have modified the script using ControlSend and ControlClick functionality instead Send and MouseClick respectively now things are workig as expected.

Happy Coding

Thanks & Regards


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

  • Create New...