AutoHotkey GUI button: Trigger hotstring via the button Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hotkeyguy
Posts: 170
Joined: 11 Oct 2014, 12:22

AutoHotkey GUI button: Trigger hotstring via the button

22 May 2017, 19:37

Hello again,

how can I trigger an hotstring via an AutoHotkey GUI button, e. g. hotstring MyHotstring mhs#:
:*Raw:mhs#::This is my hotstring!
In more detail, that button should send mhs# which is then replaced by This is my hotstring!. Which Send-command must I use?


Many thanks and greetings
hotkeyguy
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: AutoHotkey GUI button: Trigger hotstring via the button

23 May 2017, 02:36

Hi hotkeyguy, i don't know if i understand him well but... try this

Code: Select all

#NoEnv
#SingleInstance force
#Persistent
	
Gui, Font, S12 CBlue Bold, Verdana    
Gui, Add, Text, x32 y10 w500 h40 +BackgroundTrans, Type "mhs#" o push button SEND
Gui, font,S8 Cred, Verdana
Gui, Add, Edit, x12 y40 w500 h20 vMyEdit
Gui, Add, Button , xp+130 yp+30 gClear ,  Clear EDIT
Gui, Add, Button , xp+120 yp Default gOK  , SEND
Gui, Show

Clear:
GuiControl,, MyEdit, 
GuiControl, Focus, MyEdit
Return 
	
OK:
GuiControl, Focus, MyEdit
GoSub % ":*Raw:mhs#"
Return

:*Raw:mhs#::
Send This is my hotstring!     
Return
A hotkey label can be used as the target of a Gosub or Goto
For example: Gosub ^!s.
Donec Perficiam
hotkeyguy
Posts: 170
Joined: 11 Oct 2014, 12:22

Re: AutoHotkey GUI button: Trigger hotstring via the button  Topic is solved

23 May 2017, 11:42

Hello jmeneses,

thanks for your hints. Haven't been aware that a hotkey/hotstring can be used as a label for the Gosub command.

I looked for a simpler solution and found the SendLevel command. I used just SendLevel 1 like the SendLevel example.


Greetings
hotkeyguy
User avatar
jmeneses
Posts: 524
Joined: 28 Oct 2014, 11:09
Location: Catalan Republic

Re: AutoHotkey GUI button: Trigger hotstring via the button

23 May 2017, 12:07

:bravo: Good hotkeyguy, better solution than mine
Donec Perficiam

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, RandomBoy and 367 guests