task scheduler problems starting a program

7 posts in this topic

I have written and autoit script and it works perfectly. 

However I need it to run using windows task scheduler.  The first thing it does is open up a Microsoft access database. 

I use the shellExecute command to open the database
ie ShellExecute("\\myServer\Data\Documents\Reports.accdb")

However when I run the script from the windows task scheduler the access database does not open. The rest of the script runs fine.

How do I get this to work?


Share this post

Link to post
Share on other sites

#2 ·  Posted (edited)

Does the scheduled task run under your userid?

If - as an experiment - you try to run some other command via ShellExecute, does that work?

Can you tell, eg from the OS's event logs whether Access is starting and then failing to open

your database, or whether Access itself doesn't start?


Edited by JeremyNicoll
correct typo

Share this post

Link to post
Share on other sites

I have discovered that it will run if I select the option "Run only when the user is logged on" but it wont run if I select "run whether the user is logged on or off"

So I have take the first option, but things sill wont run properly.  It runs on a server and I log in via remote desktop.  If I keep the window open/active everything works fine.

But If I minimise the active window then the ShellExecute command still works (and loads access) but the rest of the script fails to run.  I am running out of ideas and any suggestions would be appreciated.

Thanks Simon

Share this post

Link to post
Share on other sites

And what is the rest of the script ? What is not working ?

Share this post

Link to post
Share on other sites

The rest of the script are a few sends.  The purpose of the script is to automatically generate a report.  The access database is hooked to a SQL server database and I need to enter the SQL server password to generate the report.  That is the idea of the send commands. 

What happens now is MS access opens but none of the send commands work.


Share this post

Link to post
Share on other sites

Can you capture a screenshot on this remote machine, or record anything in a log, that proves that the (GUI password-input field?) is actually present?

Share this post

Link to post
Share on other sites

There is an MSaccess UDF. Did you try with that? Usually SEND commands are lame and prone to errors. Try to change them to ControlSend and error checking. Also it very much depends on how you setup the task to run , with which account , etc.

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

  • Similar Content

    • nacerbaaziz
      By nacerbaaziz
      Hi dear
      I have a question
      about the display language of the system
      How can I get the current display language and how can I change it by autoit
      Of course, if this is possible
      Greetings to all and hope you help me
    • breakbadsp
      By breakbadsp
      AutoIT AU3info doeas not detect all gui objects uniquely for .NET GUIs developed in C#.
      this is not working now i am using COM windows approach for this, But its very difficult.
      Please let me know if anyone has done it before.
    • ur
      By ur
      With _WinWaitActivate we can wait for a window to process it.
      But is there any logic so that we can wait for this window title and based on the window text (like 2 or more patterns will be there) we can click yes or no on the window.
      Func _WinWaitActivate($title,$text,$timeout=0)
       If Not WinActive($title,$text) Then WinActivate($title,$text)
    • wtarkan
      By wtarkan
      If I create a service to run a program , Application window cannot Appear - How can I make the App window visible
    • ur
      By ur
      Whenever we try to access a network share it will prompt for credentials based on the shared folder settings.
      Like the below prompt

      Once you save them, they are saved in Windows Credentials of Credentials Manager in Control panel (run --> control keymgr.dll).

      But not able to found exact file or registry for this setting.
      So, can anyone suggest how to do this process of adding network credentials using AutoIT.