Commande On/OFF

Poser vos questions de programmation en AutoHotkey
Laz
Posts: 3
Joined: 21 Dec 2022, 06:03

Commande On/OFF

21 Dec 2022, 07:12

Bonjour, je souhaite que si j'appuie sur la touche N le programme lance la suite d'instructions : reste appuyé sur la touche D pendant 1 minute 30 puis reste appuyé sur la touche Q pendant 1 minute 30, ceci marche, mais j'ai voulu mettre une touche pour arrêter le programme "A" mais il ne fait rien du tout.
Et je souhaite que quand j'arrête le programme (la touche A), que si j'appuie sur la touche "N" il relance la suite d'instructions.

Merci pour votre aide.

Voici mon code :

Code: Select all


running := false

N::
    If (!running)
    {
        running := true
        Send, {D down}
        Sleep, 90000
        Send, {D up}
        Sleep, 3000
        Send, {Q down}
        Sleep, 90000
        Send, {Q up}
    }

A::
    If (running)
    {
	running := false
    }
garry
Posts: 3770
Joined: 22 Dec 2013, 12:50

Re: Commande On/OFF

21 Dec 2022, 13:14

;- example test send2notepad / abandonner la boucle immédiatement

Code: Select all

Process,Exist,notepad.exe
If Not ErrorLevel
  Run,notepad
sc:="ahk_exe notepad.exe" 
return
;--------
$F8::
IfWinNotActive ,%sc%,,WinActivate,%sc%
      WinWaitActive,%sc%
loop,
 {
 send,A
  sleep,3500
 send,B
  sleep,3500 
 }
return
;--------
$F9::
reload   ;- nouveau start script encore une fois
;--------
esc::exitapp
;============================

Return to “J'ai besoin d'aide”

Who is online

Users browsing this forum: No registered users and 122 guests