Jump to content

Cannot make browser window visible if create with _IECreate as invisible


Recommended Posts

Hi 

 

I'm trying to:

1) Open a hidden browser session

2) Do some stuff in the background

3)  Make the hidden window visible

 

This is my code:

 

Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
$oIE = _IECreate("https://www.google.co.uk/",0,0)
$oSearchBox = _IEGetObjById($oIE, "lst-ib")
$oSearchBox.innertext = "AutoIT"
$oForm = _IEFormGetObjByName($oIE,"f")
_IEFormSubmit($oForm)
WinSetState("Google","",@SW_SHOW)

 

It dosen't work :(

The last line does make the window visible but it is an empty greyed out box that disappears as soon as I click on it.

I have a sort of workaround that hides the browser window as soon as I have created it which works fine:

$oIE = _IECreate("https://www.google.co.uk/")
WinSetState("Google","",@SW_HIDE)
.
.
.

WinSetState("Google","",@SW_SHOW)

But this looks a bit pants as the newly created window flashes on then off of the screen.

Am I using the wrong method to make the browser window visible?

Thanks

 

 

Link to comment
Share on other sites

use $oIE.visible = True to make the browser visible.

#include <ie.au3>
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
$oIE = _IECreate("https://www.google.co.uk/",0,0)
$oSearchBox = _IEGetObjById($oIE, "lst-ib")
$oSearchBox.innertext = "AutoIT"
$oForm = _IEFormGetObjByName($oIE,"f")
_IEFormSubmit($oForm)
$oIE.visible = True ; <-- this will show the browser
; WinSetState("Google","",@SW_SHOW)

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

  • Moderators

@SteveStrop please pay attention to where you post in the future. The Examples forum very clearly states:

Quote

Do not post general support questions here, instead use the AutoIt Help and Support forums.

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

×
×
  • Create New...