Sign in to follow this  
Followers 0
juergenriemer

Running autoit under different account on startup

17 posts in this topic

Hi,

The following issue: I have a software that was nicely running on Windows 2003; we changed to Windows 2008 and the program still works however when starting it pops up an alert telling some driver is missing which is important for the functioning. Stupid thing is that the program only start doing its job after I click away this alert box.

So, I wrote a little auto script to start the program and click away the alert:

Run( "C:Program Files (x86)pathtoprogram.exe /start" )
WinWait( "Error Message", "Failed to Initialize the Driver." )
ControlClick("Error Message", "OK", "Button1")
 
Works like a charm when I start it in my Windows session.
 
Now my problem: I want to run the program as soon as the machine is started, so I created a scheduled task to run on startup and put the SysAdmin account. If I run the task auto script will run the program.exe (I can see it in the taskmanager) but the  the alert is obviously not clicked away because the program doesn't do what it should do.
 
Now of course there is no GUI I suppose if the machine is started but how would you deal with this kind of problem
 
Thanks a lot
 

Share this post


Link to post
Share on other sites



I would address the driver problem myself.

Hi JohnOne, 

Well that would be the best solution of course, however I am not really in a position (not so smart) to do that :/

I was hoping that someone had a similar problem and solved it somehow.

Share this post


Link to post
Share on other sites

Well you could use Runas function, but it would need the username and password of whatever account you run it as, which is not recommended.

Perhaps if you give the exact error, someone might have had same issue and able to help.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

I am in the right context... I use a scheduled task with creds from an admin account. But I guess the alert window will not be rendered thus auto can't click it away.

As for the error message it says: ""Failed to Initialize the Adlib Express PDF Driver." it is an old version of Adlib Express Server that I run on a new OS and I don't want/can afford to upgrade to a newer version.

Share this post


Link to post
Share on other sites

I don't think such a script would need admin privileges.

I don't know much about system administration, but is there not a common folder or something where you can install a script to run on all user accounts?


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

The script is execute perfectly and it also spawns the process, but the alert is not clicked away.

Its a script that should run as soon as the machine is booted, this will happen unattended and without anyone logging in so I guess the alert window is not rendered at all.

Share this post


Link to post
Share on other sites

Hi John, sorry for the late reply.

To summarize: 

I have an auto script which opens the application executable and waits for an alert to appear to cick away.. if this happens everything works smoothly.

I create a scheduled task to run this auto script at startup of the machine.

I used the same account I tested the auto script.

If I run this scheduled task this popup never shows up, hence is not clicked away and hence the application does never get into working mode.

That is, it does not only not work when the machine is rebooted but also not if I am logged in to that machine with that account and right click the scheduled task and execute it manually.

It seems any UI output is swallowed in that case.

Share this post


Link to post
Share on other sites

I tried this and it only works if I login with that account; not on startup of the machine :/

BTW: thanks for your endurance :)

Share this post


Link to post
Share on other sites

Problem is as you mentioned, There is no error message displayed if nobody is logged in. Thus, Checking the error in the manner you're doing is pointless. Your whole script relies on the existence of a windows dialog being displayed. Perhaps there is a log being generated somewhere that you could read for such an error? Though you still wouldn't be able to bypass the error message.

Share this post


Link to post
Share on other sites

Thanks for rubber ducking :) I solved the problem by killing the process that triggered the error message.

Share this post


Link to post
Share on other sites

Seems you would want the task to trigger "At log on", and select Security options "Run whether user is logged on or not"


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.

Share this post


Link to post
Share on other sites

Seems you would want the task to trigger "At log on", and select Security options "Run whether user is logged on or not"

HI jdelaney,

The (still unresolved) issue is that I do not logon to the machine but rather simply start it so I (and obvioulsy autoit) don't "see" the alert box rendered in which case autoit would click it away.

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