Trying to make a custom message-box as a GUI

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
galen_burnett
Posts: 18
Joined: 18 Jan 2022, 03:57

Trying to make a custom message-box as a GUI

Post by galen_burnett » 18 Jan 2022, 04:06

Here's my script


Code: Select all

::g::

Gui, +AlwaysOnTop +Disabled -SysMenu +Owner

Gui, Font, s50, Verdana

Gui, Add, Text, cTeal,text

Gui, Font, s25, Verdana,

Gui, Add, Text, cTeal,second text

Gui, Show , H500,

Gui, Show, W888,

Gui, Show, Center,

Gui, Color, cNavy

return



Enter::

reload,

Gui, Hide

return

I'm very new to AHK and haven't studied it properly yet. I want to be able to press enter and for the window to close, but not to 'exit the app', as I want to be able to trigger it again an indefinite amount of time. However the way I have written it is messing with my enter-key otherwise: I have to double-tap the enter-key in other applications to make it register and sometimes the enter-key won't work at all in other applications while this script is running. Basically I want it work just like a standard AHK message-box.

Rohwedder
Posts: 7673
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Trying to make a custom message-box as a GUI

Post by Rohwedder » 18 Jan 2022, 04:50

Hallo,
try:

Code: Select all

::g::
Gui, +AlwaysOnTop +Disabled -SysMenu +Owner +HwndGui
Gui, Font, s50, Verdana
Gui, Add, Text, cTeal,text
Gui, Font, s25, Verdana,
Gui, Add, Text, cTeal,second text
Gui, Show , H500
Gui, Show, W888
Gui, Show, Center
Gui, Color, cNavy
return
#IF WinExist("ahk_id " Gui)
Enter::Gui, Hide
#IF

User avatar
boiler
Posts: 17048
Joined: 21 Dec 2014, 02:44

Re: Trying to make a custom message-box as a GUI

Post by boiler » 18 Jan 2022, 05:11

galen_burnett wrote:

Code: Select all

Gui, Show , H500,

Gui, Show, W888,

Gui, Show, Center,
By the way, the Gui, Show options can be (and typically are) put all in one command like this:

Code: Select all

Gui, Show, W888 H500 Center
Also note that in this as well as any other command, the trailing comma isn’t necessary if the subsequent parameters are left blank.

Post Reply

Return to “Ask for Help (v1)”