stafe Posted May 9, 2016 Posted May 9, 2016 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? Thanks Simon
JeremyNicoll Posted May 9, 2016 Posted May 9, 2016 (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 May 9, 2016 by JeremyNicoll correct typo
stafe Posted May 9, 2016 Author Posted May 9, 2016 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
Juvigy Posted May 10, 2016 Posted May 10, 2016 And what is the rest of the script ? What is not working ?
stafe Posted May 11, 2016 Author Posted May 11, 2016 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. Simon
JeremyNicoll Posted May 11, 2016 Posted May 11, 2016 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?
Juvigy Posted May 11, 2016 Posted May 11, 2016 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now