Gui help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
arpit12
Posts: 56
Joined: 10 Apr 2022, 04:19

Gui help

Post by arpit12 » 14 May 2022, 06:54

Hi,
I have few ahk script So i was wondering is it possible to have a GUI That have All buttons that can run the scripts. Do we have any templates for that.

User avatar
mikeyww
Posts: 26856
Joined: 09 Sep 2014, 18:38

Re: Gui help  Topic is solved

Post by mikeyww » 14 May 2022, 07:22

Code: Select all

dir = %A_ScriptDir%
Gui, Font, s10
Loop, Files, %dir%\*.ahk
 Gui, Add, Button, w350 gRunScript, % RegExReplace(A_LoopFileName, "\.ahk$")
Gosub, F3
F3::Gui, Show,, Run scripts (F3 = Show again)
RunScript:
Run, %dir%\%A_GuiControl%.ahk
GuiEscape:
GuiClose:
Gui, Hide
Return

arpit12
Posts: 56
Joined: 10 Apr 2022, 04:19

Re: Gui help

Post by arpit12 » 14 May 2022, 10:30

Thank you That works. can you please tell me how to change color of button i could not find it in documentation. Also Button position.

User avatar
mikeyww
Posts: 26856
Joined: 09 Sep 2014, 18:38

Re: Gui help

Post by mikeyww » 14 May 2022, 10:43

Positioning and Sizing of Controls

As far as I know, there is not a direct option to change the color, but the forum contains a few different scripts to customize buttons. An alternative is simulating a button by using a transparent text control over a progress bar.

viewtopic.php?f=6&t=1103

garry
Posts: 3758
Joined: 22 Dec 2013, 12:50

Re: Gui help

Post by garry » 14 May 2022, 13:42

@mikeyww example as you mentioned , color buttons

Code: Select all

;-------- saved at 星期六 五月 2022-05-14  18:22 UTC --------------
;- Gui help / mikeyww
;- https://www.autohotkey.com/boards/viewtopic.php?f=76&t=104039

i:=0
dir = %A_ScriptDir%
Gui,2: Font, s12 cBlack,Lucida Console
Loop, Files, %dir%\*.ahk
 {
 i++
 Md:=mod(i,2)
 if md=0
   colbgr:="red",coltxt:="white"
 else
   colbgr:="yellow",coltxt:="black" 
 Gui,2:Add,Progress,        w550 Disabled Background%colbgr%       ;- TITLE Button-backgroundcolor
 Gui,2:Add,Text,            xp    yp     wp    hp  c%coltxt%  BackgroundTrans Center 0x200  gRunscript ,% RegExReplace(A_LoopFileName, "\.ahk$")
 }
Gui,2:show
return
;----------
2Guiclose:
Exitapp
;-----------
RunScript:
Run, %dir%\%A_GuiControl%.ahk
return
;================================= 

Post Reply

Return to “Ask for Help (v1)”