Sign in to follow this  
Followers 0
Alek

Yet another web browser

15 posts in this topic

#1 ·  Posted (edited)

hehe, another one :)

Bugs:

-it crashs if the page you are trying to open is to big.

#NoTrayIcon
#region Includes
#include <GUIConstants.au3>
#include <IE.au3>
#include <Inet.au3>
#include <String.au3>
#endregion
Global $Menuitem[100]
$Browser = _IECreateEmbedded()
_IEErrorHandlerRegister()
$Width = 800
$Hight = 600

$Gui = GUICreate("Alek's Web Browser",800,600,-1,-1,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Menu1 = GUICtrlCreateMenu("Stuff")
$Menuitem[1] = GUICtrlCreateMenuItem("View Source",$Menu1)
$Menuitem[2] = GUICtrlCreateMenuItem("Home page",$Menu1)

$Menu2 = GUICtrlCreateMenu("Favorites")
$Menuitem[3] = GUICtrlCreateMenuItem("Add Favorite",$Menu2)
GUICtrlCreateMenuItem("",$Menu2)
$Favorite = IniReadSection(@ScriptDir & "\Config.ini","Favorites")
if not @error then 
    for $x = 1 to $Favorite[0][0]
        $Menuitem[$x+3] = GUICtrlCreateMenuItem($Favorite[$x][0],$Menu2)
    Next
EndIf
$Button1 = GUICtrlCreateButton("",10,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,3)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button2 = GUICtrlCreateButton("",46,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,4)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button3 = GUICtrlCreateButton("",82,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,5)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button4 = GUICtrlCreateButton("",118,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,6)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button5 = GUICtrlCreateButton("",154,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,7)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Input1 = GUICtrlCreateInput(IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"),198,10,582,34)
GUICtrlSetFont(-1,20,400)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Obj = GUICtrlCreateObj($Browser,10,54,780,536)

GUICtrlSetState($Button2,$GUI_FOCUS)
$gui2 = GUICreate("Source",800,600,-1,-1,-1,-1,$gui)
$Soruce = GUICtrlCreateEdit("",10,10,780,580,$ES_MULTILINE)

GUISetState(@SW_SHOW,$gui)
GUISetState(@SW_HIDE,$gui2)

_IENavigate($Browser,IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"))

$Currenturl = _IEPropertyGet($Browser,"locationurl")
$title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")
if not @error Then
    WinSetTitle($Gui,"","Alek's Web Browser - " & $title[0])
Else
    WinSetTitle($Gui,"",GUICtrlRead($Input1))
EndIf

$Temp = 0
Do
    $Msg = GUIGetMsg(1)
    Switch $Msg[0]
        Case $Button1
            _IEAction($Browser,"back")
            GUICtrlSetState($Button2,$GUI_FOCUS)
        Case $Button2
            _IENavigate($Browser,GUICtrlRead($Input1),0)
            $title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")
            if not @error Then
                WinSetTitle($Gui,"",$title[0])
            Else
                WinSetTitle($Gui,"",GUICtrlRead($Input1))
            EndIf
        Case $Button3
            _IENavigate($Browser,IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"))
            GUICtrlSetState($Button2,$GUI_FOCUS)
        Case $Button4
            _IEAction($Browser,"Stop")
            GUICtrlSetState($Button2,$GUI_FOCUS)
        Case $Button5
            _IEAction($Browser,"Forward")
            GUICtrlSetState($Button2,$GUI_FOCUS)
        Case $Menuitem[1]
            FileDelete(@TempDir & "\Source.txt")
            FileWrite(@TempDir & "\Source.txt",_INetGetSource(GUICtrlRead($Input1)))
            GUICtrlSetData($Soruce,FileRead(@TempDir & "\Source.txt"))
            GUISetState(@SW_SHOW,$gui2)
        Case $Menuitem[2]
            $Home = InputBox("Alek's Web Browser","Change your Start page",_IEPropertyGet($Browser,"locationurl"))
            if $Home <> "" and $Home <> 1 then IniWrite(@ScriptDir & "\Config.ini","Config","Home",$Home)
        Case $Menuitem[3]
                _Favorites()
        Case $GUI_EVENT_CLOSE
            if $msg[1] = $gui2 Then
                GUISetState(@SW_HIDE,$gui2)
            Elseif $msg[1] = $gui Then
                Exit
            EndIf
    EndSwitch
    if IsArray($Favorite) then 
        for $x = 1 to $Favorite[0][0]
            if $msg[0] = $Menuitem[$x+3] Then
                _IENavigate($Browser,IniRead(@ScriptDir & "\config.ini","Favorites",$Favorite[$x][0],"Error"))
            EndIf
        Next
    EndIf
    _setcontrolsize()
    if _IEPropertyGet($Browser,"locationurl") <> $Currenturl then
        GUICtrlSetData($Input1,_IEPropertyGet($Browser,"locationurl"))
        $title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")
        if not @error Then
            WinSetTitle($Gui,"","Alek's Web Browser - " & $title[0])
        Else
            WinSetTitle($Gui,"",GUICtrlRead($Input1))
        EndIf
        $Currenturl = _IEPropertyGet($Browser,"locationurl")
    EndIf
Until 1=2

Func _setcontrolsize()
    $Pos = WinGetPos($Gui)
    if $Pos[2] <> $Width or $Pos[3] <> $Hight Then
        GUICtrlSetPos($Input1,198,10,$Pos[2]-218,34)
        GUICtrlSetPos($Obj,10,54,$Pos[2]-30,$Pos[3]-119)
        $Width = $Pos[2]
        $Hight = $Pos[3]
    EndIf
EndFunc

Func _Favorites()
    $Form1 = GUICreate("Alek's Web Browser", 295, 120, 193, 115)
    $Label1 = GUICtrlCreateLabel("Enter the URL (http://www.myfavoritesite.com) and the of the Page you want to add to you Favorites list", 5, 5, 278, 32, $SS_CENTER)
    $Input2 = GUICtrlCreateInput(_IEPropertyGet($Browser,"locationurl"), 70, 45, 216, 21)
    $Label2 = GUICtrlCreateLabel("Page URL", 5, 45, 54, 17)
    $Label3 = GUICtrlCreateLabel("Page Name", 5, 70, 60, 17)
    $title2 = _StringBetween(_INetGetSource(GUICtrlRead($Input2)),"<Title>","</Title>")
    $Input3 = GUICtrlCreateInput($title2[0], 70, 70, 216, 21)
    $Addbutton = GUICtrlCreateButton("Add To Favorites",5,96,286,20)
    GUISetState(@SW_SHOW)
    do
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Addbutton
                if GUICtrlRead($Input2) <> "" and GUICtrlRead($Input3) <> "" then 
                    IniWrite(@ScriptDir & "\Config.ini","Favorites",GUICtrlRead($Input3),GUICtrlRead($Input2))
                    for $x = 4 to UBound($Menuitem)-1
                        if $Menuitem[$x]= "" Then
                            $Menuitem[$x] = GUICtrlCreateMenuItem(GUICtrlRead($Input3),$Menu2)
                            ExitLoop
                            $nMsg = $GUI_EVENT_CLOSE
                        EndIf
                    Next
                    $Favorite = IniReadSection(@ScriptDir & "\Config.ini","Favorites")
                    ExitLoop
                    GUIDelete($Form1)
                EndIf
        EndSwitch
    Until $nMsg = $GUI_EVENT_CLOSE
    GUIDelete($Form1)
EndFunc

you have to use the compiled version for the button icons to work, i can be decompiled if dont trust me.

compiled: Web_Browser.exe

Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites



Same error mentioned above.

Share this post


Link to post
Share on other sites

Same error mentioned above.

fixed, forgot to add a safty check, just added if isarray($favorite) then ...

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

Is this a new trend or something, like it was with the web servers a while ago? :)

hehe

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

Another bug, Favorite won't work until you restart the browser.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Another bug, Favorite won't work until you restart the browser.

Fixed :)

PS:

im useing this browser to post replys :P

Edited by Alek

[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

hehe, another one :)

Bugs:

-it crashs if the page you are trying to open is to big.

#NoTrayIcon
#region Includes
#include <GUIConstants.au3>
#include <IE.au3>
#include <Inet.au3>
#include <String.au3>
#endregion
Global $Menuitem[100]
$Browser = _IECreateEmbedded()
_IEErrorHandlerRegister()
$Width = 800
$Hight = 600

$Gui = GUICreate("Alek's Web Browser",800,600,-1,-1,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Menu1 = GUICtrlCreateMenu("Stuff")
$Menuitem[1] = GUICtrlCreateMenuItem("View Source",$Menu1)
$Menuitem[2] = GUICtrlCreateMenuItem("Home page",$Menu1)

$Menu2 = GUICtrlCreateMenu("Favorites")
$Menuitem[3] = GUICtrlCreateMenuItem("Add Favorite",$Menu2)
GUICtrlCreateMenuItem("",$Menu2)
$Favorite = IniReadSection(@ScriptDir & "\Config.ini","Favorites")
if not @error then 
    for $x = 1 to $Favorite[0][0]
        $Menuitem[$x+3] = GUICtrlCreateMenuItem($Favorite[$x][0],$Menu2)
    Next
EndIf
$Button1 = GUICtrlCreateButton("",10,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,3)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button2 = GUICtrlCreateButton("",46,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,4)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button3 = GUICtrlCreateButton("",82,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,5)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button4 = GUICtrlCreateButton("",118,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,6)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Button5 = GUICtrlCreateButton("",154,10,34,34,$BS_ICON)
GUICtrlSetImage(-1,@ScriptFullPath,7)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Input1 = GUICtrlCreateInput(IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"),198,10,582,34)
GUICtrlSetFont(-1,20,400)
GUICtrlSetResizing(-1,$GUI_DOCKALL)
$Obj = GUICtrlCreateObj($Browser,10,54,780,536)

GUICtrlSetState($Button2,$GUI_FOCUS)
$gui2 = GUICreate("Source",800,600,-1,-1,-1,-1,$gui)
$Soruce = GUICtrlCreateEdit("",10,10,780,580,$ES_MULTILINE)

GUISetState(@SW_SHOW,$gui)
GUISetState(@SW_HIDE,$gui2)

_IENavigate($Browser,IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"))

$Currenturl = _IEPropertyGet($Browser,"locationurl")
$title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")
if not @error Then
    WinSetTitle($Gui,"","Alek's Web Browser - " & $title[0])
Else
    WinSetTitle($Gui,"",GUICtrlRead($Input1))
EndIf

$Temp = 0
Do
    $Msg = GUIGetMsg(1)
    Switch $Msg[0]
        Case $Button1
            _IEAction($Browser,"back")
            GUICtrlSetState($Button2,$GUI_FOCUS)
        Case $Button2
            _IENavigate($Browser,GUICtrlRead($Input1),0)
            $title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")
            if not @error Then
                WinSetTitle($Gui,"",$title[0])
            Else
                WinSetTitle($Gui,"",GUICtrlRead($Input1))
            EndIf
        Case $Button3
            _IENavigate($Browser,IniRead(@ScriptDir & "\Config.ini","Config","Home","Http://www.autoitscript.com"))
            GUICtrlSetState($Button2,$GUI_FOCUS)
        Case $Button4
            _IEAction($Browser,"Stop")
            GUICtrlSetState($Button2,$GUI_FOCUS)
        Case $Button5
            _IEAction($Browser,"Forward")
            GUICtrlSetState($Button2,$GUI_FOCUS)
        Case $Menuitem[1]
            FileDelete(@TempDir & "\Source.txt")
            FileWrite(@TempDir & "\Source.txt",_INetGetSource(GUICtrlRead($Input1)))
            GUICtrlSetData($Soruce,FileRead(@TempDir & "\Source.txt"))
            GUISetState(@SW_SHOW,$gui2)
        Case $Menuitem[2]
            $Home = InputBox("Alek's Web Browser","Change your Start page",_IEPropertyGet($Browser,"locationurl"))
            if $Home <> "" and $Home <> 1 then IniWrite(@ScriptDir & "\Config.ini","Config","Home",$Home)
        Case $Menuitem[3]
                _Favorites()
        Case $GUI_EVENT_CLOSE
            if $msg[1] = $gui2 Then
                GUISetState(@SW_HIDE,$gui2)
            Elseif $msg[1] = $gui Then
                Exit
            EndIf
    EndSwitch
    if IsArray($Favorite) then 
        for $x = 1 to $Favorite[0][0]
            if $msg[0] = $Menuitem[$x+3] Then
                _IENavigate($Browser,IniRead(@ScriptDir & "\config.ini","Favorites",$Favorite[$x][0],"Error"))
            EndIf
        Next
    EndIf
    _setcontrolsize()
    if _IEPropertyGet($Browser,"locationurl") <> $Currenturl then
        GUICtrlSetData($Input1,_IEPropertyGet($Browser,"locationurl"))
        $title = _StringBetween(_INetGetSource(GUICtrlRead($Input1)),"<Title>","</Title>")
        if not @error Then
            WinSetTitle($Gui,"","Alek's Web Browser - " & $title[0])
        Else
            WinSetTitle($Gui,"",GUICtrlRead($Input1))
        EndIf
        $Currenturl = _IEPropertyGet($Browser,"locationurl")
    EndIf
Until 1=2

Func _setcontrolsize()
    $Pos = WinGetPos($Gui)
    if $Pos[2] <> $Width or $Pos[3] <> $Hight Then
        GUICtrlSetPos($Input1,198,10,$Pos[2]-218,34)
        GUICtrlSetPos($Obj,10,54,$Pos[2]-30,$Pos[3]-119)
        $Width = $Pos[2]
        $Hight = $Pos[3]
    EndIf
EndFunc

Func _Favorites()
    $Form1 = GUICreate("Alek's Web Browser", 295, 120, 193, 115)
    $Label1 = GUICtrlCreateLabel("Enter the URL (http://www.myfavoritesite.com) and the of the Page you want to add to you Favorites list", 5, 5, 278, 32, $SS_CENTER)
    $Input2 = GUICtrlCreateInput(_IEPropertyGet($Browser,"locationurl"), 70, 45, 216, 21)
    $Label2 = GUICtrlCreateLabel("Page URL", 5, 45, 54, 17)
    $Label3 = GUICtrlCreateLabel("Page Name", 5, 70, 60, 17)
    $title2 = _StringBetween(_INetGetSource(GUICtrlRead($Input2)),"<Title>","</Title>")
    $Input3 = GUICtrlCreateInput($title2[0], 70, 70, 216, 21)
    $Addbutton = GUICtrlCreateButton("Add To Favorites",5,96,286,20)
    GUISetState(@SW_SHOW)
    do
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $Addbutton
                if GUICtrlRead($Input2) <> "" and GUICtrlRead($Input3) <> "" then 
                    IniWrite(@ScriptDir & "\Config.ini","Favorites",GUICtrlRead($Input3),GUICtrlRead($Input2))
                    for $x = 4 to UBound($Menuitem)-1
                        if $Menuitem[$x]= "" Then
                            $Menuitem[$x] = GUICtrlCreateMenuItem(GUICtrlRead($Input3),$Menu2)
                            ExitLoop
                            $nMsg = $GUI_EVENT_CLOSE
                        EndIf
                    Next
                    $Favorite = IniReadSection(@ScriptDir & "\Config.ini","Favorites")
                    ExitLoop
                    GUIDelete($Form1)
                EndIf
        EndSwitch
    Until $nMsg = $GUI_EVENT_CLOSE
    GUIDelete($Form1)
EndFunc

you have to use the compiled version for the button icons to work, i can be decompiled if dont trust me.

compiled: Web_Browser.exe

Share this post


Link to post
Share on other sites

This is great web broswer. Will it be ok for me to download it and make changes?

Share this post


Link to post
Share on other sites

This is great web broswer. Will it be ok for me to download it and make changes?

i think thats the general idea of the example scripts forum :)


[font="Impact"]Never fear, I is here.[/font]

Share this post


Link to post
Share on other sites

wow dude... maybe add a chat bar in it like msn bar but for members to talk to members and members to talk to on members(privet)

Good job

Share this post


Link to post
Share on other sites

Hey Alek, I was wondering Whats the use of the

[3] on this: $Menuitem[3] = GUICtrlCreateMenuItem("Add Favorite",$Menu2)

Share this post


Link to post
Share on other sites

Hi

I thing I have foung a bug.

I've installed it on Windows XP. As Administrator, it works fine. But, as a normal user it failed.

The problem is that if you type www.google.com, the page is display. But, it will not response to se search command.

Any ideas?

nice, but very unresponsive at times

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