Jump to content

Odd browser I threw together.


MaudKip
 Share

Recommended Posts

I was bored yesterday and decided to take a break from my usual browser, and while messing around I came up with this.

Not all the features are listed, or listed correctly in the startup menu, so read through the source to get the commands.

There are a few bugs, such as:

Can't highlight text.

And some more, I just went blank lol.

Well, just tell me what you think, give me suggestions, criticisms, ect.

#include <GUIConstants.au3>
#include <ie.au3>
Opt("GUIOnEventMode",1)
Const $WM_NCLBUTTONDOWN = 0xA1
Const $HTCAPTION = 2
$mm=1
HotKeySet("!{ESC}", "Quit")
HotKeySet("{left}", "left")
HotKeySet("{right}", "right")
HotKeySet("{up}", "up")
HotKeySet("{down}", "down")
HotKeySet("^{down}", "Dheight")
HotKeySet("^{up}", "Uheight")
HotKeySet("^{left}", "Lwidth")
HotKeySet("^{right}", "Rwidth")
HotKeySet("^{space}", "toggleMaxRestore")
HotKeySet("!{space}", "min")
HotKeySet("!{down}", "Dtrans")
HotKeySet("!{up}", "Utrans")
HotKeySet("!{left}", "Ltrans")
HotKeySet("+{up}", "xyz")


HotKeySet("^u", "url")
HotKeySet("^{BACKspace}", "back")
#Region ### START Koda GUI section ### Form=
$gui = GUICreate("Form1", 628, 446, 187, 120,BitOR($WS_POPUP,$WS_BORDER))
GUISetOnEvent ($GUI_EVENT_SECONDARYDOWN, "Drag" )
GUISetOnEvent ($GUI_EVENT_PRIMARYDOWN, "Drag" )
$Obj1 = ObjCreate("Shell.Explorer.2")
$Obj1_ctrl = GUICtrlCreateObj($Obj1, -2, -2, 632, 450)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_IENavigate($Obj1, "about:blank")
_IEBodyWriteHTML($Obj1, "<b>Resizeing:</b><br><i>CTRL+</i><br><u>Arrow left:Width<br>Arrow right: Width<br>Arrow up: Height<br> Arrow down: Height</u><br><br><b>Movement:</b><br><i>No Additional Key</i><br><u>Window is moved with the arrow keys.</u><br><i>ALT+</i><br><u>Arrow up: Moves window to upper left corner of the screen</u><br><br><b>Visability:</b><br><i>ALT+</i><br><u>Arrow left: 100% Opacity<br>Arrow up: Hide Window<br>Arrow down: 50% Opacity</u><br><br><b>Exit:</b><br><i>ALT+</i><br><u>ESC</u>")
;**************************************************************************

#Region ### START Koda GUI section ### Form=
$gui2 = GUICreate("Form1", 635, 30, 0, 0,BitOR($WS_POPUP,$WS_BORDER))
WinSetOnTop($gui2, "", 1)
$Input1 = GUICtrlCreateInput("Input1", 0, 0, 636, 30)
GUICtrlSetFont(-1, 18)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;**************************************************************************

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func Drag()
    dllcall("user32.dll","int","SendMessage","hWnd", $gui,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)

EndFunc

Func Quit()
    Exit
EndFunc

Func url()
;;$url=InputBox("Navigation", "Type the address of the page you would like to navigate to.")
$url=GUICtrlRead($Input1)
_IENavigate($Obj1, $url)
EndFunc

Func back()
_IEAction($Obj1, "back")
EndFunc

Func left()
    $size = WinGetPos($gui)
WinMove($gui, "", $size[0]-5, $size[1]);;, 200, 200)
EndFunc

Func right()
    $size = WinGetPos($gui)
WinMove($gui, "", $size[0]+5, $size[1]);;, 200, 200)
EndFunc

Func up()
    $size = WinGetPos($gui)
WinMove($gui, "", $size[0], $size[1]-5);;, 200, 200)
EndFunc

Func down()
    $size = WinGetPos($gui)
WinMove($gui, "", $size[0], $size[1]+5);;, 200, 200)
EndFunc

Func Dheight()
    $size = WinGetPos($gui)
WinMove($gui, "", $size[0], $size[1], $size[2], $size[3]+5)
EndFunc

Func Uheight()
    $size = WinGetPos($gui)
WinMove($gui, "", $size[0], $size[1], $size[2], $size[3]-5)
EndFunc

Func Lwidth()
    $size = WinGetPos($gui)
WinMove($gui, "", $size[0], $size[1], $size[2]-5, $size[3])
EndFunc

Func Rwidth()
    $size = WinGetPos($gui)
WinMove($gui, "", $size[0], $size[1], $size[2]+5, $size[3])
EndFunc

Func toggleMaxRestore()
    ;;Detect wheather or not the window is maximized or not.
        If $mm=1 Then
        $mm=0
    Else
        $mm=1
    EndIf
if $mm = 0 then GUISetState(@SW_MAXIMIZE, $gui)
if $mm = 0 then WinSetTrans($gui2,"", 200)
    if $mm = 1 then GUISetState(@SW_RESTORE, $gui)
    if $mm = 1 then WinSetTrans($gui2,"", 255)
EndFunc

Func min()
GUISetState(@SW_MINIMIZE, $gui)
EndFunc

Func Utrans()
WinSetTrans($gui, "", 1)
WinSetTrans($gui2, "", 1)
EndFunc

Func Dtrans()
WinSetTrans($gui, "", 150)
WinSetTrans($gui2, "", 150)
EndFunc

Func Ltrans()
WinSetTrans($gui, "", 255)
WinSetTrans($gui2, "", 255)
EndFunc

Func xyz()
winmove($gui, "", 0, 0)
EndFunc
Edited by MaudKip
Link to comment
Share on other sites

i made something like this(ish)

You can drag the guis around with alt+mousebutton1 (they also attach to each other(bottom and top), you can drag them appart by draging the menu gui away from the browser gui)

You can resize it with ctrl+mousebutton1 if cursor close to the gui edge (bottom and left side only)

You can change transparency with alt+mousewheel up and down

Icons: DOWNLOAD!!!

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

Global $WM_MOUSEWHEEL = 0x020A
Global $WM_MOUSEWHEEL_SCROLLUP = 0xFF880000
Global $WM_MOUSEWHEEL_SCROLLDOWN = 0x00780000
HotKeySet("^!a","_Hide")
_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
Global $Stuck[2]

_GetFiles()

$Menu_Gui = GUICreate("",600,32,0,0,$WS_POPUPWINDOW)
$Button1 = GUICtrlCreateButton("B",0,0,32,32,$BS_ICON)
GUICtrlSetImage(-1,@ScriptDir & "/icons/back.ico")
$Button2 = GUICtrlCreateButton("Go",32,0,32,32,$BS_ICON)
GUICtrlSetImage(-1,@ScriptDir & "/icons/go.ico")
$Button3 = GUICtrlCreateButton("H",64,0,32,32,$BS_ICON)
GUICtrlSetImage(-1,@ScriptDir & "/icons/home.ico")
$Button4 = GUICtrlCreateButton("S",96,0,32,32,$BS_ICON)
GUICtrlSetImage(-1,@ScriptDir & "/icons/stop.ico")
$Button5 = GUICtrlCreateButton("F",128,0,32,32,$BS_ICON)
GUICtrlSetImage(-1,@ScriptDir & "/icons/forward.ico")
$Input1 = GUICtrlCreateInput("http://www.autoitscript.com/forum/index.php?",160,0,440,32)
GUICtrlSetFont(-1,14,800)
GUISetState()

$Browser_Gui = GUICreate("",800,600,-1,-1,$WS_POPUPWINDOW,-1,$Menu_Gui)
GUIRegisterMsg($WM_MOUSEWHEEL ,"_Test")
$Obj = GUICtrlCreateObj($oIE,0,0,800,600)
GUICtrlSetResizing(-1,102)
GUISetState()
_IENavigate($oIE,GUICtrlRead($Input1),0)
$Stuck[0] = 0
$Hide = 0
$Win_Trans = 254
$Currnet_Url = GUICtrlRead($Input1)
While 1
    $Msg = GUIGetMsg(1)
    Switch $Msg[0]
        Case $Button1
            _IEAction($oIE,"Back")
        Case $Button2
            _IENavigate($oIE,GUICtrlRead($Input1),0)
        Case $Button4
            _IEAction($oIE,"Stop")
        Case $Button5
            _IEAction($oIE,"Forward")
    EndSwitch
    If WinActive($Menu_Gui) Then
        HotKeySet("{Enter}","_Navigate")
    Else
        HotKeySet("{Enter}")
    EndIf
    If _IsPressed(12) And _IsPressed(01) Then
        _MoveGui()
    EndIf
    If _IsPressed(11) And _IsPressed(01) Then
        _ReSizeGui()
    EndIf
    if _IEPropertyGet($oIE,"locationurl") <> $Currnet_Url then
        GUICtrlSetData($Input1,_IEPropertyGet($oIE,"locationurl"))
        $Currnet_Url = GUICtrlRead($Input1)
    EndIf
    Sleep(1)
WEnd

Func _Test($hWnd,$Msg,$wParam)
    If _IsPressed(12) Then
        If $wParam = $WM_MOUSEWHEEL_SCROLLDOWN And $Win_Trans > 20 Then
            $Win_Trans -= 20
        ElseIf $wParam = $WM_MOUSEWHEEL_SCROLLUP And $Win_Trans < 235 Then
            $Win_Trans += 20
        EndIf
    EndIf
    If $Win_Trans < 20 then $Win_Trans = 0
    If $Win_Trans > 235 Then $Win_Trans = 254
    WinSetTrans($Menu_Gui,"",$Win_Trans)
    WinSetTrans($Browser_Gui,"",$Win_Trans)
EndFunc

Func _Test2($hWnd,$Msg,$wParam)
    MsgBox(0,"",$wParam)
EndFunc

Func _MoveGui()
    If WinActive($Menu_Gui) Then
        $Ginfo = GUIGetCursorInfo($Menu_Gui)
        $Stuck[0] = 0
        $Timer = TimerInit()
        Do
            $Mouse_pos = MouseGetPos()
            WinMove($Menu_Gui,"",$Mouse_pos[0]-$Ginfo[0],$Mouse_pos[1]-$Ginfo[1])
            If TimerDiff($Timer) > 500 Then
                $Win_pos1 = WinGetPos($Menu_Gui)
                $Win_pos2 = WinGetPos($Browser_Gui)
                $Mouse_pos = MouseGetPos()
                If $Win_pos1[1]+$Win_pos1[3] = $Win_pos2[1] And $Stuck[0] = 0 Then
                    $Win_pos2 = WinGetPos($Browser_Gui)
                    $Win_pos1 = WinGetPos($Menu_Gui)
                    $Stuck[0] = 1
                    $Stuck[1] = $Win_pos1[0]-$Win_pos2[0]
                ElseIf $Win_pos1[1] = $Win_pos2[1]+$Win_pos2[3] And $Stuck[0] = 0 Then
                    $Win_pos2 = WinGetPos($Browser_Gui)
                    $Win_pos1 = WinGetPos($Menu_Gui)
                    $Stuck[0] = 2
                    $Stuck[1] = $Win_pos1[0]-$Win_pos2[0]
                EndIf
                If  $Stuck[0] = 1 Then
                    $Win_pos2 = WinGetPos($Browser_Gui)
                    $Win_pos1 = WinGetPos($Menu_Gui)
                    WinMove($Browser_Gui,"",($Mouse_pos[0]-$Ginfo[0])-$Stuck[1],$Win_pos1[1]+$Win_pos1[3])
                ElseIf $Stuck[0] = 2 Then
                    $Win_pos2 = WinGetPos($Browser_Gui)
                    $Win_pos1 = WinGetPos($Menu_Gui)
                    WinMove($Browser_Gui,"",($Mouse_pos[0]-$Ginfo[0])-$Stuck[1],$Win_pos1[1]-$Win_pos2[3])
                EndIf
            EndIf
            Sleep(1)
        Until Not _IsPressed(01)
    ElseIf WinActive($Browser_Gui) Then
        $Ginfo = GUIGetCursorInfo($Browser_Gui)
        Do
            $Win_pos1 = WinGetPos($Menu_Gui)
            $Win_pos2 = WinGetPos($Browser_Gui)
            $Mouse_pos = MouseGetPos()
            WinMove($Browser_Gui,"",$Mouse_pos[0]-$Ginfo[0],$Mouse_pos[1]-$Ginfo[1])
            If  $Stuck[0] = 1 Then
                $Win_pos2 = WinGetPos($Browser_Gui)
                $Win_pos1 = WinGetPos($Menu_Gui)
                WinMove($Menu_Gui,"",($Mouse_pos[0]-$Ginfo[0])+$Stuck[1],$Win_pos2[1]-34)
            ElseIf $Stuck[0] = 2 Then
                $Win_pos2 = WinGetPos($Browser_Gui)
                $Win_pos1 = WinGetPos($Menu_Gui)
                WinMove($Menu_Gui,"",($Mouse_pos[0]-$Ginfo[0])+$Stuck[1],$Win_pos2[1]+$Win_pos2[3])
            EndIf
            If $Win_pos1[1]+$Win_pos1[3] = $Win_pos2[1] Then
                $Win_pos2 = WinGetPos($Browser_Gui)
                $Win_pos1 = WinGetPos($Menu_Gui)
                $Stuck[0] = 1
                $Stuck[1] = $Win_pos1[0]-$Win_pos2[0]
            ElseIf $Win_pos1[1] = $Win_pos2[1]+$Win_pos2[3] Then
                $Win_pos2 = WinGetPos($Browser_Gui)
                $Win_pos1 = WinGetPos($Menu_Gui)
                $Stuck[0] = 2
                $Stuck[1] = $Win_pos1[0]-$Win_pos2[0]
            EndIf
            Sleep(1)
        Until Not _IsPressed(01)
    EndIf
EndFunc

Func _ReSizeGui()
    $Ginfo = GUIGetCursorInfo($Browser_Gui)
    $Win_pos = WinGetPos($Browser_Gui)
    If WinActive($Browser_Gui) And $Ginfo[0] > $Win_pos[2]-20 And $Ginfo[1] > $Win_pos[3]-20 Then
        $Win_pos = WinGetPos($Browser_Gui)
        Do
            $Ginfo = GUIGetCursorInfo($Browser_Gui)
            WinMove($Browser_Gui,"",$Win_pos[0],$Win_pos[1],$Ginfo[0],$Ginfo[1])
            Sleep(1)
        Until Not _IsPressed(01)
    EndIf
EndFunc

Func _Hide()
    If $Hide = 0 Then
        GUISetState(@SW_HIDE,$Browser_Gui)
        GUISetState(@SW_HIDE,$Menu_Gui)
        $Hide = 1
    Else
        GUISetState(@SW_SHOW,$Browser_Gui)
        GUISetState(@SW_SHOW,$Menu_Gui)
        $Hide = 0
    EndIf
EndFunc

Func _Navigate()
    _IENavigate($oIE,GUICtrlRead($Input1),0)
EndFunc

Func _GetFiles()
    DirCreate(@ScriptDir & "/Icons")
    If Not FileExists(@ScriptDir & "/Icons/Back.ico") Then
        InetGet("http://alek900.itrello.com/Autoit/Icons/Back",@ScriptDir & "/Icons/Back.ico")
    EndIf
    If Not FileExists(@ScriptDir & "/Icons/Forward.ico") Then
        InetGet("http://alek900.itrello.com/Autoit/Icons/Forward",@ScriptDir & "/Icons/Forward.ico")
    EndIf
    If Not FileExists(@ScriptDir & "/Icons/Go.ico") Then
        InetGet("http://alek900.itrello.com/Autoit/Icons/go",@ScriptDir & "/Icons/Go.ico")
    EndIf
    If Not FileExists(@ScriptDir & "/Icons/Stop.ico") Then
        InetGet("http://alek900.itrello.com/Autoit/Icons/Stop",@ScriptDir & "/Icons/Stop.ico")
    EndIf
    IF Not FileExists(@ScriptDir & "/Icons/Home.ico") Then
        InetGet("http://alek900.itrello.com/Autoit/Icons/home",@ScriptDir & "/Icons/Home.ico")
    EndIf
EndFunc
Edited by Alek

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

Link to comment
Share on other sites

i kind like the idea with the gui <_<

you should add so that you can drag the gui around insted of <- ^ -> buttons

Yes orgionaly you could drag with the mouse, however I removed this feature, because it interfered with highlighting. Later I added a drag function whilst holding F2.

I will post the updated version in about 15 minutes when i goto my second period class.

=]

Thanks for the feed back. I will try your version momentarily.

=]

Link to comment
Share on other sites

Update added.

Not much better but hey.

=]

@Alek

I like your version, however, the hotkey set to the enter key is not a good I dea.

When you try and put a line break in a form while using your browser, it refreshes the page.

Also, the transparency option doesn't always work.

But overall, your's is a better version than mone.

=]

Edited by MaudKip
Link to comment
Share on other sites

Update added.

Not much better but hey.

=]

@Alek

I like your version, however, the hotkey set to the enter key is not a good I dea.

When you try and put a line break in a form while using your browser, it refreshes the page.

Also, the transparency option doesn't always work.

But overall, your's is a better version than mone.

=]

fixed the enter problem, just change "If WinActive($Browser_Gui) Or WinActive($Menu_Gui) Then" to "If WinActive($Menu_Gui) Then"also added so that the URL changes to your current webpage.

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

Link to comment
Share on other sites

  • Moderators

And what's the difference of using this versus just using IE?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

And what's the difference of using this versus just using IE?

No difference.

I was just bored lol.

Although I am thinking of making an almost exact copy and just adding ghostzilla like features.

No purpose really, just curious if it can be done.

=]

Link to comment
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
 Share

  • Recently Browsing   0 members

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