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

写到中间没办法写了

[复制链接]
发表于 2009-4-20 15:03:46 | 显示全部楼层 |阅读模式
不好意思!本人刚学AU3。现在想写一个小程序。根据配置文件里面的计算机名,运行程序
Global $inipath = @ScriptDir & "\config.ini" 
If @error Then
MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
Exit
Local $HostName
$HostName = StringSplit(IniRead($inipath, "配置信息", "机器列表", ""), ",")
If @ComputerName=$HostName
。请高手指点怎么往下写


这是配置文件
[配置信息]
机器列表=D180,D179

[ 本帖最后由 shounei 于 2009-4-20 16:09 编辑 ]
 楼主| 发表于 2009-4-20 15:06:48 | 显示全部楼层
高手快来
发表于 2009-4-20 15:30:07 | 显示全部楼层
Global $inipath = @ScriptDir & "\config.ini"
If Not FileExists($inipath) Then
MsgBox(4096, "", "发生错误,可能目标文件不存在")
Exit
EndIf
Local $HostName
$HostName = StringSplit(IniRead($inipath, "配置信息", "机器列表", ""), ",")
for $i=0 to ubound($HostName)-1
If @ComputerName=$HostName[$i]
;执行相应操作
EndIf
Next
 楼主| 发表于 2009-4-20 16:02:45 | 显示全部楼层
楼上的给的代码不行呀
修正一下呀
 楼主| 发表于 2009-4-20 16:06:46 | 显示全部楼层
Global $inipath = @ScriptDir & "\config.ini"
If Not FileExists($inipath) Then
MsgBox(4096, "", "发生错误,可能目标文件不存在")
Exit
EndIf
Local $HostName
$HostName = StringSplit(IniRead($inipath, "配置信息", "机器列表", ""), ",")
for $i=0 to ubound($HostName)-1
If @ComputerName=$HostName[$i] Then
Run("Notepad.exe", "", @SW_MAXIMIZE)
EndIf
Next 搞定
发表于 2009-4-20 16:17:21 | 显示全部楼层
#include <array.au3>
Global $inipath = @ScriptDir & "\config.ini"
If Not FileExists($inipath) Then
        MsgBox(4096, "", "发生错误,可能目标文件不存在")
        Exit
EndIf
Local $HostName
$HostName = StringSplit(IniRead($inipath, "配置信息", "机器列表", ""), ",")
if @error then MsgBox(0,"温馨小提示","读取机器列表失败")
for $i = 1 to $HostName[0]
        If @ComputerName = $HostName[$i] then
                ;;;这里填写你要执行的内容
        EndIf
Next
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-28 11:44 , Processed in 0.073637 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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