Page 6 of 22

Re: AutoGUI - GUI Designer and Script Editor

Posted: 08 Mar 2016, 19:54
by Alguimist
@Asmodeus: Thank you, your suggestions will be taken into account. As for the tooltip, it is not displayed because the toolbar button label is visible.

@derz00: The access keys will be available in the next release for the dialogs where they are missing.

Re: AutoGUI - GUI Designer and Script Editor

Posted: 12 Mar 2016, 11:16
by derz00
@Alguimist, is there a way (I can't find one) to open a saved gui script, and open the child window for it, and edit the script again? It doesn't work for me...

Re: AutoGUI - GUI Designer and Script Editor

Posted: 13 Mar 2016, 13:45
by Alguimist
Use the Window Cloning Tool (press F8 in AutoGUI). It shows a list of all opened windows. Later on, you may need to reinsert the associated variables and any data that could not be retrieved by the tool.

Re: AutoGUI - GUI Designer and Script Editor

Posted: 14 Mar 2016, 23:55
by Alguimist
New version uploaded.

Re: AutoGUI - GUI Designer and Script Editor

Posted: 28 Mar 2016, 11:44
by Asmodeus
some potential bugs I ran into:
1. CTRL+ALT+Z runs Undo command
2. after ticking to "No minimize button" "No maximize button" and "No system menu" in the Windows Properties
as expected this is added:
Gui New, -MinimizeBox -MaximizeBox -SysMenu

but additionally this is changed from
Gui Add, Picture, x0 y0 w480 h160 +Buttons gExit, C:\mybutton.png
to
Gui Add, Picture, x0 y0 w480 h160, C:\mybutton.png
so +Buttons and gExit label is deleted.

Re: AutoGUI - GUI Designer and Script Editor

Posted: 31 Mar 2016, 07:46
by Alguimist
Use the Properties window to define control options. Whenever a modification is made in the GUI being created, the script is entirely generated up to the delimiter line. The option +Buttons is not applicable to Picture controls.

Re: AutoGUI - GUI Designer and Script Editor

Posted: 04 Apr 2016, 11:59
by HinkerLoden
List of Variables and gLabel would be great. Testing now intensive

Re: AutoGUI - GUI Designer and Script Editor

Posted: 19 Apr 2016, 10:17
by Jacks108
Hi! Nice app.
A few things I noticed:
- If you drag-n-drop a file from the samples folder inside the app, it doesnt open maximized.
- If you have already displayed a gui of a script (at first tab), and then right click and close it, and open one sample file, the "diplay" dialog button continues to display the first script gui
- Perhaps there should be a "clear recent files list"
- Maybe add a command to run the Window Info utility from the editor.

I will be waiting for a new version to be ready. :)

Re: AutoGUI - GUI Designer and Script Editor

Posted: 25 Apr 2016, 10:05
by sdivyank
RazorHalo wrote: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
Hey Razor,

I am having the same problem as you! I copy/pasted your code in the appropriate files. I'm getting an error regarding the GuiLoaded variable. Could you elaborate more on how exactly to edit the code?

Thanks!!!

Re: AutoGUI - GUI Designer and Script Editor

Posted: 30 Apr 2016, 23:30
by RazorHalo
sdivyank wrote:
RazorHalo wrote: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
Hey Razor,

I am having the same problem as you! I copy/pasted your code in the appropriate files. I'm getting an error regarding the GuiLoaded variable. Could you elaborate more on how exactly to edit the code?

Thanks!!!

Ok, So I'm now using v1.1.6. Loving it. To be able to reload my saved GUI's which have hundreds of controls, and not have to re-input all my variable names, and g-labels, script options, and have it reload the child window exactly as I saved it I mad the following modifications. I will list the lines to look for and then what I either added after them or what I changed them to.
This is for v1.1.6


In the main AutoGUI.ahk script
After Line 119:
, NoReturn := False

Add:
, GuiLoaded ; Added for Setting a flag to pass to properties script that gui is being created from the OPEN GUI File menu option - RH

After Lines 1259-1261:
If (ToolbarExist()) {
Body .= "GuiAddToolBar(hGui)`n"
}

Add:
Body .= "`nGoSub AutoExecute`n`nReturn`n"
*** I added this line to always run my autoexecute sub after creating the GUI, you will need to create a sub called autoexecute to your script or you will get an error when you try to run it. it can be as simple as the label followed by "return" if you don't have anything to autoexecute.

Replace the Function "ParseScript(Source)" at line 2922 with the following code. It basically parses the saved GUI and loads all the variables, glabels script option etc.

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 A_LoopField = Gui Font
				Gui %Child%: Font
			If (fft = A_Index-2)
				{
				g[hwnd].fontoptions := flfont
				fft = 0
				}
			IfInString A_LoopField, Font`,
				{
				flFont := Substr(A_Loopfield,11)
				fft := A_Index
				Gui %Child%: Font, % flFont
				}
		
			
        ; 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+)")
			StringReplace Options, Options, %A_Space%Ri, %A_Space%Right
			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
			fWin := Rex.Options
			Loop parse, fWin, %A_Space%
			{
				If Substr(A_Loopfield,1,1) = "x"
					{
					g.Window.x := Substr(A_Loopfield,2)
					g.Window.Center := 0
					}
				If Substr(A_Loopfield,1,1) = "y"
					{
					g.Window.y := Substr(A_Loopfield,2)
					g.Window.Center := 0
					}
				If Substr(A_Loopfield,1,1) = "w"
					g.Window.w := Substr(A_Loopfield,2)
				If Substr(A_Loopfield,1,1) = "h"
					g.Window.h := Substr(A_Loopfield,2)
			}
     		}
		}
    }
	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()
	
}

In the Include Folder, Replace the following in the "Properties.ahk" script. Replace the Sub at Line 2 with this code. It sets the options in the properties window to that of the saved GUI so that when a change is made and the GUI code is recreated it has the saved options instead of the default ones.

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, h&Wnd 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, gLabel:
        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, E&xtended:
        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 mi&nimize button
        Gui Add, CheckBox, vChkNoMaximize x20 y122 w111 h22, No ma&ximize button
        Gui Add, CheckBox, vChkNoSysMenu x20 y147 w111 h23, No system &menu
        Gui Add, CheckBox, vChkNoTheme x20 y172 w110 h23, No t&heme

        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 := ToHex((Color & 0xFF00) + ((Color & 0xFF0000) >> 16) + ((Color & 0xFF) << 16))
        GuiControl % "+Background" . Color, ColorPreview
        Gui Add, Button, gChooseBGColor x168 y199 w90 h23, Chan&ge 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
				}
			If (!g.Window.Center)
				GuiControl,, ChkCenter, 0
			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 Events
        Gui Add, CheckBox, vChkGuiClose x30 y90 w100 h23 Checked, Gui&Close
        Gui Add, CheckBox, vChkGuiEscape x30 y115 w100 h23 Checked, Gui&Escape
        Gui Add, CheckBox, vChkGuiSize x30 y140 w100 h23, Gui&Size
        Gui Add, CheckBox, vChkGuiContextMenu x140 y90 w100 h23, GuiContext&Menu
        Gui Add, CheckBox, vChkGuiDropFiles x140 y115 w100 h23, Gui&DropFiles
        Gui Add, CheckBox, vChkOnClipboardChange x140 y140 w120 h23, &OnClipboardChange
        Gui Add, GroupBox, x16 y176 w250 h50, Auto-Execute Section
        Gui Add, CheckBox, vNoReturn x30 y193 w220 h23 Checked, No "&Return" statement after "Gui Show"

 
		;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, #No&Env
        Gui Add, CheckBox, vChkNoTrayIcon x140 y72 w113 h23, #No&TrayIcon
        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, #Single&Instance
        Gui Add, DropDownList, vCbxSingleInstance x140 y124 w120, Force||Ignore|Off
        Gui Add, CheckBox, vChkSetWorkingDir x20 y153 w113 h23 Checked, SetWorking&Dir
        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, Set&BatchLines -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
This works for what I need. Sometimes something dosent look right depending on what other files I was working opening and running in AutoGUI, but at that point I just close AutoGUI and restart it and open my GUI again and it usually works from there.


I also just want to say that I've only modified this code to because I needed to be able to reload my saved GUI and not have to reinput all of this. I have a great respect for this AutoGUI program,and all the people who have contributed to it as it has helped my GUI building and general understanding of how AHK works immensely.

Also a great big thanks in general to all who contribute to this forum. I may not post much, but its because most of the questions I have have already been answered in here!

Re: AutoGUI - GUI Designer and Script Editor

Posted: 03 May 2016, 16:35
by Asmodeus
please add Calltips (also known as IntelliSense).

Re: AutoGUI - GUI Designer and Script Editor

Posted: 10 May 2016, 14:03
by gallaxhar
@Alguimist

What editor did you use to write AutoGUI?
Did you transition to AutoGUI to work on AutoGUI at a later time?
Do you work in AutoGUI now exclusively for AHK-only projects?

Did you create some of your own icons (for example the File -> New File and File -> Close File menu bar icons)?

Re: AutoGUI - GUI Designer and Script Editor

Posted: 10 May 2016, 23:38
by Alguimist
@gallaxhar: I use AkelPad. AutoGUI is still in alpha stage of development, incomplete. I have created or modified some of the icons. The icon library was created with CreateIconsDll.

@RazorHalo: Your additions will be incorporated in a future version.

Re: AutoGUI - GUI Designer and Script Editor

Posted: 10 May 2016, 23:51
by Alguimist
Version 1.1.7:
- Added: command link buttons.
- Improved: context-sensitive help (integration with the AHK help file). Select a keyword and press F1 to open the help file in the corresponding page. The keyword can be the name of a command, function, object method, GUI control type, directive or, in some cases, the name of an article contained in the help file (Variables, Functions, Objects, Arrays, Tutorial, etc).
- Changed: a new blank window is not shown when AutoGUI is started.

Sample scripts demonstrating the usage of command link buttons:

Sample 1:

Code: Select all

#NoEnv
#Warn
SetWorkingDir %A_ScriptDir%

OnMessage(0x135, "OnWM_CTLCOLORBTN")
OnMessage(0x7, "OnWM_SETFOCUS")

Gui Color, White
Gui Add, Custom, x140 y40 w200 h42 ClassButton +0x200E +0x1, Lock this computer
Gui Add, Custom, x140 y89 w200 h42 ClassButton +0x200E, Switch user
Gui Add, Custom, x140 y138 w200 h42 ClassButton +0x200E, Log off
Gui Add, Custom, x140 y187 w200 h42 ClassButton +0x200E, Change a password...
Gui Add, Custom, x140 y237 w200 h42 ClassButton +0x200E, Start Task Manager
Gui Add, Button, x196 y305 w88 h25, &Cancel
Gui Show, w481 h351, Command Link Buttons
Return

GuiEscape:
GuiClose:
    ExitApp

OnWM_CTLCOLORBTN() {
    Static Brush := DllCall("Gdi32.dll\CreateSolidBrush", "UInt", 0xFFFFFF, "UPtr")
    Return Brush
}

OnWM_SETFOCUS() {
    Return False
}
Sample 2:

Code: Select all

#NoEnv
#Warn
SetWorkingDir %A_ScriptDir%

OnMessage(0x135, "OnWM_CTLCOLORBTN")

Menu Tray, Icon, setupcln.dll, 1
Gui Color, White

Gui Font, s12 c0x003399, Segoe UI
Gui Add, Text, x32 y21 w295 h23 +0x200, Select your computer's current location
Gui Font

Gui Font, s9, Segoe UI
Gui Add, Text, x32 y65 w540 h35, This computer is connected to a network. Windows will automatically apply the correct network settings based on the network's location.
Gui Font

Gui Add, Custom, hWndhBtn1 x32 y105 w538 h72 ClassButton +0x200F, &Home network`nChoose this for a home or similar location. You can participate in a homegroup, and you can see other network computers.
SetButtonIcon(hBtn1, "pnidui.dll", 1, 48)

Gui Add, Custom, hWndhBtn2 x32 y181 w538 h72 ClassButton +0x200E, &Work network`nChoose this for a workplace or similar location. You can't participate in a homegroup, but you can see other network computers.
SetButtonIcon(hBtn2, "pnidui.dll", 3, 48)

Gui Add, Custom, hWndhBtn3 x32 y257 w538 h72 ClassButton +0x200E, &Public network`nChoose this for airports, coffee shops, other public places, or connections to the Internet without a router. You can't participate in a homegroup or access network computers.
SetButtonIcon(hBtn3, "pnidui.dll", 2, 48)

Gui Font, s9, Segoe UI
Gui Add, Text, x32 y333 w474 h23 +0x200, If you aren't sure, select Public network.
Gui Show, w602 h450, Set Up Windows
Return

GuiEscape:
GuiClose:
    ExitApp

OnWM_CTLCOLORBTN() {
    Static Brush := DllCall("Gdi32.dll\CreateSolidBrush", "UInt", 0xFFFFFF, "UPtr")
    Return Brush
}

SetButtonIcon(hWnd, Icon, IconIndex, Size) {
    VarSetCapacity(BUTTON_IMAGELIST, 20 + A_PtrSize, 0)
    IL := DllCall("Comctl32.dll\ImageList_Create", "Int", Size, "Int", Size, "UInt", 0x21, "Int", 1, "Int", 1)
    IL_Add(IL, Icon, IconIndex)
    NumPut(IL, BUTTON_IMAGELIST, 0)
    SendMessage 0x1602, 0, &BUTTON_IMAGELIST,, ahk_id %hWnd%
}
Image
Screenshot of sample 2 (the icons are not available on Windows 8/10).

Re: AutoGUI - GUI Designer and Script Editor

Posted: 11 May 2016, 04:10
by gallaxhar
thanks, great update, love the F1 help feature
as a pure script editor, what feature does AkelPad have that AutoGUI doesn't? why not write in AutoGUI (with using editor mode only)

Re: AutoGUI - GUI Designer and Script Editor

Posted: 11 May 2016, 04:20
by gallaxhar
suggestions:
make the background color for the current active line in the editor of AutoGUI background light blue (like AkelPad)
implement "split window" feature like in AkelPad
add "distraction free mode" which removes the menu bar icons (but keeps the menu bar like File, Edit, Control, Selection... and the window title)
add icons for the Edit bar menu
suggest the background color for the "line number sidebar" become the same as the vertical scrollbar background color (contrast too low):
and then make the line number text color the same as the vertical scroll bar darker gray (the vertical scrollbar you drag)

Also, the line number and sidebar should be highlighted for the currently active line
Image

Re: AutoGUI - GUI Designer and Script Editor

Posted: 11 May 2016, 06:16
by gallaxhar
Image

Comments aren't colored correctly following a % symbol (line 8)

Re: AutoGUI - GUI Designer and Script Editor

Posted: 11 May 2016, 06:51
by need4speed
found a bug in RegEx Utility, I guess.

to reproduce add this text and expression:

Code: Select all

Regular Expression
a?
Text
123abc abcdefg
Now check/uncheck Highlight all matches
-> high CPU load, OS hangs

Re: AutoGUI - GUI Designer and Script Editor

Posted: 11 May 2016, 08:49
by gallaxhar
something AutoGUI needs to fix:
if you have a script which has changes that have not been saved (in the script editor)
then you close autogui, you are NOT prompted to save your work, it is just lost

honestly I would prefer that AutoGUI NOT prompt us to save work, but instead auto-save instantly like SublimeText does

and if you can make it have an infinite undo even after closing a file (for the script editor only) then it would be superior to even SublimeText

Re: AutoGUI - GUI Designer and Script Editor

Posted: 11 May 2016, 09:33
by gallaxhar
Suggestion:
A hide-able/show-able panel on the left (like the Design Mode toolbox) that instead contains a list of function names in the current script. Upon clicking them, you jump to the line in the script editor that starts that function.