Bonjour,
Si j'ai bien compris votre question, vous parlez de la boucle While (et non de celle du Do)
Par définition, une boucle a un début et une fin et se répète à l'infinie.
Pour que votre script puisse durer dans le temps, il faut une boucle (souvent While) je pense au Gui.
Je vous mets un petit exemple, vous remarquerez que la boucle vous renvoie Notepad à l'infinie et ma méthode pour sortir du script à la place d'un Exit. ConsoleWrite() vous situera dans le développement
(Si j'ai compris votre question !?!)
Code : Tout sélectionner
HotKeySet("!{F5}", "Pause") ;Alt + F5
HotKeySet("!{F6}", "_Exit");Alt + F6
Global $Pause=0, $Sortie = 0
While 1
ConsoleWrite("dans le 'While'" & @CR)
Example()
Sleep(5000)
If $Sortie = 1 Then ExitLoop
WEnd
Func Pause()
$Pause = BitXOR($Pause,1)
Do
ConsoleWrite("dans le 'Do'" & @CR)
ToolTip("Pause !",100,100);Indique La Pause
Sleep(1000)
Until $Pause=0
ToolTip("Reprise !",100,100);Indique La Reprise du Script
EndFunc
Func _Exit()
$Sortie = 1
EndFunc
Func Example()
; Run Notepad
Run("notepad.exe")
Sleep(2000)
; Wait 10 seconds for the Notepad window to appear.
Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
; Set the state of the Notepad window to "hide".
WinSetState($hWnd, "", @SW_HIDE)
ControlSend($hWnd, "", "Edit1", "This is some text " & @MIN &":"& @SEC)
; Wait for 2 seconds.
Sleep(2000)
; Set the state of the Notepad window to "show".
WinSetState($hWnd, "", @SW_SHOW)
; Wait for 2 seconds.
Sleep(2000)
; Close the Notepad window using the handle returned by WinWait.
WinKill($hWnd)
EndFunc ;==>Example