[AJUDA] SCRIPT

Tire suas dúvidas sobre programação em AutoHotkey

Moderator: Gio

Castrinho
Posts: 2
Joined: 31 May 2022, 13:46

[AJUDA] SCRIPT

31 May 2022, 13:50

Bom tarde, gostaria de entender como q faço um loop ser pausado ou reiniciado com uma tecla e ativado com a mesma tecla, exemplo

Aperto a tecla X o loop vai rodar continuamente até q eu aperte a tecla X de novo, é possível fazer isso?
garry
Posts: 3793
Joined: 22 Dec 2013, 12:50

Re: [AJUDA] SCRIPT

01 Jun 2022, 07:04

boa tarde Castrinho

Code: Select all

;- Aperto a tecla X o loop vai rodar continuamente até q eu aperte a tecla X de novo
;- click Hotkey > x  > START
;- click Hotkey > x  > STOP
;- 
#Warn
#MaxThreadsPerHotkey 2
Setworkingdir,%a_scriptdir%
t:=""
$x::
t:=!t
if (t)
{
  loop
    {
    if (!t)
       break
	tooltip, loop running 
    ;- do something
    sleep,1000
    tooltip	
    }
	
}	
return
;-----------------------
esc::exitapp               ;- exit this script 
;-----------------------
Castrinho
Posts: 2
Joined: 31 May 2022, 13:46

Re: [AJUDA] SCRIPT

06 Jun 2022, 20:05

Code: Select all

#ifWinActive, ahk_exe client.exe

SetMouseDelay, 1
SetKeyDelay, 1
SetDefaultMouseSpeed, 0

Loop
{
Send {2}
sleep 100
Send {2}
Sleep 1100
Send {2}
sleep 100
Send {2}
Sleep 1100

}
p::pause
=::suspend
desse jeito aqui estaria errado?
Last edited by BoBo on 06 Jun 2022, 20:25, edited 1 time in total.
Reason: Added [code][/code]-tags.
garry
Posts: 3793
Joined: 22 Dec 2013, 12:50

Re: [AJUDA] SCRIPT

07 Jun 2022, 03:51

Code: Select all

;- script teste

#Persistent
Loop
{
tooltip,running
Sleep 1100
tooltip
}
return
;-----
esc::exitapp     ;- script saída
;-----
space::          ;- stop loop
   Pause, toggle, 1
   tooltip
Return
;-----
Numpadadd::     ;- ( key + ) key espaço não tem efeito ( loop )
suspend
return

Code: Select all

;- script teste

#Persistent
SetKeyDelay, 100  ;- send slow
$F8::
{
Loop
{
Send {2 4}`n     ;- send 2 quatro vezes  
Sleep 1100
}
return
}
;-----
esc::exitapp     ;- script saída
;-----
space::          ;- stop loop
   Pause, toggle, 1
   tooltip
Return
;-----
Numpadadd::     ;- ( key + ) key espaço não tem efeito ( loop )
suspend
return

Return to “Ajuda e Suporte Geral”

Who is online

Users browsing this forum: No registered users and 3 guests