找回密码
 加入
搜索
查看: 2030|回复: 2

[AU3基础] 这段代码应该如何优化 关于循环

[复制链接]
发表于 2015-9-11 21:35:01 | 显示全部楼层 |阅读模式
#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
发表于 2015-9-11 22:41:24 | 显示全部楼层
給一些代碼給你研究
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
 楼主| 发表于 2015-9-12 08:04:20 | 显示全部楼层
回复 2# txen548


    谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-28 20:15 , Processed in 0.115061 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表