Jump to content

WinEdit


Vindicator209
 Share

Recommended Posts

This is my little program that I shimmied up and prettified. It simply takes advantage of all the Win...() and Control...() functions.

A few HotKeys I forget to mention sometimes, you'll have to look at the script though

Here it is in action! (Skin and all!)

Posted Image

[ESC] - Escape!

[F5] - Hides SELECTED WINDOW

[F6] - Shows SELECTED WINDOW

[F7] - Hides WinEdit

[F8] - Shows WinEdit

[F9] - Displays this list again.

[F10] - If you have a control selected, make it come to your mouse

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Skin\windowblinds.ico
#AutoIt3Wrapper_Res_Comment=WinEdit by Kyle Moy
#AutoIt3Wrapper_Res_Description=WinEdit by Kyle Moy
#AutoIt3Wrapper_Res_Fileversion=1.0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <Array.au3>
HotKeySet("{F5}", "hide")
HotKeySet("{F6}", "show")
HotKeySet("{F7}", "open")
HotKeySet("{F8}", "close")
HotKeySet("{F10}", "follow")
HotKeySet("{ESC}", "esca")
HotKeySet("{F9}", "list")
$Selected = "null"
$Title = Random(10000, 99999, 1)
$window = GUICreate($Title, 486, 336, 197, 123, $WS_POPUP, $WS_EX_TOOLWINDOW)
GUISetBkColor(0x808080)
$Titlebar = GUICtrlCreatePic("Skin\Title.bmp", 0, 0, 200, 30)
$Bar = GUICtrlCreatePic("Skin\Bar.bmp", 200, 0, 185, 30)
$Minimize = GUICtrlCreatePic("Skin\_.bmp", 385, 0, 25, 30)
$Maximize = GUICtrlCreatePic("Skin\M.bmp", 410, 0, 25, 30)
$Exit = GUICtrlCreatePic("Skin\X.bmp", 435, 0, 42, 30)
$Corner = GUICtrlCreatePic("Skin\Corner.bmp", 477, 0, 9, 30)
$Bottom = GUICtrlCreatePic("Skin\Bottom.bmp", 0, 325, 486, 10)
$LSide = GUICtrlCreatePic("Skin\Siding.bmp", 0, 30, 10, 296)
$RSide = GUICtrlCreatePic("Skin\Siding.bmp", 476, 30, 10, 296)
$Combo1 = GUICtrlCreateCombo("Window List", 75, 35, 306, 25)
$Button9 = GUICtrlCreateButton("Select", 380, 35, 91, 21, 0)
$Button10 = GUICtrlCreateButton("Refresh", 15, 35, 61, 21, 0)
$Tab1 = GUICtrlCreateTab(15, 55, 456, 266)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("Window Tools")
$Group1 = GUICtrlCreateGroup("Transparency", 20, 85, 441, 51)
$Slider1 = GUICtrlCreateSlider(30, 105, 386, 21)
GUICtrlSetLimit(-1, 254, 0)
GUICtrlSetData($Slider1, 254)
$Input1 = GUICtrlCreateInput("0", 420, 105, 36, 21, $ES_READONLY)
GUICtrlSetLimit(-1, 3)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Hide", 20, 145, 186, 46)
$Button11 = GUICtrlCreateButton("Show", 30, 160, 81, 21, 0)
$Button12 = GUICtrlCreateButton("Hide", 115, 160, 81, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Alert", 210, 145, 246, 46)
$Button13 = GUICtrlCreateButton("Activate", 215, 160, 81, 21, 0)
$Button14 = GUICtrlCreateButton("Flash", 300, 160, 61, 21, 0)
$Button15 = GUICtrlCreateButton("Lock On Top", 365, 160, 81, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("Name", 20, 200, 191, 51)
$Input2 = GUICtrlCreateInput("Name", 30, 220, 101, 21)
$Button16 = GUICtrlCreateButton("Change", 135, 220, 66, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group5 = GUICtrlCreateGroup("Position", 215, 200, 241, 51)
$Input3 = GUICtrlCreateInput("X", 225, 220, 71, 21)
$Input4 = GUICtrlCreateInput("Y", 300, 220, 71, 21)
$Button17 = GUICtrlCreateButton("Move", 375, 220, 71, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group6 = GUICtrlCreateGroup("Size", 20, 260, 266, 51)
$Input5 = GUICtrlCreateInput("Height", 30, 280, 76, 21)
$Input6 = GUICtrlCreateInput("Width", 110, 280, 76, 21)
$Button18 = GUICtrlCreateButton("Resize", 190, 280, 86, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group7 = GUICtrlCreateGroup("Info", 290, 260, 166, 51)
$Label1 = GUICtrlCreateLabel("WinEdit (C) 2008 Kyle Moy", 300, 280, 143, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet2 = GUICtrlCreateTabItem("Control Tools")
$Group8 = GUICtrlCreateGroup("Select Control", 20, 85, 441, 56)
$Combo2 = GUICtrlCreateCombo("Press Refresh to load", 30, 105, 370, 25)
$contRefresh = GUICtrlCreateButton("Refresh", 400, 105, 50, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group9 = GUICtrlCreateGroup("Control Status", 20, 145, 176, 51)
$Button19 = GUICtrlCreateButton("Enable", 30, 165, 76, 21, 0)
$Button20 = GUICtrlCreateButton("Disable", 110, 165, 76, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group10 = GUICtrlCreateGroup("Control Visibility", 200, 145, 261, 51)
$Button21 = GUICtrlCreateButton("Hide", 210, 165, 76, 21, 0)
$Button22 = GUICtrlCreateButton("Show", 290, 165, 76, 21, 0) ;===============
$Button23 = GUICtrlCreateButton("Focus", 370, 165, 81, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group11 = GUICtrlCreateGroup("Control Set Text", 20, 200, 161, 51)
$Input7 = GUICtrlCreateInput("None", 30, 220, 81, 21)
$Button24 = GUICtrlCreateButton("Set", 115, 220, 56, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group12 = GUICtrlCreateGroup("Control Send", 185, 200, 186, 51)
$Input8 = GUICtrlCreateInput("Text", 195, 220, 111, 21)
$Button25 = GUICtrlCreateButton("Send", 310, 220, 51, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group13 = GUICtrlCreateGroup("Control Click", 375, 200, 86, 51)
$Button26 = GUICtrlCreateButton("Click", 385, 220, 66, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group14 = GUICtrlCreateGroup("Control Properties", 20, 255, 441, 51)
$Input9 = GUICtrlCreateInput("X", 30, 275, 81, 21)
$Input10 = GUICtrlCreateInput("Y", 115, 275, 81, 21)
$Input11 = GUICtrlCreateInput("Width", 200, 275, 76, 21)
$Input12 = GUICtrlCreateInput("Height", 280, 275, 76, 21)
$Button27 = GUICtrlCreateButton("Change", 360, 275, 91, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
$win = WinList()
_ArraySort($win, 0, 1, $win[0][0], 2)
For $i = 1 To $win[0][0]
    If $win[$i][0] <> "" And IsVisible($win[$i][1]) Then
        GUICtrlSetData($Combo1, $win[$i][0])
    EndIf
Next
WinSetOnTop($Title, "", 1)
While 1
    GUICtrlSetData($Input1, GUICtrlRead($Slider1))
    WinSetTrans($Selected, "", GUICtrlRead($Slider1))
    $Titlei = $Title
    $Title = Random(10000, 99999, 1)
    WinSetTitle($Titlei, "", $Title)
    $nMsg = GUIGetMsg()
    HoverButton($Minimize, $Title, "Skin\_over.bmp", "Skin\_.bmp")
    HoverButton($Maximize, $Title, "Skin\Mover.bmp", "Skin\M.bmp")
    HoverButton($Exit, $Title, "Skin\Xover.bmp", "Skin\X.bmp")
    Switch $nMsg
        Case $Button27
            ControlMove($Selected, "", GUICtrlRead($Combo2), GUICtrlRead($Input9), GUICtrlRead($Input10), GUICtrlRead($Input11), GUICtrlRead($Input12))
        Case $Button26
            ControlClick($Selected, "", GUICtrlRead($Combo2))
        Case $Button25
            ControlSend($Selected, "", GUICtrlRead($Combo2), GUICtrlRead($Input8))
        Case $Button24
            ControlSetText($Selected, "", GUICtrlRead($Combo2), GUICtrlRead($Input7))
        Case $Button23
            ControlFocus($Selected, "", GUICtrlRead($Combo2))
        Case $Button22
            ControlShow($Selected, "", GUICtrlRead($Combo2))
        Case $Button21
            ControlHide($Selected, "", GUICtrlRead($Combo2))
        Case $Button20
            ControlDisable($Selected, "", GUICtrlRead($Combo2))
        Case $Button19
            ControlEnable($Selected, "", GUICtrlRead($Combo2))
        Case $contRefresh
            GUICtrlDelete($Combo2)
            $Combo2 = GUICtrlCreateCombo("Controls", 30, 105, 370, 25)
            $listcon = ""
            $classlist = WinGetClassList($Selected, "")
            $controls = StringSplit($classlist, @LF)
            $counted = $controls[0]
            For $y = 1 To $controls[0]
                If StringLen($controls[$y]) > 1 Then
                For $i = 1 To $counted - ($counted - $y)
                    $f = $y-$i
                    ;MsgBox(0,"",$y &"-"&$i &"="&$f)
                    If $controls[$y] <> $controls[$f] Then
                        $listcon = $listcon & "|" & $controls[$y] & $i
                        ExitLoop
                    EndIf
                Next
                EndIf
            Next
            GUICtrlSetData($Combo2, $listcon, "Controls")
            GUICtrlSetData($Combo2, "- Controls -", "- Controls -")
        Case $Button18
            $winpos = WinGetPos($Selected)
            WinMove($Selected, "", $winpos[0], $winpos[1], GUICtrlRead($Input5), GUICtrlRead($Input6))
        Case $Button17
            WinMove($Selected, "", GUICtrlRead($Input3), GUICtrlRead($Input4))
        Case $Button16
            If $Selected = "null" Then
                MsgBox(48, "Error!", "Please select a window first!")
            Else
                WinSetTitle($Selected, "", GUICtrlRead($Input2))
                GUICtrlSetData($Combo1, GUICtrlRead($Input2))
            EndIf
        Case $Button15
            WinSetOnTop($Selected, "", 1)
            WinSetOnTop($Title, "", 1)
        Case $Button14
            WinFlash($Selected)
        Case $Button13
            WinActivate($Selected)
        Case $Button12
            WinSetState($Selected, "", @SW_HIDE)
        Case $Button11
            WinSetState($Selected, "", @SW_SHOW)
        Case $Button10
            GUICtrlDelete($Combo1)
            $Combo1 = GUICtrlCreateCombo("Window List", 75, 35, 306, 25)
            $win = WinList()
            _ArraySort($win, 0, 1, $win[0][0], 2)
            For $i = 1 To $win[0][0]
                If $win[$i][0] <> "" And IsVisible($win[$i][1]) Then
                    GUICtrlSetData($Combo1, $win[$i][0])
                EndIf
            Next
        Case $Button9
            $Selected = GUICtrlRead($Combo1)
        Case $Minimize
            WinSetState($window, "", @SW_HIDE)
        Case $Exit
            Exit
        Case $Bar
            Drag()
        Case $Titlebar
            Drag()
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Func Drag()
    DllCall("user32.dll", "int", "ReleaseCapture")
    DllCall("user32.dll", "int", "SendMessage", "hWnd", $window, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0)
EndFunc   ;==>Drag
Func IsVisible($handle)
    If BitAND(WinGetState($handle), 2) Then
        Return 1
    Else
        Return 0
    EndIf

EndFunc   ;==>IsVisible
Func HoverButton($z_control, $z_winname, $z_over, $z_idle)
    $Pos = MouseGetPos() ; mouse position
    $Control = ControlGetPos($z_winname, "", $z_control); this is to find out window's button
    $win = WinGetPos($z_winname, "") ; you will need to add the window's coordinates to the checking
    If $Pos[0] > $Control[0] + $win[0] Then ;Check if the mouse is PAST the X position of the button
        If $Pos[0] < $Control[0] + $win[0] + $Control[2] Then ; Check now if its too far off ( after the button )
            If $Pos[1] > $Control[1] + $win[1] Then ; Check with the Y position
                If $Pos[1] < $Control[1] + $win[1] + $Control[3] Then ;once again, if its too far off
                    GUICtrlSetImage($z_control, $z_over) ; After our tedious checking, and the mouse IS over our button here, then change our image!
                Else
                    GUICtrlSetImage($z_control, $z_idle) ; If not, then remain the same (set it to original again
                EndIf
            Else
                GUICtrlSetImage($z_control, $z_idle)
            EndIf
        Else
            GUICtrlSetImage($z_control, $z_idle)
        EndIf
    Else
        GUICtrlSetImage($z_control, $z_idle)
    EndIf
EndFunc   ;==>HoverButton
Func esca()
    Exit
EndFunc   ;==>esca
Func hide()
    WinSetState($Selected, "", @SW_HIDE)
    SoundSetWaveVolume(0)
EndFunc   ;==>hide
Func show()
    WinSetState($Selected, "", @SW_SHOW)
    SoundSetWaveVolume(100)
EndFunc   ;==>show
Func open()
    WinSetState($Title, "", @SW_SHOW)
EndFunc   ;==>open
Func close()
    WinSetState($Title, "", @SW_HIDE)
EndFunc   ;==>close
Func list()
    ToolTip("F5 - Hides Window" & @CRLF & "F6 - Shows Window" & @CRLF & "F7 - Opens Selection Window" & @CRLF & "F8  - Hides Selection Window" & @CRLF & "ESC - Exits Program" & @CRLF & "F9 - Opens Keys List", Default, Default, "HotKeys List - WinEdit", 1, 0)
    Sleep(3500)
    ToolTip("")
EndFunc   ;==>list
Func follow()
    $mPos = MouseGetPos()
    WinMove($Selected,"",0,0)
    ControlMove($Selected,"",GUICtrlRead($Combo2),$mPos[0] - 10,$mPos[1] - 30)
EndFunc

You can't see the skin without the images though, but heres the compiled version + skin package

ARRGH stupid upload limit! sorry, but I had to upload somewhere else:

http://www.megaupload.com/?d=JOZIAQV1

Oh, P.S. Yes, thats my own hover button script there =D I'm very proud of it, even though I'm probably not the first to think of it

EDIT: I found 1 problem, but I fixed it in the script, I forgot to use $title instead of "WinEdit"....

I made it constantly change its title so that it cant be targeted =P

Edited by VindicatorOmega

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

Thanks! I'ts not the most complicated nor useful program, but its fun to take out stuff from it and put it into your own script, I.E. how to make your own skin, drag, stuff like that...

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

Well, those are just the names Koda put in, I generally only need to look at it once, so it doesn't give me too large of a problem.... but I suppose it would make refering to controls easier

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

  • 2 weeks later...

I made a _GUICtrlSetOnHover function using your provided HoverButton function :party:

Global $Hover = 0
Func _GUICtrlSetOnHover ( $g_Control , $g_Name , $g_OnHoverFunc , $g_OffHoverFunc ) ;thank you whoever made WinEdit!
    $g_Pos = MouseGetPos() ; mouse position
    $g_Control = ControlGetPos($g_Name, "", $g_Control); this is to find out window's button
    $g_win = WinGetPos($g_Name, "") ; you will need to add the window's coordinates to the checking
    If $g_Pos[0] > $g_Control[0] + $g_win[0] Then ;Check if the mouse is PAST the X position of the button
        If $g_Pos[0] < $g_Control[0] + $g_win[0] + $g_Control[2] Then ; Check now if its too far off ( after the button )
            If $g_Pos[1] > $g_Control[1] + $g_win[1] Then ; Check with the Y position
                If $g_Pos[1] < $g_Control[1] + $g_win[1] + $g_Control[3] Then ;once again, if its too far off
                    ;GUICtrlSetImage($z_control, $z_over) ; After our tedious checking, and the mouse IS over our button here, then change our image!
                    If $Hover = 0 Then
                        Call ( $g_OnHoverFunc )
                        $Hover = 1
                    EndIf
                Else
                    ;GUICtrlSetImage($z_control, $z_idle) ; If not, then remain the same (set it to original again
                    If $Hover = 1 Then
                        Call ( $g_OffHoverFunc )
                        $Hover = 0
                    EndIf
                EndIf
            Else
                ;GUICtrlSetImage($z_control, $z_idle)
                If $Hover = 1 Then
                        Call ( $g_OffHoverFunc )
                        $Hover = 0
                EndIf
            EndIf
        Else
            ;GUICtrlSetImage($z_control, $z_idle)
            If $Hover = 1 Then
                        Call ( $g_OffHoverFunc )
                        $Hover = 0
            EndIf
        EndIf
    Else
        ;GUICtrlSetImage($z_control, $z_idle)
        If $Hover = 1 Then
            Call ( $g_OffHoverFunc )
            $Hover = 0
        EndIf
    EndIf
EndFunc

And yes, you DO need the Global $Hover = 0 bit so the off func doesn't get called 4 times (if you don't have the variable checking, the function is continually called :\ )

Sadly, it'll only work with one control at a time, if you have more than that then strange things start happening :)

Really nice script man :)

Edited by SxyfrG

My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website

Link to comment
Share on other sites

@SxyfrG

Thats really nice! I'm not familiar with Call() cause I never used it, but it works fine!

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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