Sign in to follow this  
Followers 0
norax

Webbrowser Gui cookies

1 post in this topic

so im making a web browser script and im getting stuck at sites that require cookies enabled i cant figure out for the life of me how to do it

im using ie.au3 i saw something about explorer shell but im trying to read the html and display it on a browser screen so i can adjust things with the html

befor their displayed. heres the full script as it stands.

#include<ie.au3>
#include<windowsconstants.au3>
#include<guiconstants.au3>

HotKeySet("{F4}", "Debugger")


$Site = "http://www.google.com"
$PrevSite = ""
$ForSite = ""
$winhttpreq = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oIE = _IECreateEmbedded ()
GUICreate("Socket Read/IE Displayed", (@DesktopWidth / 2), (@DesktopHeight / 2), -1, -1, _
    BitOR($WS_OVERLAPPEDWINDOW, $WS_VISIBLE, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN, $WS_SIZEBOX, $WS_SYSMENU))
$GUIActiveX = GUICtrlCreateObj($oIE, 5, 40, (@DesktopWidth / 2) - 10, (@DesktopHeight / 2) - 45)
$Input1 = GUICtrlCreateInput("Http://", 165, 7, (@DesktopWidth / 2) - 225, 25)
$Button1 = GUICtrlCreateButton("<<-", 0, 7, 50, 25)
$Button2 = GUICtrlCreateButton("->>", 55, 7, 50, 25)
$Button3 = GUICtrlCreateButton("Refresh", 110, 7, 50, 25)
$Button4 = GUICtrlCreateButton("Go", (@DesktopWidth / 2) - 55, 7, 50, 25)



GUICtrlSetResizing($GUIActiveX, $GUI_DOCKAUTO)
GUICtrlSetResizing($Input1, $GUI_DOCKAUTO)
GUICtrlSetResizing($Button1, $GUI_DOCKAUTO)
GUICtrlSetResizing($Button2, $GUI_DOCKAUTO)
GUICtrlSetResizing($Button3, $GUI_DOCKAUTO)
GUICtrlSetResizing($Button4, $GUI_DOCKAUTO)
GUISetState()

_IEPropertySet($oIE, "addressbar", True)

GetPage($Site)

Func GetPage($Site = "")
    if StringInStr($site, "http://") Then
    Else
        $site = "http://" & $site
    EndIf
    $WinHttpReq.Open("GET", $Site, false)
    $WinHttpReq.Send()
    $sHTML = $WinHttpReq.ResponseText
    _IENavigate ($oIE, "about:blank")
    _IEDocWriteHTML ($oIE, $sHTML)
    _IEAction ($oIE, "refresh")
EndFunc

Func Debugger()
    MsgBox(0, "Debugger - HTML Source", $WinHttpReq.ResponseText)
EndFunc

While 1
    $msg = GUIGetMsg()
    Switch $Msg
        Case $Button1
            _IEAction($oIE, "back")
        Case $Button2
            _IEAction($oIE, "forward")
        Case $Button3
            _IEAction($oIE, "refresh")
        Case $Button4
            GetPage(GUICtrlRead($Input1))
            GUICtrlSetData($Input1, "")
        Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
WEnd

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