Commande On/OFF

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Commande On/OFF

Re: Commande On/OFF

Post by garry » 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
;============================

Commande On/OFF

Post by Laz » 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
    }

Top