找回密码
 加入
搜索
查看: 3613|回复: 5

[AU3基础] 这个代码应该怎么写

  [复制链接]
发表于 2011-6-5 01:41:27 | 显示全部楼层 |阅读模式
#include <GUIConstantsEx.au3>
GUICreate("测试", 200, 200)
GUICtrlCreateButton("点击这里以后", 10, 10, 180, 50)
GUICtrlCreateEdit("", 10, 70, 180, 100)
GUICtrlSetData(-1, "这里改变为设定的内容")
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
发表于 2011-6-5 01:56:45 | 显示全部楼层
这是不是你想要的效果?
#include <GUIConstantsEx.au3>
GUICreate("测试", 200, 200)
$Button=GUICtrlCreateButton("点击这里以后", 10, 10, 180, 50)
$Edit=GUICtrlCreateEdit("", 10, 70, 180, 100)
GUISetState(@SW_SHOW)
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        Case $Button
               GUICtrlSetData($Edit, "这里的内容已经更改了哦")
        EndSwitch
WEnd
 楼主| 发表于 2011-6-5 02:00:45 | 显示全部楼层
是的 谢谢 啊
 楼主| 发表于 2011-6-5 02:09:59 | 显示全部楼层
#NoTrayIcon
#include <Process.au3>
$Config=IniRead("映像名称.TXT","映像名称","映像名称","QQ.EXE")
While 1
$Process=ProcessExists($Config)
If $Process=0 Then
ProcessWait($Config)
Else
ProcessClose($Config)
EndIf
ContinueLoop
WEnd
这样只能监控一个映像名称,如果想监控多个应该怎么写呢?
发表于 2011-6-5 11:27:27 | 显示全部楼层
这样只能监控一个映像名称,如果想监控多个应该怎么写呢?
诺言 发表于 2011-6-5 02:09


试试这个。
#NoTrayIcon
#include <Process.au3>
While 1
$Config = IniReadSection("映像名称.ini","映像名称")
If @error Then 
    MsgBox(16, "错误", "啊哦, 读取INI文件失败.")
        ExitLoop
Else
    For $i = 1 To $Config[0][0]
        If ProcessExists($Config[$i][1]) Then
                        ProcessClose($Config[$i][1])
            EndIf
        Sleep(100)
    Next
EndIf
WEnd
顺便提醒一下, IniRead是从某标准配置文件(*.ini)中读取某个数值,你用来读取.txt文件,貌似不规范哦
发表于 2011-6-5 13:01:44 | 显示全部楼层
good~good~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 05:36 , Processed in 0.088594 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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