Help-me - Ajuda ! Script gui multiple buttons and actions Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
EvilLynx
Posts: 3
Joined: 15 Jun 2019, 14:39

Help-me - Ajuda ! Script gui multiple buttons and actions

15 Jun 2019, 17:11

I have a huge doubt, I wrote my entire program but the problem is.

I created 2 Hotkeys that are triggered by buttons.
I activate button 1. the hotkey starts working as planned.
But if button 2 is active, it cancels the first hotkey and only the second one starts to rotate.

How can I activate and deactivate each of them by the button?

How do I make them all work at the same time if I activate more than 1?
Ex:

Decrease all my code for 2 buttons so it is easy to understand.




Beleza Galera estou com uma enorme duvida, ja escrevi todo o meu programa mas o problema é.

Criei 2 Hotkeys que sao acionadas atraves de botoes.
Eu ativo o botao 1. a hotkey começa a funcionar conforme planejado.
Mas se ativo o botao 2. Ele cancela a primeira hotkey e somente a segunda passa a rodar.

Como faço para poder ativar e desativar cada uma delas pelo botao ?

Como faço para fazer com que todas possam funcionar ao mesmo tempo caso eu ative mais de 1 ?
Ex:

Diminui todo meu codigo para 2 botoes assim fica facil de entender.

Code: Select all

;imagem de fundo
Gui, Add, Picture, x0 y0 w817 h358, C:\sistema\bg.png

;botoes - all
Gui, Add, Button, x254 y228 w60 h20 gHurry, Hurry
Gui, Add, Button, x317 y228 w20 h20 gConfighurry, ?
Gui, Add, Button, x254 y257 w60 h20 gMb, Mana Blk
Gui, Add, Button, x317 y257 w20 h20 gConfigmb, ?

;Tela geral
Gui, Show, w817 h358, sistema
Return
;################################################################
;                 CONFIGURANDO O BOTAO HURRY
;################################################################
Confighurry:
WinMinimize
InputBox, HurryKey, Hotkey, Please enter a Hotkey., , 240, 180 ; exibe uma janela pedindo para que a hotkey seja inserida.
if ErrorLevel
    Return
else
    MsgBox,,Hotkey Config, You entered "%HurryKey%" ; exibe uma janela com a hotkey inserida
Return
;################################################################
;                 ATIVANDO AHOTKEY HURRY
;################################################################
Hurry:
If (HurryKey = "") ; verifica se a hotkey é nula 
{
MsgBox,64, Atention, Configure a hotkey !!! ; se for nula exibe uma msg para configura-la
}
else
{
SoundBeep
WinMinimize
MsgBox, hotkey Actived!!! ; exibe uma msg avisando que a hotkey foi ativada
Loop,
{
	Send, {%HurryKey%}
	sleep, 15000
}
}
return
;################################################################
;                 CONFIGURANDO O BOTAO MANA BLOCK
;################################################################
Configmb:
WinMinimize
InputBox, MbKey, Hotkey, Please enter a Hotkey., , 240, 180 ; exibe uma janela pedindo para que a hotkey seja inserida.
if ErrorLevel
    Return
else
    MsgBox,,Hotkey Config, You entered "%MbKey%" ; exibe uma janela com a hotkey inserida
Return
;################################################################
;                 ATIVANDO A HOTKEY MB
;################################################################
Mb:
If (MbKey = "") ; verifica se a hotkey é nula 
{
MsgBox,64, Atention, Configure a hotkey !!! ; se for nula exibe uma msg para configura-la
}
else
{
SoundBeep
WinMinimize
MsgBox, hotkey Actived!!! ; exibe uma msg avisando que a hotkey foi ativada
Loop,
{
	Send, {%MbKey%}
	sleep, 25000
}
}
return
Rohwedder
Posts: 7608
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help-me - Ajuda ! Script gui multiple buttons and actions  Topic is solved

16 Jun 2019, 10:17

Hallo,
perhaps??:

Code: Select all

;imagem de fundo
Gui, Add, Picture, x0 y0 w817 h358, C:\sistema\bg.png
;botoes - all
Gui, Add, Button, x254 y228 w60 h20 gHurry, Hurry
Gui, Add, Button, x317 y228 w20 h20 gConfighurry, ?
Gui, Add, Button, x254 y257 w60 h20 gMb, Mana Blk
Gui, Add, Button, x317 y257 w20 h20 gConfigmb, ?
;Tela geral
Gui, Show, w817 h358, sistema
Return
;################################################################
;                 CONFIGURANDO O BOTAO HURRY
;################################################################
Confighurry:
WinMinimize
SetTimer, THurryKey, Off
InputBox, HurryKey, Hotkey, Please enter a Hotkey., , 240, 180 ; exibe uma janela pedindo para que a hotkey seja inserida.
if ErrorLevel
	Return
else
	MsgBox,,Hotkey Config, You entered "%HurryKey%" ; exibe uma janela com a hotkey inserida
Return
;################################################################
;                 ATIVANDO AHOTKEY HURRY
;################################################################
Hurry:
If (HurryKey = "") ; verifica se a hotkey é nula
{
	MsgBox,64, Atention, Configure a hotkey !!! ; se for nula exibe uma msg para configura-la
}
else
{
	SoundBeep
	WinMinimize
	MsgBox, hotkey Actived!!! ; exibe uma msg avisando que a hotkey foi ativada
	SetTimer, THurryKey, 15000
	Gosub, THurryKey
}
return
THurryKey:
	Send, {%HurryKey%}
Return
;################################################################
;                 CONFIGURANDO O BOTAO MANA BLOCK
;################################################################
Configmb:
WinMinimize
SetTimer, TMbKey, Off
InputBox, MbKey, Hotkey, Please enter a Hotkey., , 240, 180 ; exibe uma janela pedindo para que a hotkey seja inserida.
if ErrorLevel
	Return
else
	MsgBox,,Hotkey Config, You entered "%MbKey%" ; exibe uma janela com a hotkey inserida
Return
;################################################################
;                 ATIVANDO A HOTKEY MB
;################################################################
Mb:
If (MbKey = "") ; verifica se a hotkey é nula
{
	MsgBox,64, Atention, Configure a hotkey !!! ; se for nula exibe uma msg para configura-la
}
else
{
	SoundBeep
	WinMinimize
	MsgBox, hotkey Actived!!! ; exibe uma msg avisando que a hotkey foi ativada
	SetTimer, TMbKey, 25000
	Gosub, TMbKey 
}
return
TMbKey:
	Send, {%MbKey%}
Return
EvilLynx
Posts: 3
Joined: 15 Jun 2019, 14:39

Re: Help-me - Ajuda ! Script gui multiple buttons and actions

20 Jun 2019, 15:56

Rohwedder wrote:
16 Jun 2019, 10:17
Hallo,
perhaps??:

Code: Select all

;imagem de fundo
Gui, Add, Picture, x0 y0 w817 h358, C:\sistema\bg.png
;botoes - all
Gui, Add, Button, x254 y228 w60 h20 gHurry, Hurry
Gui, Add, Button, x317 y228 w20 h20 gConfighurry, ?
Gui, Add, Button, x254 y257 w60 h20 gMb, Mana Blk
Gui, Add, Button, x317 y257 w20 h20 gConfigmb, ?
;Tela geral
Gui, Show, w817 h358, sistema
Return
;################################################################
;                 CONFIGURANDO O BOTAO HURRY
;################################################################
Confighurry:
WinMinimize
SetTimer, THurryKey, Off
InputBox, HurryKey, Hotkey, Please enter a Hotkey., , 240, 180 ; exibe uma janela pedindo para que a hotkey seja inserida.
if ErrorLevel
	Return
else
	MsgBox,,Hotkey Config, You entered "%HurryKey%" ; exibe uma janela com a hotkey inserida
Return
;################################################################
;                 ATIVANDO AHOTKEY HURRY
;################################################################
Hurry:
If (HurryKey = "") ; verifica se a hotkey é nula
{
	MsgBox,64, Atention, Configure a hotkey !!! ; se for nula exibe uma msg para configura-la
}
else
{
	SoundBeep
	WinMinimize
	MsgBox, hotkey Actived!!! ; exibe uma msg avisando que a hotkey foi ativada
	SetTimer, THurryKey, 15000
	Gosub, THurryKey
}
return
THurryKey:
	Send, {%HurryKey%}
Return
;################################################################
;                 CONFIGURANDO O BOTAO MANA BLOCK
;################################################################
Configmb:
WinMinimize
SetTimer, TMbKey, Off
InputBox, MbKey, Hotkey, Please enter a Hotkey., , 240, 180 ; exibe uma janela pedindo para que a hotkey seja inserida.
if ErrorLevel
	Return
else
	MsgBox,,Hotkey Config, You entered "%MbKey%" ; exibe uma janela com a hotkey inserida
Return
;################################################################
;                 ATIVANDO A HOTKEY MB
;################################################################
Mb:
If (MbKey = "") ; verifica se a hotkey é nula
{
	MsgBox,64, Atention, Configure a hotkey !!! ; se for nula exibe uma msg para configura-la
}
else
{
	SoundBeep
	WinMinimize
	MsgBox, hotkey Actived!!! ; exibe uma msg avisando que a hotkey foi ativada
	SetTimer, TMbKey, 25000
	Gosub, TMbKey 
}
return
TMbKey:
	Send, {%MbKey%}
Return

Perfect Rohwedder and to disable I used the

Code: Select all

SetTimer, TvarKey, Off

thank you very much!
EvilLynx
Posts: 3
Joined: 15 Jun 2019, 14:39

Re: Help-me - Ajuda ! Script gui multiple buttons and actions

20 Jun 2019, 15:58

Perfect Rohwedder and to disable I used the

Code: Select all

SetTimer, TvarKey, Off

thank you very much!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 252 guests