Sign in to follow this  
Followers 0
Kardus

Wait until browser window loads, then make it close

7 posts in this topic

#1 ·  Posted (edited)

While 1
opt("TrayIconHide", 1) 
$url = "http://google.com"
Run("rundll32 url.dll, FileProtocolHandler " & $url)
Wend

As an example, I want Windows to open http://google.com, wait until the page finishes loading (in internet explorer), and then close it.

Also, it possible for these windows to open the the background (so I won't be seeing multiple windows open/close)? If so can anyone please tell me how to do it? Thanks.

Edited by Kardus

Share this post


Link to post
Share on other sites



i suggest taking alook at the COM functions.


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Using the beta and IE.au3, you can do the following:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")
_IEQuit($oIE)

IE.au3 uses COM

IE Automation UDF Library

Examples: Post 3 in the IE Automation thread

Dale

While 1
opt("TrayIconHide", 1) 
$url = "http://google.com"
Run("rundll32 url.dll, FileProtocolHandler " & $url)
Wend

As an example, I want Windows to open http://google.com, wait until the page finishes loading (in internet explorer), and then close it.

Also, it possible for these windows to open the the background (so I won't be seeing multiple windows open/close)? If so can anyone please tell me how to do it? Thanks.

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks a lot, that IE UDF is very useful. Now I got this:

#include <IE.au3>
While 1
$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")
_IELoadWait($oIE)
_IEQuit($oIE)
Wend

I want to make it open the IE windows in the background (so it won't appear on taskbar or it wont popup). So I added this:

#include <IE.au3>
While 1
$f_visible = 0
$oIE = _IECreate($f_visible)
_IENavigate($oIE, "http://www.google.com")
_IELoadWait($oIE)
_IEQuit($oIE)
Wend

That should make it carry out the same, but in the background, right?

Edited by Kardus

Share this post


Link to post
Share on other sites

Correct. You do not need the _IELoadWait however as that is called automatically by _IENavigate (although there is a flag to turn that off should you ever want async operation).

So long as you realize that your sample code will create and destroy an invisible browser window over and over again, indefinitely then it should do what you want.

Dale

I want to make it open the IE windows in the background (so it won't appear on taskbar or it wont popup). So I added this:

#include <IE.au3>
While 1
$f_visible = 0
$oIE = _IECreate($f_visible)
_IENavigate($oIE, "http://www.google.com")
_IELoadWait($oIE)
_IEQuit($oIE)
Wend

That should make it carry out the same, but in the background, right?


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Is there a way to open the ie window minimized (if i choose not to open them in background)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Is there a way to open the ie window minimized (if i choose not to open them in background)

Not directly -- that is a windows function, not a browser function. Here is an easy way to do it though:

#include <IE.au3>
$oIE = _IECreate()

$hHWnd = _IEGetProperty($oIE, "hwnd"); get handle

; This next line won't be needed in the next IE.au3 release
If Not IsHWND($hHWnd) Then $hHWnd = HWnd($hHWnd); convert to handle variant

WinSetState($hHWnd, "", @SW_MINIMIZE); minimize

I'll likely add hybrid functions like this to the next IE.au3 as new _IEAction() commands.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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