es ce possible en usant moins de cpu ?
merci.




formidable !jbnh a écrit :1, ce n'est pas assez. Mettez plutot 50, si cela rame encore 100 etc

Code : Tout sélectionner
HotKeySet("{ESC}", "_sortie") ; on se reserve une porte de sortie au cas ou
AdlibRegister("_testpixel",100) ; toutes les 100 ms on execute _testpixel
While 1 ; et pendant ce temps...
sleep (1000) ; ... on ne fait...
WEnd ; ... strictement rien !
Func _testpixel() ; fonction qui teste la couleur du pixel
$COLOR = PixelGetColor(700, 300)
If $COLOR = "0xFF6600" Then
AdlibUnRegister("_testpixel") ; on desactive l'appel a la fonction toutes les 100 ms (risque d'appel pendant que la fonction s'execute)
_clic() ; on fait qe qu'il y a a faire
AdlibRegister("_testpixel",100) ; et on réactive l'appel a la fonction toutes les 100 ms
EndIf
EndFunc
Func _clic() ; ... fonction appelée quand le test est bon
MouseClick("Left", 700, 300, 2)
EndFunc
Func _sortie() ; la fameuse porte de sortie
Exit
EndFunc 
Code : Tout sélectionner
AdlibRegister("_testpixel",100) ; toutes les 100 ms on execute _testpixel
While 1 ; et pendant ce temps...
sleep (1000) ; ... on ne fait...
WEndCode : Tout sélectionner
While 1 ; et pendant ce temps...
sleep (100)
_testpixel() ; ... on ne fait...
WEnd
Code : Tout sélectionner
#include <date.au3>
Global $timer, $Secs, $Mins, $Hour, $Time
HotKeySet("{ESC}", "_sortie") ; on se reserve une porte de sortie au cas ou
AdlibRegister("_testpixel",100) ; toutes les 100 ms on execute _testpixel
$timer=TimerInit() ; on met en place un chrono
AdlibRegister("_timer",100) ; chrono qu'on appelle toutes les 100 ms lui aussi
While 1 ; et pendant ce temps...
sleep (1000) ; ... on ne fait...
WEnd ; ... strictement rien !
Func _testpixel() ; fonction qui teste la couleur du pixel
$COLOR = PixelGetColor(700, 300)
If $COLOR = "0xFF6600" Then
AdlibUnRegister("_testpixel") ; on desactive l'appel a la fonction toutes les 100 ms (risque d'appel pendant que la fonction s'execute)
_clic() ; on fait qe qu'il y a a faire
AdlibRegister("_testpixel",100) ; et on réactive l'appel a la fonction toutes les 100 ms
EndIf
EndFunc
Func _clic() ; ... fonction appelée quand le test est bon
MouseClick("Left", 700, 300, 2)
EndFunc
Func _sortie() ; la fameuse porte de sortie
Exit
EndFunc
Func _timer() ; le chrono qui affiche le temps d'attente en haut a gauche de l'écran
_TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs)
$Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
ToolTip($Time,1,1)
EndFunc