Jump to content

RunAs and WinExists, no detection of active window


Recommended Posts

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

 

Link to comment
Share on other sites

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)

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...