不明白楼主的监听包括哪些,是否需要监听后有所动作,我这里有一个用来中转不同平台文件的一个小程序,希望对楼主有用:
#include<file.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=D:\桌面\UDF\Form2.kxf
$config = @ScriptDir & "\config.dat"
$password = IniRead($config, "config", "pwd", "")
$logpath = IniRead($config, "config", "path", "") ;netware生成的文件的路径;
$srvPath = IniRead($config, "config", "Srvpath", "") ;SFC服务器的目标目录
$_auto = IniRead($config, "config", "autostart", "")
$Form2 = GUICreate("窗体1", 504, 471, -1, -1)
$List1 = GUICtrlCreateList("", 8, 32, 377, 396)
$start = GUICtrlCreateButton("启 动", 400, 344, 89, 33)
$save = GUICtrlCreateButton("保 存", 400, 392, 89, 33)
$auto = GUICtrlCreateCheckbox(" 自动运行", 400, 296, 78, 33)
If $_auto = "1" Then
GUICtrlSetState($auto, $GUI_CHECKED)
Else
GUICtrlSetState($auto, $GUI_UnCHECKED)
EndIf
$Group1 = GUICtrlCreateGroup("监视目录情况", 0, 16, 393, 417)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Input1 = GUICtrlCreateInput($srvPath, 72, 440, 300, 21)
$Label1 = GUICtrlCreateLabel("目录路径:", 8, 442, 64, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
$pwd = InputBox("请输入退出密码:", "请输入退出密码:", "", "*")
If Not $pwd <> $password Then
MsgBox(0, "恭喜!", "密码正确!按确认键退出!")
Exit
Else
MsgBox(16, "对不起!", "你输入的密码有误!")
EndIf
Case $start
monitor()
Case $save
IniWrite($config, "config", "Srvpath", GUICtrlRead($Input1))
If GUICtrlRead($auto) = $GUI_CHECKED Then
IniWrite($config, "config", "autostart", "1")
If Not FileExists(@StartupDir & "\DOS监视器.lnk") Then
FileCreateShortcut(@AutoItExe, @StartupDir & "\DOS监视器.lnk")
EndIf
Else
IniWrite($config, "config", "autostart", "0")
If FileExists(@StartupDir & "\DOS监视器.lnk") Then
FileDelete(@StartupDir & "\DOS监视器.lnk")
EndIf
EndIf
EndSwitch
WEnd
Func monitor()
If Not FileExists($logpath) Then
MsgBox(16, "警告!", "没有连接到Netware服务器" & @CRLF & "或者Netware服务器不在线!请点击确认并映射网络驱动器后再次点击启动进行尝试!")
Else
While 1
$txt = _FileListToArray($logpath, "*.txt", 1)
If Not @error Then
For $i = 0 To $txt[$i]
If FileMove($logpath & "\" & $txt[$i], $srvPath & "\00E066" & $txt[$i], 9) Then
print(FileRead($srvPath & "\" & $txt[$i]))
Else
print($logpath & "\" & $txt[$i] & "文件移动失败!")
EndIf
Next
Else
Sleep(2000)
EndIf
WEnd
EndIf
EndFunc ;==>monitor
Func print($value)
GUICtrlSetData($List1, $value & @CRLF)
EndFunc ;==>print
config.dat里面的内容如下:
[config]
pwd=test
path=\\192.168.1.2\log
srvpath=\\192.168.1.240\public
autostart=1
|