这段代码应该如何优化 关于循环
#include<sound.au3> ;播放声音
HotKeySet("{ESC}", "_Terminate")
;定义菜单坐标
;------------------
Example()
Func Example()
; 初始化局部变量.
Local $aMgp = 0
; 创建一个无限循环, 将始终为 1. 因此 True.
While 1
; 分配本地变量一个光标的坐标位置值 (数组).
Dim$H
Dim$Z
For $H=0 To 19 ; 定义横坐标19个
For $Z=0 To 11 ; 定义纵坐标11个
; 在光标附近显示其坐标位置的工具提示.
If PixelGetColor (87+$H*80,200+80*$Z)=0xFF0000 Then
_playmusic()
EndIf
Sleep(20)
If PixelGetColor (97+$H*80,201+80*$Z)=0xFF0000 Then
_playmusic()
EndIf
Sleep(20)
If PixelGetColor (89+$H*80,202+80*$Z)=0xFF0000 Then
_playmusic()
EndIf
Sleep(20)
If PixelGetColor (87+$H*80,200+80*$Z)=0xFF0000 Then
_playmusic()
EndIf
Sleep(20)
Next
Next
WEnd
EndFunc ;==>Example
;播放音乐 鬼叫
Func _Terminate()
Exit
EndFunc ;退出脚本
Func _playmusic()
$soundID = _soundopen("C:\shazhu.wav")
_SoundPlay($soundID,1)
EndFunc 給一些代碼給你研究While 1
_ReduceMemory(@AutoItPID)
sleep(100)
_ReduceMemory(@AutoItPID)
If ProcessExists("HV6.exe") Then
_ReduceMemory(@AutoItPID)
$var=PixelGetColor(940,176) Or PixelGetColor(947,177) or PixelGetColor(955,180) or PixelGetColor(974,177) or PixelGetColor(942,201) or PixelGetColor(947,203) or PixelGetColor(968,208) or PixelGetColor(939,224) or PixelGetColor(947,228) or PixelGetColor(965,231) or PixelGetColor(981,230)
_ReduceMemory(@AutoItPID)
If Hex($var,6)="000000" Then
_ReduceMemory(@AutoItPID)
ProcessClose("Screensaver_Test.exe")
_ReduceMemory(@AutoItPID)
Else
_ReduceMemory(@AutoItPID)
If ProcessExists("Screensaver_Test.exe") Then
_ReduceMemory(@AutoItPID)
Else
_ReduceMemory(@AutoItPID)
Run("Screensaver_Test.exe",@WindowsDir)
_Mail()
send("{PRINTSCREEN}")
EndIf
EndIf
EndIf
_ReduceMemory(@AutoItPID)
WEnd 回复 2# txen548
谢谢
页:
[1]