Custom GUI Demo

Post your working scripts, libraries and tools
Peared
Posts: 12
Joined: 02 Dec 2015, 12:32

Custom GUI Demo

27 Jun 2017, 23:27

Working script that give you an easy custom GUI to use with your script. Is inspired by the GUI-Demo
from this forum, https://autohotkey.com/board/topic/9072 ... p-library/
I have stripped this from my program just to inspire others, and tried to make it as easy to understand as possible
by using basic ahk and no fancy coding you need to be an expert in the language to understand.

Enjoy
Image
*added img

Code: Select all


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


; --ADD CUSTOM TRAYMENU ---------------------------------------------------------
; --OPEN GUI BY CLICKING ON THE TRAY ICON----------------------------------------
Menu, tray, add, Show GUI, GUIMenu
menu, tray, default, Show GUI

; --CHANGE GUITITLE AND COLORS---------------------------------------------------
GUITITLE := "_-> AHK <-_"
transparent := 220			;GUI transparancy

color1:="e29317"			;title background color
color2:="e29317"			;titletopborder1
color3:="e29317"			;titletopborder2
color4:="284f0f"			;titlebottomborder
color5:="284f0f"			;leftinsideborder
color6:="e29317"			;leftoutsideborder
color7:="284f0f"			;rightinsideborder
color8:="e29317"			;rightoutsideborder
color9:="284f0f"			;S_B top edge color (h=3px w=maxGUIwidth)
color10:="e29317"			;S_B partCover1, to cover vertical lines 
color11:="e29317"			;S_B partCover2, same as above
color12:="000000"			;Title & Text
color13:="ffffbe"  			;Gui background color
color14:="e29317"			;Statusbarcolor

; --SET W/H OF YOUR GUI----------------------------------------------------------
width := "650"  			;change to desired GUI width
height:= "475"				;and GUI height
; -------------------------------------------------------------------------------

GUIMenu:

; ---------SIZE OF PROGRESS BARS IN CORRECT W/H RATIO----------------------------
; ---------DO NOT EDIT IF YOU WANT TU USE TEMPATE AS IS--------------------------
; -----------------------------------------------------------------------------
W1 := width - 7,w2 := width - 5,w3 := width - 3,w4 := width - 72
,w6:= width -50,w7:= width - 34,w5 := (width-72) //2,h1 := height - 50
,h3 := height - 20,h2 := height - 17,sbpart := (width-70) //2

; -------------------------------------------------------------------------------
gui, destroy
gui, +lastfound 
Gui, Margin, 0, 0
gui, color, %color13%, %color13%
WinSet, Transparent,%transparent%
gui, -caption 
Gui, Add, Progress,+E0x20 x-1 y0 w%width%+2 h30 Background%color1% Disabled ;title
Gui, Add, Progress,+E0x20 x-1 y-1 w%width% h3 Background%color2% Disabled 	;titletopborder1
Gui, Add, Progress,+E0x20 x-1 y1 w%width% h2 Background%color3% Disabled 	;titletopborder2
Gui, Add, Progress,+E0x20 x2 y30 w%w2% h3 Background%color4% Disabled 		;titlebottomborder
Gui, Add, Progress,+E0x20 x2 y30 w2 h%h1% Background%color5% Disabled 		;leftinsideborder
Gui, Add, Progress,+E0x20 x0 y3 w2 h%height% Background%color6% Disabled 	;leftoutsideborder
Gui, Add, Progress,+E0x20 x%w2% y30 w2 h%h1% Background%color7% Disabled 	;rightinsideborder
Gui, Add, Progress,+E0x20 x%w3% y3 w2 h%height% Background%color8% Disabled ;rightoutsideborder
Gui, Add, Progress,+E0x20 x2 y%h3% w%w2% h3 Background%color9% Disabled 	;S_B top edge
Gui, Add, Progress,+E0x20 x%w4% y%h2% w5 h33 Background%color10% Disabled 	;S_B part Cover1  
Gui, Add, Progress,+E0x20 x%w5%-72 y%h2% w4 h25 Background%color11% Disabled ;S_B part Cover2
gui, font, Q5 c%color12% bold s12,  										;color & size of following 
Gui, Add, Text, +E0x20 0x200 x%w7% y6 w15 h15 BackgroundTrans Center gguiclose , x  ;x to close gui
Gui, Add, Text, +E0x20 0x200 x%w6% y10 w15 h15 BackgroundTrans Center gminimize , -	 ; - to min gui
gui, font, Q5 c%color12% bold s14,  										;color & size GuiTitle

; -----------------Title with text and a g-label to enable winmove.--

Gui, Add, Text, +E0x20 0x200 x0 y0 w%width% h22 BackgroundTrans Center gGuiMove , %guititle%   
gui, Font, Q5 s09 w500, Verdana 					;Menu-text color/font


; -----------------This add "File" as a controll and clicking it will open custom menu, 
; -----------------in this demo it open the Traymenu to show basic consept

gui,add,Text, +E0x20 0 x35 y35 w30 h23 left BackgroundTrans vfile gAssignMenuTotext,File 

; -------------------------------------------------------------------------------------------
; -------- ADD YOUR GUI CONTROLS UNDER HERE -----------------------------------
; ---------------------------------------------------------------------------------------------
; -- Example by adding the following in the demo you display AHK forum
; -- page := "https://autohotkey.com/"
; -- Gui, Add, ActiveX, 0x200000 0x800000 x4 y52 w640 h400 vwb,% page






; -------------------------------------------------------------------------------
; -------------------------------------------------------------------------------
gui, Font, Q5 s9 bold w670,							;S_B Font   
Gui, add, StatusBar, background%color14% -theme    	;S_B-backgroundcolor -theme is crutial
SB_SetParts(sbpart, sbpart)							;S_B split into 3 parts, 
SB_SetText("Ver 1.0" ,3)							;S_B set Version of your project here
SB_SetText("   By Peared"a,1)						
SB_SetText(" ",2)									
Menu, tray, Color, %color13%						;Tray menu bg-color same as background
winset, region, w%width% h%height%+5 0-0 R20-20		;Trim GUI Borders and round of corners 20px radius  
gui, show, w%width% h%height%						;Make Gui Visible.
gui, +lastfound 
return
; ----------- GUI LOADED AND READY FOR INPUTS-----------------------------

; --SUB Minimize Gui ----------------------------------------------------------------
minimize:
winminimize,
return
; --SUB Destroy GUI, doubleclick trayicon to open (new) GUI--------------------------
GuiEscape:		
GuiClose:
ButtonCancel:
gui, destroy
return
; --SUB Move window with text control in Title by click and drag-----------------------
GuiMove:     		
PostMessage, 0xA1, 2
sleep 75
winset, redraw
WB.Navigate(page)  ; --- IF YOU TESTED THE ACTIVEX CONTOL MOVING GUI WILL REQ REDRAW OF CONTROL 
return
; --Clicking textcontol to open a menu at fixed position--------------------------
AssignMenuTotext:
Menu, Tray, Show, 20, 50 ; i use traymenu as example how to
return
; -------------------------------------------------------------------------------
;-------------- ALTERNETE COLOR VALUES YOU CAN TRY IN YOUR SCRIPT

/*	color1:="282828", color2:="285a56", color3:="285a56", color4:="285a56", color5:="285a56", color6:="285a56", color7:="285a56", color8:="285a56", color9:="285a56", color10:="285a56", color11:="285a56", color12:="white", color13:="285a56", color14:="285a56", */
vasili111
Posts: 747
Joined: 21 Jan 2014, 02:04
Location: Georgia

Re: Custom GUI Demo

28 Jun 2017, 04:01

Nice demo :)
I think you need to post it here: https://autohotkey.com/boards/viewtopic ... &start=180
DRAKON-AutoHotkey: Visual programming for AutoHotkey.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Bodhi, Game Over+63, JoeSchmoe and 19 guests