Jump to content

Recommended Posts

Posted (edited)

Hi,

I'm writing a script that interacts with a webpage.
The contents of the webpage depend on the size of the browser window.
To get the (for me) correct contents from the page, the browser window must be maximized.

However, I also don't need or want to see the browser window when the script creates it, so it should be invisible.

At first I created the browser window with simply this: 

$oIE = _IECreate ($url ,0 ,0 ,1 ,0)

However, from the results I can see that the invisible browser window isn't maximized.

So I changed the code to maximize the window, but then it becomes visible.
Now I have this:

$oIE = _IECreate ($url ,0 ,0 ,1 ,0)
   $hIE = _IEPropertyGet($oIE, "hwnd")
   WinSetState($hIE, "", @SW_MAXIMIZE)
   WinSetState($hIE, "", @SW_HIDE)

...but then I do see the browser window shortly when it is maximized.

I could live with that if it were just a single browser window. But the script is opening (and closing) quite a few browser windows, and I don't wait to see them flicker, nor do I want to (be able to accidentally) interact with these windows.

Any ideas on how to create and invisible yet maximized IE windows?

Edited by Clouds
solved
Posted (edited)

Well sometimes simply explaining an issue gives new ideas and solutions, right? :D

I change my code to create just a single browser window, maximize and hide it, and then use that window all the time.
At first I was afraid (I was petrified) that my script would not be able to detect whether the page had already fully loaded, as most of the contents of the page are injected into the elements after IE and Autoit think the page has fully loaded. That's why I closed the browser window and created a new one every time.

But it turns out using a single browser object works good anyway.

Thanks for your attention!

Edited by Clouds

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
×
×
  • Create New...