Sign in to follow this  
Followers 0
DarkAngelBGE

Wait for the navigation to complete in $oIE = ObjCreate("Shell.Explorer.2")

3 posts in this topic

#1 ·  Posted (edited)

Hi there I have a small script to embed a webbrowser. Now when I navigate to a new site, i want to Shell.Explorer object to wait for the navigation to complete. How can this be done?

#include <GUIConstants.au3>
$websiteWidth = 1200
$websiteHeight = 900

$oIE = ObjCreate("Shell.Explorer.2")
; Create a simple GUI for our output
;GUICreate ( $windowTitle, @DesktopWidth-100, @DesktopHeight-100,10, 10 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
GUICreate ( "test", @DesktopWidth-200, @DesktopHeight-200,10, 10 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX       = GUICtrlCreateObj       ( $oIE,       10, 40 , $websiteWidth+20 , $websiteHeight)
$GUI_Button_Back     = GuiCtrlCreateButton  ("Back",     10, @Desktopheight-150, 100,  30)
$GUI_Button_Forward  = GuiCtrlCreateButton  ("Forward", 120, @Desktopheight-150, 100,  30)
$GUI_Button_Home     = GuiCtrlCreateButton  ("Home",    230, @Desktopheight-150, 100,  30)
$GUI_Button_Stop     = GuiCtrlCreateButton  ("Stop",    330, @Desktopheight-150, 100,  30)
$GUI_Button_Navigate = GuiCtrlCreateButton  ("Go",  1080, @Desktopheight-150, 150,  30)
$GUI_Input            = GUICtrlCreateInput    ("",830, @Desktopheight-150, 250,  30)
GUISetState ()  ;Show GUI

$oIE.navigate("http://example.org")
    
while $oIE.Busy == true
    sleep(1000)
wend;

The Busy property does not seem to work and I could not find anything useful here: http://msdn2.microsoft.com/en-us/library/aa752093.aspx

Anybody? Thanks for any help. :rolleyes:

Edited by DarkAngelBGE

Share this post


Link to post
Share on other sites



It was the == that you were using that caused the problem.

#include <GUIConstants.au3>
$websiteWidth = 1200
$websiteHeight = 900

$oIE = ObjCreate("Shell.Explorer.2")
; Create a simple GUI for our output
;GUICreate ( $windowTitle, @DesktopWidth-100, @DesktopHeight-100,10, 10 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
GUICreate ( "test", @DesktopWidth-200, @DesktopHeight-200,10, 10 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX          = GUICtrlCreateObj       ( $oIE,         10, 40 , $websiteWidth+20 , $websiteHeight)
$GUI_Button_Back     = GuiCtrlCreateButton    ("Back",     10, @Desktopheight-150, 100,  30)
$GUI_Button_Forward  = GuiCtrlCreateButton    ("Forward",    120, @Desktopheight-150, 100,  30)
$GUI_Button_Home     = GuiCtrlCreateButton    ("Home",    230, @Desktopheight-150, 100,  30)
$GUI_Button_Stop     = GuiCtrlCreateButton    ("Stop",    330, @Desktopheight-150, 100,  30)
$GUI_Button_Navigate = GuiCtrlCreateButton    ("Go",    1080, @Desktopheight-150, 150,  30)
$GUI_Input              = GUICtrlCreateInput      ("",830, @Desktopheight-150, 250,  30)
GUISetState ()    ;Show GUI

$oIE.navigate("http://www.asdf.com")
    
while $oIE.Busy = true; single equal sign here
    sleep(1000)
wend;

Msgbox(0,"Done","The page is done loading.")

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Why not like this?

#include <IE.au3>
#include <GUIConstants.au3>

$websiteWidth = 1200
$websiteHeight = 900

_IEErrorHandlerRegister()
$oIE = _IECreateEmbedded()

GUICreate("test", @DesktopWidth - 200, @DesktopHeight - 200, 10, 10, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, $websiteWidth + 20, $websiteHeight)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, @DesktopHeight - 150, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, @DesktopHeight - 150, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, @DesktopHeight - 150, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 330, @DesktopHeight - 150, 100, 30)
$GUI_Button_Navigate = GUICtrlCreateButton("Go", 1080, @DesktopHeight - 150, 150, 30)
$GUI_Input = GUICtrlCreateInput("", 830, @DesktopHeight - 150, 250, 30)
GUISetState()    ;Show GUI

_IENavigate($oIE, "http://example.org")

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    Sleep(10)
WEnd
Edited by big_daddy

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