Sign in to follow this  
Followers 0
Aston1X

Navigating in a GUI Problem

4 posts in this topic

#1 ·  Posted (edited)

Well, I'm trying to get the browser in my GUI to navigate but I keep getting an error, here's my code as it is

#include <IE.au3> 
#include <GUIConstants.au3>
$hwnd = GUICreate ("Web Browser", 1100, 700)
GUISetFont(9, 400, -1, "comic sans")
GUISetState()
$B_oIE1 = ObjCreate("Shell.Explorer.2")
$Breaktime = GUICtrlCreateObj($B_oIE1, -1, -1, 1000, 700)
$BrkStart = GUICtrlCreateButton("&Start", 1010, 45, 80, 25)
$BrkPause = GUICtrlCreateButton ("&Pause", 1010, 80, 80, 25)
$BrkEnd = GUICtrlCreateButton("&Exit", 1010, 115, 80, 25)
$B_oIE1.navigate ("http://google.com")


HotKeySet("{ESC}", "Close")
HotKeySet("{F3}", "About")

; Still working on these...





While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $BrkEnd Then
        Exit
    EndIf
    
    If $msg = $BrkPause Then
        Sleep (10000)
    EndIf   
    
    If $msg = $BrkStart And IsObj($B_oIE1) Then
        SBsearch()
    $B_oIE3.navigate ("http://google.com")  
    _Func SBsearch()
    Endif 
    
    
WEnd


Func Close()
    $hwnd = GUICreate ("About", 300, 100)
    GUISetFont(9, 400, -1, "comic sans")
    GUISetState()
    $B_oIE1 = ObjCreate("Shell.Explorer.2")
    $Breaktime = GUICtrlCreateObj($B_oIE1, -1, -1, 300, 100)
    $BrkStart = GUICtrlCreateButton("&Yes", 50, 50, 80, 25)
    $BrkEnd = GUICtrlCreateButton ("&No", 150, 50, 80, 25)
    $html = ("about: <center> Are you sure you wish to exit?</center>")
    $B_oIE1.navigate ( $html)
    

    
EndFunc

    

Func SBsearch()


$Search = "HackForums"
$oForm = _IEFormGetObjByName($oIE, "search")        - I get an error about this line. Variable being used without declaration.
$oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, $Search)
_IEFormSubmit($oForm)
_IELoadWait($oNavigate)



EndFunc

Much help appreciated.

Edited by Aston1X

Share this post


Link to post
Share on other sites



so I put Dim $oIE in the func and it's sorted that out but now it's complaining about an error parsing func call for _func SBsearch()

If $msg = $BrkStart And IsObj($B_oIE1) Then         
SBsearch()     
      
_Func SBsearch()     

Endif

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

just delete _Func SBsearch(), as you have called SBsearch() before and i even dont know why you have added that line, as i cant even imagine what should do _Func something().

Edited by Makaule

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