Jump to content

GUI with webbrowser + 2 tabs


croell
 Share

Recommended Posts

hey guys.

I'm brand new to autoit. The "program" here it self is good but i need some more.

what i need is another "browser tab". I need to shift between the game and the forum.

How can i get another tab into this little script?

Actually i just want a little browser with 2 pages open i can shift between

LS 1.18.au3

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

$GUI = GUICreate("Ladder Slasher v.1.18",1350, 700)
$object = ObjCreate("Shell.Explorer.2")
$object_ctrl = GUICtrlCreateObj($object, 16, 10, 1382, 754)
_IENavigate($object, "http://ladderslasher.d2jsp.org/LS_118S.htm")


GUISetState()

While 1
    $msg = GUIGetMsg()
    Select      
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    EndSelect
WEnd
Link to comment
Share on other sites

hey guys.

I'm brand new to autoit. The "program" here it self is good but i need some more.

what i need is another "browser tab". I need to shift between the game and the forum.

How can i get another tab into this little script?

Actually i just want a little browser with 2 pages open i can shift between

Croell,

Instead of using tabs you can use buttons to navigate between specific webpages.

For example:

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

$mGUI = GUICreate("Ladder Slasher v.1.18",1000, 700)
$object = ObjCreate("Shell.Explorer.2")
$object_ctrl = GUICtrlCreateObj($object, 16, 35, 975, 650)

$Btn1 = GUICtrlCreateButton("Link 1", 5, 5)
$Btn2 = GUICtrlCreateButton("Link 2", 45, 5)

GUISetState()

_IENavigate($object, "http://ladderslasher.d2jsp.org/LS_118S.htm")

While 1
    $msg = GUIGetMsg()
    Switch $msg     
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Btn1
        _IENavigate($object, "http://ladderslasher.d2jsp.org/LS_118S.htm") ;Set webpage 1
    Case $Btn2
        _IENavigate($object, "http://google.com") ; Set webpage2
    EndSwitch
WEnd

jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

Croell,

Instead of using tabs you can use buttons to navigate between specific webpages.

For example:

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

$mGUI = GUICreate("Ladder Slasher v.1.18",1000, 700)
$object = ObjCreate("Shell.Explorer.2")
$object_ctrl = GUICtrlCreateObj($object, 16, 35, 975, 650)

$Btn1 = GUICtrlCreateButton("Link 1", 5, 5)
$Btn2 = GUICtrlCreateButton("Link 2", 45, 5)

GUISetState()

_IENavigate($object, "http://ladderslasher.d2jsp.org/LS_118S.htm")

While 1
    $msg = GUIGetMsg()
    Switch $msg     
    Case $GUI_EVENT_CLOSE
        Exit
    Case $Btn1
        _IENavigate($object, "http://ladderslasher.d2jsp.org/LS_118S.htm") ;Set webpage 1
    Case $Btn2
        _IENavigate($object, "http://google.com") ; Set webpage2
    EndSwitch
WEnd

jfcby

No i need tabs.. Because when i navigate to another site it will log me out automatic...I rly don't wanna write my password like 100 times in an hour:p so i need to have like to windows in one :D

EDIT:

How can i maximize my window and browser so it will fit on others computer?

Edited by croell
Link to comment
Share on other sites

No i need tabs.. Because when i navigate to another site it will log me out automatic...I rly don't wanna write my password like 100 times in an hour:p so i need to have like to windows in one :D

EDIT:

How can i maximize my window and browser so it will fit on others computer?

croell,

Below is one way to do it. Change the widths and heights to get the sizes you want. This is the link where I found an example of how to do it: Scrolling Tabs

; Including UDF's to declare variables and functions for commands
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>
#include <TabConstants.au3>
#include <StaticConstants.au3>
#include <IE.au3>

Global $GUIMsg, $hGUI, $h_cGUI, $h_cGUI2, $m, $hTAB, $TabSheet1, $TabSheet2, $TabSheet3
Opt("Mustdeclarevars", 1);Must declare variables, true
Global $nMsg
; A function to be defined later in script. I assume "()" is for other parameters?
_Main()

;Writing the function "_Main()" And declaring what actions to take when you call "_Main()" As in the previous line
Func _Main()
;Declaring variables 'Local' to the defined function as oppossed to 'Global' for the entire script-no these are used outside the function and so must be Global

; Variable = Function("Title", Width, Height, Left[centered], Top[centered], Don't Quite Understand "BitOr" I assume it means default OR(Has minimize box, Has Caption, Is a popup window, Has system menu on title bar)
$hGUI = GUICreate("Example Attempt", 1000, 700, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_OVERLAPPEDWINDOW))
; Variable = Function(Centered left, Centered top, Width, Height)
$hTAB = GUICtrlCreateTab(-1, -1, 1000, 700)
; Function (Default of Set Height&Width, Dock width & Height) Make window unable to be resized
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!!!!! THIS IS WHERE EVERYTHING USUALLY GOES HAYWIRE !!!!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1"); Create a TabItem with the title 'TabSheet1'
;

$TabSheet2 = GUICtrlCreateTabItem("TabSheet2"); Create Tab 2
$TabSheet3 = GUICtrlCreateTabItem("TabSheet3"); And 3
GUICtrlCreateTabItem(""); Close out Create Tab
$h_cGUI = GUICreate("Child GUI", 900, 625, -1, -1, $WS_POPUP, -1, $hGUI); Create A Child Inside Of a Child
;
; Now I will attempt to make 20 combo boxes inside this child

    Global $google_oIE = _IECreateEmbedded()
    Global $google_ie = GUICtrlCreateObj($google_oIE, 5, 10, 800, 600)  
    _IENavigate ($google_oIE, "http://www.google.com/", 0)

;~ GUISwitch($hGUI)
;~ ;GUISwitch($hGUI, $TabSheet1);Switches to Tab1 on the parent window


;#####################################################################

$h_cGUI2 = GUICreate("Child GUI", 200, 200, -1, -1, BitAND($WS_BORDER, $WS_CHILD), -1, $hGUI); Create A Child Inside Of a Child
;

    Global $yahoo_oIE = _IECreateEmbedded()
    Global $yahoo_ie = GUICtrlCreateObj($yahoo_oIE, 5, 5, 500, 300) 
    _IENavigate ($yahoo_oIE, "http://www.yahoo.com", 0)
    
GUISwitch($hGUI)
;GUISwitch($hGUI, $TabSheet1);Switches to Tab1 on the parent window

;#####################################################################

GUIRegisterMsg($WM_SIZE, "WM_SIZE"); Registers $WM_Size as a UDF

;   GUISetState(); I don't understand why "()" is empty
; GUISetState(@SW_SHOW,$h_cGUI)

GUISetState(@SW_SHOW); Show the window in its specified state
GUISetState(@SW_SHOW, $h_cGUI)
GUISetState(@SW_SHOW, $h_cGUI2)
EndFunc; Close out Function _Main()

; Create an infinite loop (1=true) Close app when the exit button is pressed
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hTAB
            Switch GUICtrlRead($hTAB)
                Case 0

                    GUISetState(@SW_SHOW, $h_cGUI)
                    GUISetState(@SW_HIDE, $h_cGUI2)
                Case 1
                    GUISetState(@SW_HIDE, $h_cGUI)
                    GUISetState(@SW_SHOW, $h_cGUI2)
                Case 2
                    GUISetState(@SW_HIDE, $h_cGUI)
                    GUISetState(@SW_HIDE, $h_cGUI2)
            EndSwitch
    EndSwitch
WEnd

;;;;;;;;;;;;;;;Have not edited anything below this line.
Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xClientMax = $aSB_WindowInfo[$index][1]
            $xChar = $aSB_WindowInfo[$index][2]
            $yChar = $aSB_WindowInfo[$index][3]
            $ivMax = $aSB_WindowInfo[$index][7]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_SIZE

Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

    Local $index = -1, $xChar, $xPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $xChar = $aSB_WindowInfo[$index][2]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0

;~; Get all the horizontal scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
    $xPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $xPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
    #forceref $Min, $Max
    Switch $nScrollCode

        Case $SB_LINELEFT; user clicked left arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINERIGHT; user clicked right arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGELEFT; user clicked the scroll bar shaft left of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGERIGHT; user clicked the scroll bar shaft right of the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

;~  // Set the position and then retrieve it.  Due to adjustments
;~  //   by Windows it may not be the same as the value set.

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")
    If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_HSCROLL

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    For $x = 0 To UBound($aSB_WindowInfo) - 1
        If $aSB_WindowInfo[$x][0] = $hWnd Then
            $index = $x
            $yChar = $aSB_WindowInfo[$index][3]
            ExitLoop
        EndIf
    Next
    If $index = -1 Then Return 0


; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    Switch $nScrollCode
        Case $SB_TOP; user clicked the HOME keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Min)

        Case $SB_BOTTOM; user clicked the END keyboard key
            DllStructSetData($tSCROLLINFO, "nPos", $Max)

        Case $SB_LINEUP; user clicked the top arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

        Case $SB_LINEDOWN; user clicked the bottom arrow
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

        Case $SB_PAGEUP; user clicked the scroll bar shaft above the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

        Case $SB_PAGEDOWN; user clicked the scroll bar shaft below the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

        Case $SB_THUMBTRACK; user dragged the scroll box
            DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
    EndSwitch

;~  // Set the position and then retrieve it.  Due to adjustments
;~  //   by Windows it may not be the same as the value set.

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    If ($Pos <> $yPos) Then
        _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
        $yPos = $Pos
    EndIf

    Return $GUI_RUNDEFMSG

EndFunc  ;==>WM_VSCROLL

jfcby

Edited by jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

hey guys.

I'm brand new to autoit. The "program" here it self is good but i need some more.

what i need is another "browser tab". I need to shift between the game and the forum.

How can i get another tab into this little script?

Actually i just want a little browser with 2 pages open i can shift between

LS 1.18.au3

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

$GUI = GUICreate("Ladder Slasher v.1.18",1350, 700)
$object = ObjCreate("Shell.Explorer.2")
$object_ctrl = GUICtrlCreateObj($object, 16, 10, 1382, 754)
_IENavigate($object, "http://ladderslasher.d2jsp.org/LS_118S.htm")


GUISetState()

While 1
    $msg = GUIGetMsg()
    Select      
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    EndSelect
WEnd

Croell,

The link below may work for what you want to accomplish.

Tab Browser by: realkiller

jfcby

[Edit] correct mispell word

Edited by jfcby

Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Link to comment
Share on other sites

  • 1 year later...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...