Sign in to follow this  
Followers 0
miragee

Force IECreate to be on focus

13 posts in this topic

Im running an script on a webserver and when im connect via rdp it works fine but when i try to run it w/o being connected to the rdp it do not work.

The script do not bring the window to the front (it works on im connected)

Is there anyway to bring it to the front, even im not connected to the server ?

Share this post


Link to post
Share on other sites



The last argument in iecreate is to take focus. (by default). I assume its more then that for you, which I would then say get the browsers handle and then do a winactivate on it to bring it back into focus.

Share this post


Link to post
Share on other sites

Using the WinActivate() after the _IECreate() right ?

Share this post


Link to post
Share on other sites

Isnt working, any ideas ?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You need to run your script on a desktop.

If no one is logged in, it will run in the same environment that your services run in...session 0, which is the System User environment.

Other than that, "Isn't working" won't help anyone...get specific.  What's not working.  Are you error handling, are you logging?  How are you initializing the script?

Edited by jdelaney

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

So it's possible to force it to run as a specific user ?

Share this post


Link to post
Share on other sites

It runs well, but i can't seem to put the windows focus if no one is connected to the desktop

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Yep, because of this:

https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F

And yes, you can run the script as a specific user, but that won't address the link above...

Edited by jdelaney

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

So using an _IECreate(...) is no possible to focus the window if the user is not logged in ? or i can do it using the functions recommend on the link you gave to me ?

Share this post


Link to post
Share on other sites

There is no need to focus to use the _IE functions.


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

I need to use it because im uploading a file and can't use only the _IE function to do it (or atleast i didnt find a way to put it working, page uses an ajax upload so i need to submit it manually).

So when im connect ot the rdp it works fine and when i try to test that w/o being connect it do not work because the IE window isnt focused

Share this post


Link to post
Share on other sites

You can do all that behind the desktop.  Click the button to bring up the file explorer and interact with the file explorer window...keeping in mind the limitations of the link I posted.


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

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