AutoGUI - Script Editor, GUI Designer, Debugger and Tools

Old Topics related to the original "AutoGUI" ahk script editor.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI - GUI Designer and Script Editor

26 Dec 2015, 17:30

Version 1.1.2 released.
  • Fixed some errors
  • Added a new tool: Expressive, a regular expression utility
  • Redesigned Window Cloning Tool
Expressive.png
(45.58 KiB) Downloaded 11 times
Download
Edit: reuploaded screenshot.
Last edited by Alguimist on 04 Aug 2021, 12:28, edited 1 time in total.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI - GUI Designer and Script Editor

26 Dec 2015, 17:33

@kunkel321: The error was fixed.

@huyaowen: Use the Window Cloning Tool to import the GUI.
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: AutoGUI - GUI Designer and Script Editor

26 Dec 2015, 21:52

Nice work on "Expressive"! :D
it's... impressive. 8-)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

Re: AutoGUI - GUI Designer and Script Editor

27 Dec 2015, 07:52

expressive is super awesome!!
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
RazorHalo
Posts: 45
Joined: 21 Dec 2015, 21:23

Re: AutoGUI - GUI Designer and Script Editor

28 Dec 2015, 00:41

First I would just like to say this is an awesome script and I truly appreciate all the work that must have gone into it. I have only been using AHK for a couple of months now, so I am still learning.

I'm not sure if it's just me missing something, but if I save a GUI that I have been working on, and then Reload that GUI using the OPEN GUI file option to work on again, as soon as I do any action with the window, it refreshes the code window and ends up resetting the script options to their defaults, and removes all the options, v-Var, and g-Labels associated with all the controls. I do notice that if I open the GUI, and then open the properties window right away it looks to me as if it doesn't reload the control properties, except for their Text Labels, and none of the window properties either.

Also, I understand that it reloads all the GUI commands up until the "; End of the GUI section" delimiter, but that erases anything I want to do in the auto execute section before I load the GUI. I realize it was stated that it will eventually just update the lines that are affected, but I am finding it difficult to not have any non GUI building code in the auto execute section. Unless I'm doing things in the wrong order, any pointers would be appreciated.

RH
User avatar
oldbrother
Posts: 265
Joined: 23 Oct 2013, 05:08

Re: AutoGUI - GUI Designer and Script Editor

29 Dec 2015, 09:39

Found some errors:

1. Undo and Redo in the Edit menu do not work for me.
2. The icons of horizontally space and vertical space in the selection menu are reversed.
111.jpg
111.jpg (18.49 KiB) Viewed 17681 times
3. when drag a control, the fields on the Properties window will be updated, except the control name.
I suggest that all the fields on the Properties window should be updated when left click on a control.
2222.jpg
4. I don't know what I did, I got duplicated codes:
3333.jpg


Windows XP SP3 (my company doesn't have money to upgrade all the computers to windows 10 :cry: ).

Thanks!
Last edited by oldbrother on 29 Dec 2015, 13:26, edited 4 times in total.
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: AutoGUI - GUI Designer and Script Editor

29 Dec 2015, 10:05

:bravo: While I'm overall liking "Expressive" (especially the highlighting aspect) I was wondering if there was a way to have it dump-out the AutoHotKey syntax that would be needed to run the expression in a script.

Thanks for all your work on this! It's got some awesome stuff!
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
User avatar
fischgeek
Posts: 433
Joined: 29 Jan 2014, 21:39

Re: AutoGUI - GUI Designer and Script Editor

29 Dec 2015, 10:42

oldbrother wrote:Windows XP SP3.
:shock:
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: AutoGUI - GUI Designer and Script Editor

29 Dec 2015, 19:08

fischgeek wrote:
oldbrother wrote:Windows XP SP3.
:shock:
awwwwyeaaahhh hahaha :lol:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
PumpkinShortie
Posts: 10
Joined: 14 Nov 2015, 13:17

Re: AutoGUI - GUI Designer and Script Editor

30 Dec 2015, 14:55

This looks great. I gave it a try. I encountered a few issues.

Recreating the window from source will cause the text in text labels to be lost the first time. This can be reproduced.
The snapping to grid behavior for default size text labels v.s. edit box, hotkey boxes, drop down lists (and probably other things too) makes them misaligned. Their default snapping behavior should be so the text for everything is at the same height by moving the text labels down a few pixels.
The snapping to grid behavior for group boxes is odd. It doesn't really align to the grid. The line around the box should align with the grid.
The default height for edit boxes and hotkey boxes should be 21 pixels.
It is impossible to drag the mouse to select controls inside a group box.
It doesn't seem possible to numerically edit the size of controls other than by the code itself, which requires redrawing the preview window every time.
Coco
Posts: 771
Joined: 29 Sep 2013, 20:37
Contact:

Re: AutoGUI - GUI Designer and Script Editor

30 Dec 2015, 16:34

PumpkinShortie wrote:The default height for edit boxes and hotkey boxes should be 21 pixels.
I think it should be R1(Gui, Add, Edit, w%DefaultWidth% r1) and let Windows(or AutoHotkey) calculate it internally. Using a fix height is not advisable especially if the user is using a custom Windows theme.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI - GUI Designer and Script Editor

31 Dec 2015, 05:56

Version 1.1.3 fixes a few more bugs.

The Properties dialog is updated when a control is clicked, as suggested by oldbrother.
Undo and Redo in the Edit menu do not work for me.
The Edit menu is for the script editor only.
It is impossible to drag the mouse to select controls inside a group box.
While this issue is not fixed, individually select each control with Ctrl + click.
Last edited by Alguimist on 31 Dec 2015, 08:16, edited 1 time in total.
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI - GUI Designer and Script Editor

31 Dec 2015, 06:07

Additional usage information
Keyboard shortcuts not exposed in the menus:

GUI Designer:
- F2: Show the Change Text dialog
- F3: Highlight the active control (the last created or clicked control)
- Shift + arrow keys: Change the size of the active control

Script Editor:
- Ctrl + Numpad +: Increase font size
- Ctrl + Numpad -: Decrease font size
- Ctrl + Numpad 0: Reset font size
- Ctrl + Tab: Switch to the next tab
- Ctrl + D: Duplicate selection or current line
- Ctrl + L: Cut current line
- Ctrl + T: Switch the current line position with the previous line
- Ctrl + Backspace: Delete to the beginning of the current word
- Ctrl + Delete: Delete to the end of the current word
- Ctrl + Shift + Backspace: Delete to the beginning of the line
- Ctrl + Shift + Delete: Delete to the end of the line
- Alt + Shift + arrow keys, or Alt + left-click: Rectangular selection
User avatar
SnowFlake
Posts: 368
Joined: 28 Apr 2015, 05:41
Contact:

Re: AutoGUI - GUI Designer and Script Editor

31 Dec 2015, 19:36

@Alguimist, will you add auto updater to AutoGUI?
:yawn:
User avatar
huyaowen
Posts: 109
Joined: 28 Jul 2014, 01:15

Re: AutoGUI - GUI Designer and Script Editor

02 Jan 2016, 19:03

Add two buttons called a and b,then delete button b and drag mouse select from a to b.one shape will display in the form as follow.
BaiduShurufa_2016-1-3_7-57-19.png
User avatar
RazorHalo
Posts: 45
Joined: 21 Dec 2015, 21:23

Re: AutoGUI - GUI Designer and Script Editor

05 Jan 2016, 22:40

Ok, so this is a great design tool which will greatly speed up creating GUI's. I am in the process of creating a program to organize and keep track of our CNC machines tooling where I work, which will include all sorts of goodies, but consequently will end up having hundreds of controls, hence why this will be such a great tool for creating such a program.

The problem I have run in to is that it didn't yet have the functionality to reload a saved GUI in its entirety to continue where I left off. So I've made some modifications that now let you open a saved script and completely reload all options, variables, and controls.

Due to the way AutoGUI formats the code, scripts that have not been created with AutoGUI may need to be rearranged to fit this format to be loaded correctly (like having all GUI building done at the beginning and separated from the rest of the code with the "; End of the GUI section" delimiter for eg.)

I have used the latest version 1.1.3, and tested it as much as I can and have obtained consistent results with loading GUI's. I'm sure that my code could probably be a little tighter but I've only been using AHK for a couple of months and am still learning so any upgrades or corrections to the code I have added would be welcome.

@Alguimist
Maybe this feature could be added into a future version of AutoGUI ?



Use the "Open GUI..." command from the File Menu (I removed the MsgBox about using the Window Cloning tool - Line 2849 in original script myself)
and make the following changes to AutoGUI.ahk and Properties.ahk


********************************************
CHANGES TO AUTOGUI.AHK
********************************************
Add this to the end of the list (line 61) of Global Variables:
GuiLoaded

Replace the Function "ParseScript(Source)" with this code:

Code: Select all

ParseScript(Source) {
    m.Source := ""
	
	;Added to disable these vars unless in the script beibg loaded -RH
	Script.NoEnv := 0
	Script.Warn := ""
	Script.SingleInstance := ""
	Script.WorkingDir := ""
	Script.SendMode := ""
	hAnchor := {}
	Loop Parse, Source, `n
    {
		CtlLoad := A_LoopField
		IfInString A_LoopField, %Delimiter% ;Detects when delimiter is reached - RH
			GuiLoaded = 1
		IfInString A_LoopField, hwnd ;Removes hwnd varible from string used to get control options, otherwise controls are not registered correctly -RH
		{
			CtlLoad := ""
			Loop Parse, A_LoopField, %A_Space%
				IfNotInString A_LoopField, hWnd
					CtlLoad .= " " . A_LoopField
		}
		IfInString A_LoopField, Gui Add`, Tab2`, ;Sets the Tabindex and Tabcontrol numbers for the current controls -RH
			fTabControl++
		If (RegExMatch(A_LoopField, "iO)^\s*?Gui\s*\,?\s*(\w+\:)?\s?Tab,\s?(?P<TabIndex>([\w\+\-\s]+))", Rex))
			fTabIndex := RegExReplace(Rex.TabIndex, "[\r\n]*")
	
		If !Guiloaded
		{
			; Get Window Events in script to set proper checkboxes -RH
			IfInString A_LoopField, Close: 
				g.Window.GuiClose := 1
			IfInString A_LoopField, Escape: 
				g.Window.GuiEscape := 1
			IfInString A_LoopField, Size:
				g.Window.GuiSize := 1
			IfInString A_LoopField, ContextMenu: 
				g.Window.GuiContextMenu := 1
			IfInString A_LoopField, DropFiles:
				g.Window.GuiDropFiles := 1
			IfInString A_LoopField, OnClipboardChange: 
				g.Window.OnClipboardChange := 1
			
			;Get Script Options to set correct Checkboxes and set correct item in dropdown choices -RH
			IfInString A_LoopField, #NoEnv 
				Script.NoEnv := 1
			IfInString A_LoopField, #Warn
				If (SubStr(A_LoopField,9) = "")
					Script.Warn := "MsgBox"
				Else
					Script.Warn := RegExReplace(SubStr(A_LoopField,9), "[\r\n]*")
			IfInString A_LoopField, #SingleInstance 
				Script.SingleInstance := SubStr(A_LoopField,17)
			IfInString A_LoopField, #NoTrayIcon 
				Script.NoTrayIcon := 1
			IfInString A_LoopField, SetWorkingDir
				{
				Script.WorkingDir := SubStr(A_LoopField,15)
				SetWorkingDir % RegExReplace(SubStr(A_LoopField,15), "[\r\n]*")
				}
			IfInString A_LoopField, SendMode
				Script.SendMode := RegExReplace(SubStr(A_LoopField,10), "[\r\n]*")
			IfInString A_LoopField, SetBatchLines 
				Script.NoBatchLines := 1
			IfInString A_LoopField, ListLines 
				Script.ListLinesOff := 1
			IfInString A_LoopField, #Persistent 
				Script.Persistent := 1
			IfInString A_LoopField, Menu Tray`, UseErrorLevel
				Script.IgnoreMenuErrors := 1
								
			;Get Font Info,  for some reason needs to be applied 2 lines after it appears in script to be be applied to the correct control - RH
			If (fft = A_Index-2)
				{
				g[hwnd].fontoptions := flfont
				fft = 0
				}
			IfInString A_LoopField, Font`,
				{
				flFont := Substr(A_Loopfield,11)
				fft := A_Index
				}
			}
			
        ; Menu item
        If (RegExMatch(A_LoopField, "iO)^Menu\s*\,?\s*(?P<MenuName>([\w]+)),\s?Add(,\s?(?P<MenuItem>.*),\s?(?P<GoSub>([\w\:]+)))?", Rex)) {
            m.Source .= "Menu " . Rex.MenuName . ", Add, " . Rex.MenuItem . ", " . Rex.GoSub . "`n"
            Menu % Rex.MenuName, Add, % Rex.MenuItem, % Rex.GoSub
        } Else If (RegExMatch(A_LoopField, "iO)^Menu\s*\,?\s*(?P<MenuName>([\w]+)),\s?Add", Rex)) {
            m.Source .= "Menu " . Rex.MenuName . ", Add`n"
            Menu % Rex.MenuName, Add
        }

		;Added to Load Window options - RH
		If (RegExMatch(A_LoopField, "iO)^\s*?Gui\s*\,?\s*(\w+\:)?\s?New,\s?(?P<Options>([\w\+\-\s]+))", Rex)) {
			g.Window.Options := RegExReplace(Rex.Options, "([\,\s]?g\w+|[\,\s]?v\w+)")
			g.Window.Options := StrReplace(g.window.options, "+OwnDialo", "+OwnDialogs")
			IfInString A_LoopField, : New
				g.Window.Name := SubStr(A_LoopField, 5,InStr(A_LoopField, ":")-5)
			Loop Parse, % g.Window.Options, %A_Space% 
				{
				IfInString A_LoopField, Label
					g.Window.Label := SubStr(A_LoopField,6)
				IfInString A_LoopField, hwnd
					g.Window.hWndvar := SubStr(A_LoopField,5)
				}
			g.Window.Options := StrReplace(g.window.options, "Label"g.window.label)
			g.Window.Options := StrReplace(g.window.options, "hWnd"g.window.hWndVar)
		}
		
			IfInString A_LoopField, Gui Color`,    ;Loads the background Colour -RH
				g.Window.Color := SubStr(A_LoopField,12)
			IfInString A_LoopField,	Menu Tray`, Icon	;Loads the Tray Icon - RH
				Loop Parse, A_LoopField, `,
					{
					If A_Index = 3
						g.Window.Icon := SubStr(A_LoopField,2)
					If A_Index = 4
						g.Window.IconIndex := SubStr(A_LoopField,2)
					}
		
        ; Control
        If (RegExMatch(CtlLoad, "iO)^\s*?Gui\s*\,?\s*(\w+\:)?\s?Add,\s?(?P<Type>([A-Za-z]+)\d?),\s?(?P<Options>([\w\+\-\s]+))(,\s?(?P<Text>(.+)))?", Rex)) {
            Options := RegExReplace(Rex.Options, "([\,\s]?g\w+|[\,\s]?v\w+)")
			TabPos := [fTabIndex, fTabControl] ; Controls Tab placement of controls -RH

			IfInString A_LoopField, Gui Add`, Tab2`,
				TabPos := ""

			If (Rex.Type = "StatusBar" && StatusBarExist()) {
                GuiControl %Child%: Show, msctls_statusbar321
            } Else {
				If fTabIndex  ; Puts the controls into the correct tab in gui window - RH
					Gui %Child%: Tab, % TabPos[1], % TabPos[2]
				Gui %Child%: Add, % Rex.Type, % "hWndhWnd " . Options, % Rex.Text
            }

            If (Rex.Type = "TreeView") {
                Parent := TV_Add("TreeView")
                TV_Add("Child", Parent)
            }
			
			;Added to load properties - RH
			fMatch := "gvxywh0E"
			Loop parse, A_LoopField, `,
				If A_index = 3
					strf := A_LoopField
			Loop parse, strf, %A_Space% ;this loop makes sure these options arent stores as vVar or gLabel - RH
				{						;and gets the hWndVar, style, exstyle values
				If Substr(A_Loopfield,1,1) = "v"
					If (A_LoopField != "vscroll" OR A_LoopField != "vertical")
						fvVar := Substr(A_Loopfield,2)
					Else
						fOptions .= A_LoopField . " "
					
				If Substr(A_Loopfield,1,1) = "g"
					If (A_LoopField != "grid")
						fgLabel := Substr(A_Loopfield,2)
					Else
						fOptions .= A_LoopField . " "
				If Substr(A_Loopfield,1,4) = "hwnd"
					fhwndVar := Substr(A_Loopfield,5)
				If Substr(A_Loopfield,1,1) = "0"
						fStyle := A_LoopField
				If Substr(A_Loopfield,1,1) = "E"
						fExStyle := A_LoopField
				
				IfNotInString fMatch, % Substr(A_Loopfield,1,1)
					fOptions .= A_LoopField . " "
				}
			If fhWndVar  ;Stores the hwndvariable and hwnd to attach an anchor later if one exists - RH
				ObjRawSet(hAnchor, fhWndVar, hWnd)
			
            GuiControlGet c, %Child%: Pos, %hWnd%
            g.Register(hWnd, Rex.Type, "", Rex.Text, cx, cy, cw, ch, fhWndVar, fvVar, fgLabel, fOptions, fStyle, fExStyle, flFont, "", TabPos)
            g.ControlList.Insert(hWnd)
			
			fExStyle := "" ;Resets all the control option variables for the next control - RH
			fStyle := ""
			fhwndVar := ""
			fvVar := ""
			fgLabel := ""
			fOptions := ""
			strf := ""
        }
		
		IfInString A_LoopField, Anchor(  ;Detects if there are anchored controls, sets the anchor flag and loads the anchor coords into the controls variables list -RH
		{
			StringReplace scr, A_Loopfield, `", , All ;"; extra quote in comment stops of syntax hilighting incorretly for the following lines :) - RH
			(RegExMatch(scr, "iO)^\s*?Anchor\s*\(?\s*(?P<CtlhWndVar>([\w\+\-\s]+)),\s?(?P<Anchor>(.+))", Rex))
			g.Anchor := True
			g[hAnchor[rex.ctlhwndvar]].Anchor := SubStr(Rex.Anchor,1,-2)
		}

        If (RegExMatch(A_LoopField, "iO)^Gui\s?\,?\s?Show,\s?(?P<Options>([\w\s]+)),\s?(?P<Title>(.+))", Rex)) {
            Gui %Child%: Show, % Rex.Options, % Rex.Title
			g.Window.Title := Rex.Title
        }
    }
	
	SetWorkingDir %A_ScriptDir%

    If (m.Source != "") {
        m.Source .= "Gui Menu, MenuBar`n"
        Gui %Child%: Menu, MenuBar
    }

    If (g.ToolbarIcons.MaxIndex()) {
        AddToolbar(g.ToolbarIL, g.ToolbarItems, g.ToolbarOptions)
    }
	
    g.UpdateSource()
    Properties_Reload()
}

**********************************************************
Changes to Properties.ahk
**********************************************************
Replace the label "ShowProperties:" with this code:

Code: Select all

ShowProperties:
    If (!WinExist("ahk_id " . hPropWnd)) {
    Gui Properties: New, LabelProperties hWndhPropWnd -MinimizeBox Owner%Child%
    SetIconEx(hPropWnd, IconLib, 24)

    ClassNNList := ""
    For Each, Item In g.ControlList {
        ClassNNList .= g[Item].ClassNN . "|"
    }

    Gui Add, Picture, gBlinkControlBorder x12 y13 w16 h16 Icon5, % IconLib
    Gui Add, DropDownList, hWndhCbxClassNN vCbxClassNN gOnDropDownChange x40 y12 w203, % "Window||" . ClassNNList
    Gui Add, Button, hWndhReloadBtn gReloadSub x248 y11 w23 h23
    GuiButtonIcon(hReloadBtn, IconLib, 90, "L1 T1")

    Try {
        Gui Add, % "Tab3", hWndhPropTab vCurrentTab x6 y41 w270 h303 AltSubmit, General|Options|Window|Events|Script
    } Catch {
        Gui Add, Tab2, hWndhPropTab vCurrentTab x6 y41 w270 h303 AltSubmit, General|Options|Window|Events|Script
    }
    Control Style, 0x54010040,, ahk_id %hPropTab%

    Gui Tab, 1 ; General
        Gui Add, GroupBox, vGrpText x16 y65 w250 h48, Text
        Gui Add, Edit, vEdtText x26 y83 w230 h21

        Gui Add, GroupBox, x16 y116 w250 h99, Variables
        Gui Add, Text, x26 y132 w60 h21 +0x200, hWnd var:
        Gui Add, Edit, vEdtHWndVar x95 y132 w160 h21
        Gui Add, Text, vTxtVVar x26 y158 w60 h21 +0x200, v-Var:
        Gui Add, Edit, vEdtvVar x95 y158 w160 h21
        Gui Add, Text, vTxtGLabel x26 y184 w60 h21 +0x200, g-Label:
        Gui Add, Edit, vEdtgLabel x95 y184 w160 h21

        Gui Add, GroupBox, x16 y217 w250 h74, Position
        Gui Add, Text, x57 y232 w16 h22 +0x200, &X:
        Gui Add, Edit, vEdtX x75 y232 w50 h21
        Gui Add, UpDown, gAdjustPosition Range-65536-65536, 1
        Gui Add, Text, x157 y232 w16 h22 +0x200, &Y:
        Gui Add, Edit, vEdtY x175 y232 w50 h21
        Gui Add, UpDown, gAdjustPosition Range-65536-65536, 1
        Gui Add, Text, x57 y260 w16 h22 +0x200, &W:
        Gui Add, Edit, vEdtW x75 y260 w50 h21
        Gui Add, UpDown, gAdjustPosition Range-65536-65536, 1
        Gui Add, Text, x157 y260 w16 h22 +0x200, &H:
        Gui Add, Edit, vEdtH x175 y260 w50 h21
        Gui Add, UpDown, gAdjustPosition Range-65536-65536, 1

        Gui Add, GroupBox, x16 y293 w250 h40, Anchor
        Gui Add, CheckBox, vChkAnchorX gRequireHWndVar x75 y305 w40 h23, X
        Gui Add, CheckBox, vChkAnchorY gRequireHWndVar x115 y305 w40 h23, Y
        Gui Add, CheckBox, vChkAnchorW gRequireHWndVar x155 y305 w40 h23, W
        Gui Add, CheckBox, vChkAnchorH gRequireHWndVar x195 y305 w40 h23, H
		
		;Loads these variables if menu is created by Opening GUI from File Menu -RH
		If GuiLoaded
			{
			GuiControl,, EdtText, % g.Window.Title
			GuiControl,, EdthwndVar, % g.Window.hwndvar
			GuiControl,, EdtgLabel, % g.Window.Label
			GuiControl,, EdtvVar, % g.Window.Name
			}

    Gui Tab, 2 ; Options
        Gui Add, GroupBox, vGrpOptions x16 y71 w250 h60, Options
        Gui Add, Button, hWndhOptionsBtn x28 y92 w24 h24 gShowContextMenu, ...
        GuiButtonIcon(hOptionsBtn, IconLib, 91, "L1 T1")
        Gui Add, Edit, vEdtOptions x54 y94 w200 h21

        Gui Add, GroupBox, x16 y144 w250 h84, Styles
        Gui Add, Text, x33 y165 w60 h23 +0x200, Style:
        Gui Add, Edit, hWndhEdtStyle vEdtStyle x96 y166 w82 h22
        SendMessage 0x1501, True, "Default",, ahk_id %hEdtStyle%
        Gui Add, Button, vBtnChangeStyle gShowStylesDialog x184 y165 w75 h23, Change...
        Gui Add, Text, x33 y193 w60 h23 +0x200, Extended:
        Gui Add, Edit, hWndhEdtExStyle vEdtExStyle x96 y193 w82 h22
        SendMessage 0x1501, True, "Default",, ahk_id %hEdtExStyle%
        Gui Add, Button, vBtnChangeExStyle gShowStylesDialog x184 y193 w75 h23, Change...

        Gui Add, GroupBox, x16 y242 w250 h84, Font
        Gui Add, Edit, vEdtFont x27 y264 w227 h23 Center ReadOnly, Default
        Gui Add, Button, gShowFontDialog x180 y296 w75 h23, Change...

    Gui Tab, 3 ; Window
		
					
		Gui Add, CheckBox, vChkResizable x20 y72 w110 h23, Resizable
        Gui Add, CheckBox, vChkNoMinimize x20 y97 w110 h24, No minimize button
        Gui Add, CheckBox, vChkNoMaximize x20 y122 w111 h22, No maximize button
        Gui Add, CheckBox, vChkNoSysMenu x20 y147 w111 h23, No system menu
        Gui Add, CheckBox, vChkNoTheme x20 y172 w110 h23, No theme

        Gui Add, CheckBox, vChkCenter x140 y72 w120 h23 Checked, Center on screen
        Gui Add, CheckBox, vChkAlwaysOnTop x140 y97 w120 h23, Always on top
        Gui Add, CheckBox, vChkOwnDialogs x140 y122 w120 h23, Own dialogs
        Gui Add, CheckBox, vChkToolWindow x140 y147 w120 h23, Tool window
        Gui Add, CheckBox, vChkNoDPIScale x140 y172 w120 h23, No DPI scale

        Gui Add, CheckBox, vChkBGColor x20 y200 w111 h24, Background color:
        Gui Add, ListView, vColorPreview x140 y201 w20 h20 -Hdr Border, Color
        Color := DllCall("GetSysColor", "UInt", 15) ; COLOR_3DFACE
        Color := (Color & 0xFF00) + ((Color & 0xFF0000) >> 16) + ((Color & 0xFF) << 16) 
        GuiControl % "+Background" . ToHex(Color), ColorPreview
        Gui Add, Button, gChooseBGColor x168 y199 w90 h23, Change Color
        
        Gui Add, CheckBox, vChkTrayIcon x20 y228 w111 h23, Window/tray icon:
        Gui Add, Text, x140 y230 w20 h20 +0x1000
        Gui Add, Picture, vTrayIcon gShowIconPath x142 y232 w16 h16 , % A_AhkPath
        Gui Add, Button, gChooseTrayIcon x168 y228 w90 h23, Change Icon
		
		
		;Added to Load Window Variables - RH
		If GuiLoaded
			{
			If (g.Window.Color != "") {
				Color := g.Window.Color
				GuiControl,, ChkBGColor, 1
				GuiControl % "+Background" . ToHex(Color), ColorPreview
				}
			If (g.Window.Icon != "") {
				GuiControl,, ChkTrayIcon, 1
				GuiControl,, TrayIcon, % "*Icon" . g.Window.IconIndex . " " . g.Window.Icon
				}
			svar := g.window.options
			IfInString svar, Resize, GuiControl,, ChkResizable, 1
			IfInString svar, MinimizeBox, GuiControl,, ChkNoMinimize, 1
			IfInString svar, MaximizeBox, GuiControl,, ChkNoMaximize, 1
			IfInString svar, SysMenu, GuiControl,, ChkNoSysMenu, 1
			IfInString svar, AlwaysOnTop, GuiControl,, ChkAlwaysOnTop, 1
			IfInString svar, OwnD, GuiControl,, ChkOwnDialogs, 1
			IfInString svar, ToolWindow, GuiControl,, ChkToolWindow, 1
			IfInString svar, Theme, GuiControl,, ChkNoTheme, 1
			IfInString svar, DPIScale, GuiControl,, ChkNoDPIScale, 1
			}
			
    Gui Tab, 4 ; Events
	
		Gui Add, GroupBox, x16 y71 w250 h100, Standard
        Gui Add, CheckBox, vChkGuiClose x30 y90 w100 h23 Checked, GuiClose
        Gui Add, CheckBox, vChkGuiEscape x30 y115 w100 h23 Checked, GuiEscape
        Gui Add, CheckBox, vChkGuiSize x30 y140 w100 h23, GuiSize
        Gui Add, CheckBox, vChkGuiContextMenu x140 y90 w100 h23, GuiContextMenu
        Gui Add, CheckBox, vChkGuiDropFiles x140 y115 w100 h23, GuiDropFiles
		Gui Add, CheckBox, vChkOnClipboardChange x140 y140 w120 h23, OnClipboardChange

		;Added to Load Event Variables - RH
		If GuiLoaded
			{
			If g.Window.OnClipboardChange
				GuiControl,, ChkOnClipboardChange, 1
			If g.Window.GuiClose
				GuiControl,, ChkGuiClose, 1
			If g.Window.GuiEscape
				GuiControl,, ChkGuiEscape, 1
			If g.Window.GuiSize
				GuiControl,, ChkGuiSize, 1
			If g.Window.GuiContextMenu
				GuiControl,, ChkGuiContextMenu, 1
			If g.Window.GuiDropFiles
				GuiControl,, ChkGuiDropFiles, 1
			}
		

    Gui Tab, 5 ; Script
		Gui Add, CheckBox, vChkNoEnv x20 y72 w113 h23 Checked, #NoEnv
        Gui Add, CheckBox, vChkNoTrayIcon x140 y72 w113 h23, #NoTrayIcon
        Gui Add, CheckBox, vChkWarn x20 y98 w113 h23 Checked, #Warn
        Gui Add, DropDownList, vCbxWarn x140 y98 w120, Off|MsgBox||StdOut|OutputDebug
        Gui Add, CheckBox, vChkSingleInstance x20 y126 w113 h23, #SingleInstance
        Gui Add, DropDownList, vCbxSingleInstance x140 y124 w120, Force||Ignore|Off
        Gui Add, CheckBox, vChkSetWorkingDir x20 y153 w113 h23 Checked, SetWorkingDir
        Gui Add, Edit, vEdtSetWorkingDir x140 y153 w121 h21, `%A_ScriptDir`%
        Gui Add, CheckBox, vChkSendMode x20 y179 w113 h23, SendMode
        Gui Add, DropDownList, vCbxSendMode x140 y180 w120, Input||Play|Event|InputThenPlay
        Gui Add, CheckBox, vChkSetBatchLines x20 y207 w113 h23, SetBatchLines -1
        Gui Add, CheckBox, vChkPersistent x20 y233 w113 h23, #Persistent
        Gui Add, CheckBox, vChkListLines x140 y207 w113 h23, ListLines Off
        Gui Add, CheckBox, vChkIgnoreMenuErrors x140 y233 w113 h23, Ignore Menu Errors

		;Added to Load Script Variables - RH
		If GuiLoaded
			{
			If (Script.NoEnv != 0)
				GuiControl,, ChkNoEnv, 1
			Else 
				GuiControl,, ChkNoEnv, 0 
			If (Script.NoTrayIcon != 0)
				GuiControl,, ChkNoTrayIcon, 1
			If (Script.Warn != "") { 
				GuiControl,, ChkWarn, 1
				GuiControl ChooseString, CbxWarn, % Script.Warn
				}
			Else
				GuiControl,, ChkWarn, 0
			If (Script.SingleInstance != "") {
				GuiControl,, ChkSingleInstance, 1
				GuiControl ChooseString, CbxSingleInstance, % Script.SingleInstance
				}
			Else
				GuiControl,, ChkSingleInstance, 0
			If (Script.WorkingDir != "") {
				GuiControl,, ChkSetWorkingDir, 1
				GuiControl,, EdtSetWorkingDir, % Script.WorkingDir
				}
			Else
				GuiControl,, ChkSetWorkingDir, 0
			If (Script.SendMode != "") {
				GuiControl,, ChkSendMode, 1
				GuiControl ChooseString, CbxSendMode, % Script.SendMode
				}
			Else
				GuiControl,, ChkSendMode, 0
			If (Script.NoBatchLines != 0)
				GuiControl,, ChkSetBatchLines, 1
			If (Script.Persistent != 0)
				GuiControl,, ChkPersistent, 1
			If (Script.ListLinesOff != 0)
				GuiControl,, ChkListLines, 1
			If (Script.IgnoreMenuErrors != 0)
				GuiControl,, ChkIgnoreMenuErrors, 1
			}
		
    Gui Tab
	
	GuiLoaded := 0	;Resets to option to defaults for the next file thats opened - RH

    Gui Add, Button, hWndhHelpBtn x8 y350 w24 h23 gMenuHandler
    GuiButtonIcon(hHelpBtn, "shell32.dll", 24, "L1 T1")
    Gui Add, Button, gReset x38 y350 w75 h23, Reset
    Gui Add, Button, gPropertiesClose x118 y350 w75 h23, Close
    Gui Add, Button, gApplyProperties x198 y350 w75 h23 Default, Apply

    WinGetPos ax, ay, aw,, ahk_id %hAutoWnd%
    IniRead px, %IniFile%, Properties, x, % (ax + aw - 281 - 40)
    IniRead py, %IniFile%, Properties, y, % ay + 40
    Gui Properties: Show, % "x" . px . " y" . py . " w281 h382", Properties    
    } Else {
        NA := (A_ThisFunc != "" && A_ThisFunc != "OnToolbar") ? "NA" : ""
        Gui Properties: Show, % NA
    }

    ClassNN := g[g_Control].ClassNN
    If (ClassNN = "") {
        ClassNN := "Window"
    }
    GuiControl Properties: ChooseString, CbxClassNN, % ClassNN
    Gosub OnDropDownChange
Return
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: AutoGUI - GUI Designer and Script Editor

20 Jan 2016, 11:52

This tool is really great!
DRAKON-AutoHotkey: Visual programming for AutoHotkey.
User avatar
kunkel321
Posts: 957
Joined: 30 Nov 2015, 21:19

Re: AutoGUI - GUI Designer and Script Editor

02 Feb 2016, 16:44

hI Alguimist, I'm having problems with your Expressive tool... I'm sure I remember using it a couple weeks ago. Some of the fonts were a bit off, but it was working. A couple weeks ago my OS got flashed and I just now put AutoGUI on my laptop. If I run Expressive I get this:
Image
There's no textbox to put the sample text in...
Also, the blank pane apparently has one match for the number 6. LOL. Not sure what that's about.

Addon question: Are you taking feature requests for this tool?
ste(phen|ve) kunkel
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: AutoGUI - GUI Designer and Script Editor

02 Feb 2016, 21:08

@kunkel321: The tool requires AHK 32-bit and has not been adjusted for a non-default DPI scale. Here's the fix:

Code: Select all

; Expressive - Regular Expressions Utility (v1.1)

If (A_PtrSize = 8 || !A_IsUnicode) {
    SplitPath A_AhkPath,, AhkDir
    U32 := AhkDir . "\AutoHotkeyU32.exe"
    If (FileExist(U32)) {
        Run % U32 . " " . Chr(34) . A_LineFile . Chr(34)
        ExitApp
    } Else {
        MsgBox 0x2010, AutoGUI, AutoHotkey 32-bit Unicode not found.
        ExitApp
    }
}

#NoEnv
#Warn All, Off
#SingleInstance Off
#NoTrayIcon
SetWorkingDir %A_ScriptDir%
SetControlDelay -1
SetBatchLines -1

#Include %A_ScriptDir%\..\Lib\Scintilla.ahk

Global SciLexer := A_ScriptDir . "\..\SciLexer.dll"
, hMatchCount
, Groups := False
, Replace := False
, IconLib := A_ScriptDir . "\..\Icons\Expressive.icl"

Menu Tray, Icon, %IconLib%, 1

Gui New, hWndhWindow -DPIScale

; Regular Expression
Gui Font, s9 Bold, Segoe UI
Gui Add, Text, hWndhRegExHdr x10 y12 w710 h29 +0x200 +E0x200, %A_Space%Regular Expression
Gui Font
Gui Add, Picture, hWndhHelpIcon gShowHelp x697 y18 w16 h16 Icon4, %IconLib%
Gui Font, s13, Lucida Console
Gui Add, Edit, vRegEx gSearch x10 y44 w710 h25 -VScroll
Gui Font
Gui Font, s8, MS Shell Dlg 2
If (A_ScreenDPI > 96) {
    Gui Add, CheckBox, vIgnoreCase gSetOption x12 y72 w90 h23, Ignore case
    Gui Add, CheckBox, vMultiline gSetOption x110 y72 w80 h23, Multiline
    Gui Add, CheckBox, vHighlightAll gSearch x580 y72 w140 h23 Checked, Highlight all matches
} Else {
    Gui Add, CheckBox, vIgnoreCase gSetOption x12 y72 w80 h23, Ignore case
    Gui Add, CheckBox, vMultiline gSetOption x100 y72 w80 h23, Multiline
    Gui Add, CheckBox, vHighlightAll gSearch x600 y72 w120 h23 Checked, Highlight all matches
}

; Text
Gui Font, s9 Bold, Segoe UI
Gui Add, Text, hWndhTextHdr x10 y98 w710 h29 +0x200 +E0x200, %A_Space%Text
Gui Add, Text, % "hWndhMatchCount x612 y" . (A_ScreenDPI > 96 ? 102 : 104) . " w100 h20 Right"
Gui Font
Global Sci := New Scintilla
Sci.Add(hWindow, 10, 130, 710, 232, SciLexer)
Sci.SetLexer(SCLEX_CONTAINER)
Sci.StyleClearAll()
Sci.SetWrapMode(1)
Sci.SetMarginWidthN(0, 0)
Sci.SetMarginWidthN(1, 0)
Sci.StyleSetFont(SCE_AHKL_NEUTRAL, "Lucida Console")
Sci.StyleSetSize(SCE_AHKL_NEUTRAL, 10)
Sci.SetSelFore(1, "0xFFFFFF")
Sci.SetSelBack(1, "0x3399FF")
Sci.StyleSetBack(SCE_AHKL_USERDEFINED1, 0xABDFEE)
Sci.StyleSetFont(SCE_AHKL_USERDEFINED1, "Lucida Console")
Sci.StyleSetSize(SCE_AHKL_USERDEFINED1, 10)
Sci.Notify := "OnNotify"

; Groups
Gui Font, Bold, Segoe UI
Gui Add, Text, hWndhGroupsHdr gShowGroups x10 y368 w710 h29 +0x200 +E0x200, %A_Space%Groups
Gui Font
Gui Add, Picture, hWndhGroupsChevron x697 y374 w16 h16 Icon2, %IconLib%
Global SciGroups := CreateScintilla(hWindow, 10, 282, 710, 115, SciLexer, "Hidden")
SciGroups.SetReadOnly(True)

; Replace
Gui Font, Bold, Segoe UI
Gui Add, Text, hWndhReplaceHdr gShowReplace x10 y403 w710 h29 +0x200 +E0x200, %A_Space%Replace
Gui Font
Gui Add, Picture, hWndhReplaceChevron x697 y409 w16 h16 Icon2, %IconLib%
Gui Font, s13, Lucida Console
Gui Add, Edit, hWndhReplaceField vReplacement gReplace x10 y267 w710 h25 -VScroll -0x10000000
Gui Font
Global SciReplace := CreateScintilla(hWindow, 10, 297, 710, 100, SciLexer, "Hidden")

Gui Add, Picture, hWndhCollapseChevron x-16 y0 w16 h16 Icon3, %IconLib%
ControlColor(hCollapseChevron, hWindow, 0x336699)

ControlColor(hRegExHdr, hWindow, 0x336699, 0xFFFFFF)
ControlColor(hHelpIcon, hWindow, 0x336699)

ControlColor(hTextHdr, hWindow, 0x336699, 0xFFFFFF)
ControlColor(hMatchCount, hWindow, 0x336699, 0xFFFFFF)

ControlColor(hGroupsHdr, hWindow, 0xC0C0C0, 0xFFFFFF)
ControlColor(hGroupsChevron, hWindow, 0xC0C0C0)

ControlColor(hReplaceHdr, hWindow, 0xC0C0C0, 0xFFFFFF)
ControlColor(hReplaceChevron, hWindow, 0xC0C0C0)

Gui Show, w730 h441, Expressive - Regular Expressions Utility

hSysMenu := DllCall("GetSystemMenu", "UInt", hWindow, "Int", False)
DllCall("AppendMenu", "UInt", hSysMenu, "UInt", 0x800, "UInt", 0, "Str", "")
DllCall("AppendMenu", "UInt", hSysMenu, "UInt", 1, "UInt", 0, "Str", "Version 1.1")

Return ; End of the auto-execute section

Search:
    Gui Submit, NoHide

    ; Clear old matches
    sci.StartStyling(0, 0x1F)
    sci.SetStyling(Sci.GetLength() + 1, STYLE_DEFAULT)

    If (RegExMatch(RegEx, "^([\w``]*)i([\w``]*)\)")) {
        If (!IgnoreCase) {
            GuiControl,, IgnoreCase, 1
        }
    } Else If (IgnoreCase) {
        GuiControl,, IgnoreCase, 0
    }

    If (RegExMatch(RegEx, "^([\w``]*)m([\w``]*)\)")) {
        If (!Multiline) {
            GuiControl,, Multiline, 1
        }
    } Else If (Multiline) {
        GuiControl,, Multiline, 0
    }

    If (RegEx == "") {
        GuiControl,, %hMatchCount%, No Match
        SciGroups.SetReadOnly(False)
        SciGroups.ClearAll()
        SciGroups.SetReadOnly(True)
        Return
    }

    Sci.GetText(Sci.GetLength() + 1, SciText)

    RegEx := RegExReplace(RegEx, "^(\w*)\)", "P$1)", Count)
    If (!Count) {
        RegEx := "P)" . RegEx
    }

    Pos := 1
    If (HighlightAll) {
        While (FoundPos := RegExMatch(SciText, RegEx, Length, Pos)) {
            If (Length == 0) {
                Return
            }

            Highlight(FoundPos, Length)

            Pos := FoundPos + 1
        }
    } Else {
        If (FoundPos := RegExMatch(SciText, RegEx, Length, Pos)) {
            Highlight(FoundPos, Length)
        }
    }

    UpdateCounter(SciText, RegEx)

    If (Groups) {
        GoSub UpdateGroups
    }

    If (Replace) {
        GoSub Replace
    }
Return

SetOption:
    Gui Submit, NoHide

    If (A_GuiControl = "IgnoreCase") {
        Option := "i"
    } Else If (A_GuiControl = "Multiline") {
        Option := "m"
    }

    If (RegExMatch(RegEx, "^([\w``]*)" . Option . "([\w``]*)\)")) {
        NewStr := RegExReplace(RegEx, "^([\w``]*)" . Option . "([\w``]*)\)", "$1$2)")
        If (SubStr(NewStr, 1, 1) == ")") {
            NewStr := SubStr(NewStr, 2)
        }
    } Else {
        If (!RegExMatch(RegEx, "^[\w``]+\)")) {
            Option .= ")"
        }
        NewStr := Option . RegEx
    }

    GuiControl,, RegEx, % NewStr
Return

Highlight(Pos, Length) {
    Sci.StartStyling(Pos - 1, 0x1F)
    Sci.SetStyling(Length, SCE_AHKL_USERDEFINED1)
}

UpdateCounter(Text, RegEx) {
    Count := 0
    Pos := 1
    While (FoundPos := RegExMatch(Text, RegEx,, Pos)) {
        Count++      
        Pos := FoundPos + 1
    }

    If (Count == 0) {
        CountMsg := "No Match"
    } Else If (Count == 1) {
        CountMsg := "1 Match"
    } Else If (Count > 1) {
        CountMsg := Count . " Matches"
    }
    GuiControl,, %hMatchCount%, %CountMsg%
}

ShowHelp:
    HelpFile := A_AhkPath . "\..\AutoHotkey.chm"
    Run HH mk:@MSITStore:%HelpFile%::/docs/misc/RegEx-QuickRef.htm
Return

ShowGroups:
    If (!Groups) {
        ControlMove,,,,, 115, % "ahk_id " . Sci.hWnd
        GuiControl Move, %hGroupsHdr%, y250
        GuiControl Move, %hCollapseChevron%, x697 y256
        Control Show,,, % "ahk_id " . SciGroups.hWnd
        ControlColor(hGroupsHdr, hWindow, 0x336699, 0xFFFFFF)
        Groups := True

        GuiControl Move, %hReplaceHdr%, y403
        Control Hide,,, % "ahk_id " . hReplaceField
        Control Hide,,, % "ahk_id " . SciReplace.hWnd
        ControlColor(hReplaceHdr, hWindow, 0xC0C0C0, 0xFFFFFF)
        Replace := False

        GoSub UpdateGroups
    } Else {
        ControlMove,,,,, 232, % "ahk_id " . Sci.hWnd
        GuiControl Move, %hGroupsHdr%, y368
        GuiControl Move, %hCollapseChevron%, x-16
        Control Hide,,, % "ahk_id " . SciGroups.hWnd
        ControlColor(hGroupsHdr, hWindow, 0xC0C0C0, 0xFFFFFF)
        Groups := False
    }

    WinSet Redraw,, ahk_id%hWindow%
Return

UpdateGroups:
    Gui Submit, NoHide

    If (RegEx == "") {
        Return
    }

    Sci.GetText(Sci.GetLength() + 1, SciText)

    RegEx := RegExReplace(RegEx, "^(\w*)\)", "O$1)", Count)
    If (!Count) {
        RegEx := "O)" . RegEx
    }

    RegExMatch(SciText, RegEx, o)
    GrpCount := o.Count()

    Output := ""
    Loop % GrpCount {
        n := (o.Name(A_Index) != "") ? o.Name(A_Index) : A_Index
        Value := (o.Value(A_Index) != "") ? o.Value(A_Index) : "None"
        Output .= n . ": " . Value . "`n"
    }

    SciGroups.SetReadOnly(False)
    If (GrpCount) {
        SciGroups.SetText("", Output)
    } Else {
        SciGroups.ClearAll()
    }
    SciGroups.SetReadOnly(True)
Return

ShowReplace:
    If (!Replace) {
        ControlMove,,,,, 100, % "ahk_id " . Sci.hWnd
        GuiControl Move, %hReplaceHdr%, y235
        GuiControl Move, %hCollapseChevron%, x697 y241
        Control Show,,, % "ahk_id " . hReplaceField
        Control Show,,, % "ahk_id " . SciReplace.hWnd
        ControlColor(hReplaceHdr, hWindow, 0x336699, 0xFFFFFF)
        Replace := True

        Control Hide,,, % "ahk_id " . SciGroups.hWnd
        GuiControl Move, %hGroupsHdr%, y403
        ControlColor(hGroupsHdr, hWindow, 0xC0C0C0, 0xFFFFFF)
        Groups := False

        ControlFocus,, ahk_id%hReplaceField%
    } Else {
        ControlMove,,,,, 232, % "ahk_id " . Sci.hWnd
        GuiControl Move, %hReplaceHdr%, y403
        GuiControl Move, %hCollapseChevron%, x-16
        Control Hide,,, % "ahk_id " . hReplaceField
        Control Hide,,, % "ahk_id " . SciReplace.hWnd
        ControlColor(hReplaceHdr, hWindow, 0xC0C0C0, 0xFFFFFF)
        Replace := False

        GuiControl Move, %hGroupsHdr%, y368
    }

    WinSet Redraw,, ahk_id%hWindow%
Return

Replace:
    Gui Submit, NoHide

    If (RegEx == "") {
        SciReplace.ClearAll()
        Return
    }

    Sci.GetText(Sci.GetLength() + 1, SciText)

    NewStr := RegExReplace(SciText, RegEx, Replacement)

    SciReplace.SetText("", NewStr)
Return

CreateScintilla(hParent, x, y, w, h, SciLexer, Options := "") {
    Scintilla := New Scintilla
    Scintilla.Add(hParent, x, y, w, h, SciLexer, Options)
    Scintilla.SetLexer(SCLEX_CONTAINER)
    Scintilla.SetMarginWidthN(0, 0)
    Scintilla.SetMarginWidthN(1, 0)
    Scintilla.SetWrapMode(1)
    Scintilla.StyleSetFont(SCE_AHKL_NEUTRAL, "Lucida Console")
    Scintilla.StyleSetSize(SCE_AHKL_NEUTRAL, 10)
    Scintilla.SetSelFore(1, "0xFFFFFF")
    Scintilla.SetSelBack(1, "0x3399FF")
    Return Scintilla
}

OnNotify(wParam, lParam, msg, hWnd, obj) {
    If (obj.SCNCode = SCN_MODIFIED && obj.modType != 20) {
        GoSub Search
    }
}

ControlColor(Control, Window, bc := "", tc := "", Redraw := 1) {
    a := {}
    a["c"]  := Control
    a["g"]  := Window
    a["bc"] := (bc = "") ? "" : (((bc & 255) << 16) + (((bc >> 8) & 255) << 8) + (bc >> 16))
    a["tc"] := (tc = "") ? "" : (((tc & 255) << 16) + (((tc >> 8) & 255) << 8) + (tc >> 16))
    WindowProc("Set", a, "", "")
    If (Redraw) {
        SizeOfWINDOWINFO := 60
        VarSetCapacity(WINDOWINFO, SizeOfWINDOWINFO, 0)
        NumPut(SizeOfWINDOWINFO, WINDOWINFO, "UInt")
        DllCall("GetWindowInfo",  "Ptr", Control, "Ptr", &WINDOWINFO)
        DllCall("ScreenToClient", "Ptr", Window,  "Ptr", &WINDOWINFO+20) ; x1, y1 of client area
        DllCall("ScreenToClient", "Ptr", Window,  "Ptr", &WINDOWINFO+28) ; x2, y2 of client area
        DllCall("RedrawWindow", "Ptr",  Window, "UInt", &WINDOWINFO+20, "UInt", 0, "UInt", 0x101)
    }
}

WindowProc(hWnd, uMsg, wParam, lParam) {
    Static Win := {}
    Critical
    If uMsg Between 0x132 And 0x138
    If (Win[hWnd].HasKey(lParam)) {
        If (tc := Win[hWnd, lParam, "tc"]) {
            DllCall("SetTextColor", "UInt", wParam, "UInt", tc)
        }
        If (bc := Win[hWnd, lParam, "bc"]) {
            DllCall("SetBkColor",   "UInt", wParam, "UInt", bc)
        }
        Return Win[hWnd, lParam, "Brush"] ; Return the HBRUSH to notify the OS that we altered the HDC.
    }

    If (hWnd = "Set") {
        a := uMsg
        Win[a.g, a.c] := a
        If (Win[a.g, a.c, "tc"] = "") And (Win[a.g, a.c, "bc"] = "")
            Win[a.g].Remove(a.c, "")
        If Not Win[a.g, "WindowProcOld"]
            Win[a.g,"WindowProcOld"] := DllCall("SetWindowLong", "Ptr", a.g, "Int", -4, "Int", RegisterCallback("WindowProc", "", 4), "UInt")
        If Win[a.g, a.c, "Brush"]
            DllCall("DeleteObject", "Ptr", Brush)
        If (Win[a.g, a.c, "bc"] != "")
            Win[a.g, a.c, "Brush"] := DllCall("CreateSolidBrush", "UInt", a.bc)
        Return
    }
    Return DllCall("CallWindowProcA", "UInt", Win[hWnd, "WindowProcOld"], "UInt", hWnd, "UInt", uMsg, "UInt", wParam, "UInt", lParam)
}

GuiEscape:
GuiClose:
    ExitApp
User avatar
kunkel321
Posts: 957
Joined: 30 Nov 2015, 21:19

Re: AutoGUI - GUI Designer and Script Editor

03 Feb 2016, 08:36

Yes Sir, That works perfectly! Many thanks. :)

EDIT: Here's your unsolicited feature request:
Of course I realize that AutoGUI is a full-on development environment, not just a regex tool, but this particular request is just for Expressive....
Folks on the forum here suggested assigning some of my long regex's into variables, then use the variable name in my RegExMatch(), which I've started doing.
Of course none of the regex tools out there can deal with this.
Here's a mockup of what such integration might look like: (the regex in the image actually doesn't work :-/ )
Image

The extra boxes could be a collapsible group like you already have for the bottom sections. (I didn't know how to add that to the mock up.)
ste(phen|ve) kunkel

Return to “Old Topics”

Who is online

Users browsing this forum: No registered users and 6 guests