Jump to content

Open Source Browser


JustinReno
 Share

Recommended Posts

I made another open-source Web Browser browser, not for me, but more anyone who wants to use it. There is no need to give me credit, claim it as your own, do anything you want with it.

Features:

1. Homepage

2. Go, Back, Stop, Forward, Speak, home, and Refresh buttons.

3. Preferences, Get Current URL, Random URL

4. No includes.

Bugs:

1. The File save dialog when you click Save source, it just keeps poping up after you save it.

2. The IE error register wasn't implemented, so it will crash often.

Global $Ini = @ScriptDir&"\SWBSettings.ini"
If Not FileExists($Ini) Then IniWrite($Ini, "SimpleWebBrowser", "HomePage", "www.google.com")

GLobal $Homepage = IniRead($Ini, "SimpleWebBrowser", "HomePage", "")
Global $LastURL = IniRead($Ini, "SimpleWebBrowser", "LastURL", "")

$SimpleWebBrowserGUI = GUICreate("Simple Web Browser Fourth Edition by Justin Reno - ", 613, 449)
$IE = ObjCreate("Shell.Explorer.2")
$IEObject = GUICtrlCreateObj($IE, 0, 32, 610, 396)
$URLInput = GUICtrlCreateInput("", 56, 8, 225, 21)
$EnterURLLabel = GUICtrlCreateLabel("Enter URL:", 0, 8, 57, 17)
$GoButton = GUICtrlCreateButton("Go", 280, 8, 75, 25, 0)
$StopButton = GUICtrlCreateButton("Stop", 360, 8, 33, 25, 0)
$BackButton = GUICtrlCreateButton("Back", 400, 8, 33, 25, 0)
$ForwardButton = GUICtrlCreateButton("Forward", 440, 8, 42, 25, 0)
$RefreshButton = GUICtrlCreateButton("Refresh", 488, 8, 43, 25, 0)
$HomeButton = GUICtrlCreateButton("Home", 536, 8, 35, 25, 0)
$SpeakButton = GUICtrlCreateButton("Speak", 576, 8, 35, 25, 0)
$FileMenu = GUICtrlCreateMenu("File")
$NewWindow = GUICtrlCreateMenuItem("New Window", $FileMenu)
$Open = GUICtrlCreateMenuItem("Open", $FileMenu)
$Print = GUICtrlCreateMenuItem("Print", $FileMenu)
$SavePage = GUICtrlCreateMenuItem("Save Page", $FileMenu)
$SaveSource = GUICtrlCreateMenuItem("Save Source", $FileMenu)
$Exit = GUICtrlCreateMenuItem("Exit", $FileMenu)
$ToolsMenu = GUICtrlCreateMenu("Tools")
$Preferences = GUICtrlCreateMenuItem("Preferences", $ToolsMenu)
$RandomURL = GUICtrlCreateMenuItem("Random URL", $ToolsMenu)
$GetCurrentURL = GUICtrlCreateMenuItem("Get Current URL", $ToolsMenu)
GUISetState()
$IE.Navigate($Homepage)
While 1
    WinSetTitle($SimpleWebBrowserGUI, "", "Simple Web Browser Fourth Edition by Justin Reno - "&$IE.LocationURL()&"")
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            IniWrite($Ini, "SimpleWebBrowser", "LastURL", $IE.LocationURL())
            Exit
        Case $GoButton
            $IE.Navigate(GuiCtrlRead($URLInput))
            GUICtrlRead($URLInput, GuiCtrlRead($URLInput))
        Case $StopButton
            $IE.Stop()
        Case $BackButton
            $IE.Back()
        Case $ForwardButton
            $IE.Forward()
        Case $RefreshButton
            $IE.Refresh()
        Case $HomeButton
            $IE.Navigate(IniRead($Ini, "SimpleWebBrowser", "Homepage", ""))
        Case $SpeakButton
            $Speak = ObjCreate("SAPI.SPVOICE")
            $Speak.Speak($IE.document.selection.createRange.text)
        Case $NewWindow
            Run(@ScriptFullPath)
        Case $Open
            $OpenFile = FileOpenDialog("Open File", @ScriptDir, "Files(*.html;*.jpg)")
            $IE.Navigate($OpenFile)
        Case $Print
            $IE.document.execCommand("Print")
        Case $SavePage
            $IE.document.execCommand("SaveAs")
        Case $SaveSource
            $GetSource = _GetSource($IE.LocationURL())
            $SaveSource = FileSaveDialog("Save Source", @ScriptDir, "HTML(*.html)")
            FileWrite($SaveSource, $GetSource)
        Case $Exit
            IniWrite($Ini, "SimpleWebBrowser", "LastURL", $IE.LocationURL())
            Exit
        Case $Preferences
            _Preferences()
        Case $RandomURL
            _RandomURL()
        Case $GetCurrentURL
            MsgBox(0, "Get Current URL", $IE.LocationURL())
            ClipPut($IE.LocationURL())
    EndSwitch
WEnd

Func _Preferences()
$PreferencesGUI = GUICreate("Preferences", 196, 42)
$HomepageLabel = GUICtrlCreateLabel("Homepage:", 0, 0, 59, 17)
$HomepageInput = GUICtrlCreateInput("", 0, 16, 121, 21)
$OKButton = GUICtrlCreateButton("OK", 120, 0, 75, 41, 0)
GUISetState(@SW_SHOW)
While 1
    $PreferencesMsg = GUIGetMsg()
    Switch $PreferencesMsg
        Case -3
            Exitloop
        Case $OKButton
            IniWrite($Ini, "SimpleWebBrowser", "Homepage", GUICtrlRead($HomepageInput))
            ExitLoop
    EndSwitch
WEnd
EndFunc

Func _RandomURL()
    $RandomNumber = Random(1, 5, 1)
    Switch $RandomNumber
        Case 1
            $IE.Navigate("www.google.com")
        Case 2
            $IE.Navigate("www.answers.com")
        Case 3
            $IE.Navigate("www.autoitscript.com/forum")
        Case 4
            $IE.Navigate("www.justinreno.tk")
        Case 5
            $IE.Navigate("www.myspace.com")
    EndSwitch
EndFunc

Func _GetSource($URLSource)
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", $URLSource)
$oHTTP.Send()
$HTMLSource = $oHTTP.Responsetext
Return $HTMLSource
EndFunc

Have fun and show your versions here!

As I said, have fun with, remix it, skin it, claim it, fix it, add more to it! :):P:):D:lol: :lol: <_<

Link to comment
Share on other sites

I actually havn't, unless you want me to post another example of these everyday. Haha.

And I'm not aiming to start a trend, maybe I should have mentioned this is for learning.

Don't freak out.

Holy crapola. <_<

EDIT EDIT EDIT: I also released this because Simple Web Browser went under a closed source copyrighted license. Just in case anyone wanted to make a browser. If you tired of it, then don't use it, this is my last web browser. Simple Web Browser has been discontinued. MicroOS is what I'm mainly working on, and maybe porting SWB to MicroOS.

Edited by JustinReno
Link to comment
Share on other sites

I actually havn't, unless you want me to post another example of these everyday. Haha.

And I'm not aiming to start a trend, maybe I should have mentioned this is for learning.

Don't freak out.

Holy crapola. <_<

well if it for learning havet u learnt enough u have mde like 5 of them allready, i think u have leard all u can.

My opinion is MODS PLEASE DELETE THIS TOPIC ALL TOGETHER.

Link to comment
Share on other sites

Read the rest of my topic other than quoting half of it!

I actually havn't, unless you want me to post another example of these everyday. Haha.

And I'm not aiming to start a trend, maybe I should have mentioned this is for learning.

Don't freak out.

Holy crapola. <_<

EDIT EDIT EDIT: I also released this because Simple Web Browser went under a closed source copyrighted license. Just in case anyone wanted to make a browser. If you tired of it, then don't use it, this is my last web browser. Simple Web Browser has been discontinued. MicroOS is what I'm mainly working on, and maybe porting SWB to MicroOS.

Edited by JustinReno
Link to comment
Share on other sites

well if it for learning havet u learnt enough u have mde like 5 of them allready, i think u have leard all u can.

I think he was trying to say:

Well havn't you learned enough!? You've made like 5 of these already, and I think you have learned all you can.

Link to comment
Share on other sites

  • Developers

Can't you guys just play with autoit and build your browser shell or command shell without bothering us with it ?

It fine that you need some project to learn to program but there is no need to write 10 lines of code and dump it here in Examples to show off...

<_<

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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