Sign in to follow this  
Followers 0
IT_9600

RunAs and WinExists, no detection of active window

4 posts in this topic

Hello,

I have a little script which I want to run as a non-admin user. When the exe starts I want to wait for the window to open and make a change of a combobox and a click.
I run the Program.exe inside the script as domain-admin.
The problem is that the script only run when I execute the complete script as domain-admin, when I start it as a non-admin-user it opens the Program.exe and stop.
What can be the problem that the WinExists-command is not working? Do I need any parameters when I use RunAs?

Here's the script:

RunAs("admin","domain","password",0,"c:\temp\Program.exe")
While 1
    If WinExists("program_name","Language") Then
        ControlCommand("program_name","","ComboBox1","SelectString",'Language')
        ControlClick("program_name", "Continue","Button14")
        ...
    Else
        sleep(200)
    EndIf
WEnd

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I think you should add 

RunAs("admin","domain","password",0,"c:\temp\Program.exe",@SystemDir,@SW_SHOW)

because in runas usually runs the program hidden you should specify that you have to show the window then i think that winexist will work check the help of winexists in help of autoit you will see that winexists wont show true on hidden windows and check runas help file then you would see that runas 7th parameter is defaultly @SW_HIDE so you have to set it to @SW_SHOW

Edited by Surya

No matter whatever the challenge maybe control on the outcome its on you its always have been.

MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition)

Share this post


Link to post
Share on other sites

no, it doesn't work with the new parameters.
Any other ideas?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I found a solution on Zero Budget IT Admin

If the script doesn't run as admin I simply restart it as admin :-)

Thanks for help!

Edited by IT_9600

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