Jump to content

SW HTML Editor


AzKay
 Share

Recommended Posts

Once again, I was bored.

Wanted to use notepad, But I hate having to keep opening windows to test the pages.

So I made a html editor using autoit/notepad.

I did not make the RunInGUI, I just edited it abit, And renamed it to that, Because I use it alot, And its easier for me.

AnyGUI.au3

#include <GUIConstants.au3>
#include <AnyGUI.au3>
#include <IE.au3>
Opt("GUIResizeMode", $GUI_DOCKALL)

$Temp = ObjCreate("Mozilla.Browser.1")
If Not IsObj($Temp) Then
    MsgBox(0, "DOWNLOAD PL0x", "NEEDED OR ELSE IT WILL ERROR WITH MOZILLA CONTROL KTHX. RERUN THIS AFTER YOUVE INSTALLED IT KTHXBAI")
    $oIE = _IECreate("http://www.iol.ie/~locka/mozilla/MozillaControl1712.exe", 0, 0, 0)
    Exit
EndIf

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("SW Editor", 914, 426, 232, 92, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
$Button1 = GUICtrlCreateButton("<", 456, 0, 17, 425, 0)
$Button2 = GUICtrlCreateButton("Open", 480, 406, 138, 17, 0)
$Button3 = GUICtrlCreateButton("Load", 630, 406, 138, 17, 0)
$Button4 = GUICtrlCreateButton("Temp Load", 775, 406, 138, 17, 0)
GUICtrlSetState($Button3, $GUI_DISABLE)
$hWnd = RunInGUI($Form1, "NOTEPAD.EXE", @WindowsDir, 0, 0, 449, 425)
_TargetStyle("unset", 1, 0x00C00000, -1, $hWnd)
_TargetStyle("unset", 1, 0x00040000, -1, $hWnd)
$Tab1 = GUICtrlCreateTab(480, 0, 433, 401)
GUICtrlCreateTabItem("Internet Explorer")
$Obj1 = ObjCreate("Shell.Explorer.2")
$Obj1_ctrl = GUICtrlCreateObj($Obj1, 483, 25, 426, 372)
GUICtrlCreateTabItem("Mozilla")
$Obj2 = ObjCreate("Mozilla.Browser.1")
$Obj2_ctrl = GUICtrlCreateObj($Obj2, 483, 25, 426, 372)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $oFile

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If GUICtrlRead($Button1) = "<" Then
                $oSize = WinGetPos($Form1)
                WinMove($Form1, "", $oSize[0], $oSize[1], $oSize[2] - 440, $oSize[3])
                GUICtrlSetData($Button1, ">")
            ElseIf GUICtrlRead($Button1) = ">" Then
                $oSize = WinGetPos($Form1)
                WinMove($Form1, "", $oSize[0], $oSize[1], $oSize[2] + 440, $oSize[3])
                GUICtrlSetData($Button1, "<")
            EndIf
        Case $Button2
            $oFile = FileOpenDialog("Open", @ScriptDir, "All (*.*)")
            _IENavigate($Obj1, $oFile, 0)
            _IENavigate($Obj2, $oFile, 0)
            GUICtrlSetState($Button3, $GUI_ENABLE)
        Case $Button3
            _IENavigate($Obj1, $oFile, 0)
            _IENavigate($Obj2, $oFile, 0)
        Case $Button4
            $oSauce = ControlGetText($hWnd, "", 15)
            _IENavigate($Obj1, "about:blank", 0)
            _IEBodyWriteHTML($Obj1, $oSauce)
            _IEDocWriteHTML($Obj2, $oSauce)
    EndSwitch
WEnd

Func RunInGUI($oGUI, $oPath, $oWorkingDir = "", $x1 = 0, $y1 = 0, $x2 = 800, $y2 = 600, $oFlag = @SW_SHOW)
$PID = Run($oPath, $oWorkingDir, @SW_HIDE)
$hWnd = 0
$stPID = DllStructCreate("int")
Do
    $WinList = WinList()
    For $i = 1 To $WinList[0][0]
        If $WinList[$i][0] <> "" Then
            DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $WinList[$i][1], "ptr", DllStructGetPtr($stPID))
            If DllStructGetData($stPID, 1) = $PID Then
                $hWnd = $WinList[$i][1]
                ExitLoop
            EndIf
        EndIf
    Next
    Sleep(100)
Until $hWnd <> 0

If $hWnd <> 0 Then
    $nExStyle = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", -20)
    $nExStyle = $nExStyle[0]
    DllCall("user32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", -20, "int", BitOr($nExStyle, $WS_EX_MDICHILD))
    DllCall("user32.dll", "int", "SetParent", "hwnd", $hWnd, "hwnd", $oGUI)
    WinMove($hWnd, "", $x1, $y1, $x2, $y2)
    WinSetState($hWnd, "", $oFlag)
EndIf
Return $hWnd
EndFunc
Edited by AzKay
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

First I had to get AnyGUI and now I need to install the Mozilla Control.

AzKay, it's probably pretty amazing, but I am not going to install this Mozilla Control. :) lol pl0x.

The mozilla control is fun to mess with though ;)

Can't test, but judging from the code, looks pretty good!

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...