本帖最后由 lynfr8 于 2009-7-21 22:24 编辑 #Include <Date.au3>
#Include <File.au3>
#include <Array.au3>
Dim $historyaccount,$activeaccount
checkaccount()
Func checkaccount()
$now = _NowCalc()
$count = StringLen(@UserName) + 1;获取当前账户名长度+1
$path = StringTrimRight(@UserProfileDir,$count);获取当前登陆账号目录的上级目录
$filelist = _FileListToArray($path,"*",2) ;获取系统帐户目录下所有登陆账户
For $i =1 to $filelist[0]
If FileExists($path&""&$filelist[$i]&"\NTUSER.DAT") And $filelist[$i] <> "All Users" And $filelist[$i] <> "Default User" And $filelist[$i] <> "LocalService" And $filelist[$i] <> "movedomain" And $filelist[$i] <> "NetworkService" Then ;首先排除这些账号
$t = FileGetTime($path&""&$filelist[$i]&"\NTUSER.DAT",0);该账户标志档案的上一次修改日期时间
$now1 = StringLeft($now,10);对返回的当前日期时间取YY/MM/DD格式
$time = $t[0] & "/" & $t[1] & "/" & $t[2] ; 对$t 取YY/MM/DD格式
$diffdate = _DateDiff("D",$time,$now1);比对日期,返回天数
If 7 < $diffdate <= 60 Then
$historyaccount = $historyaccount&"|"&$filelist[$i]
MsgBox(64,'历史账号',$historyaccount)
ElseIf 0 <= $diffdate <= 7 Then
$activeaccount = $activeaccount&"|"&$filelist[$i]
MsgBox(64,'活跃账号',$activeaccount)
EndIf
EndIf
Next
EndFunc
简单整理了一下楼主的代码,测试结果如下:>"C:\autoit3\SciTe\ACNWrapper\ACNWrapper.exe" /run /ErrorStdOut /in "C:\Documents and Settings\Administrator\桌面\xcv.au3" /autoit3dir "C:\autoit3" /UserParams
+>22:19:48 开始执行 ACNWrapper v.1.0.0.2
+>执行环境:
+> 系统语言: 0804
+> 键盘布局: 00000804
+> 操作系统: WIN_XP/Service Pack 3
+> 系统构架: X86
+> CPU构架: X64
+> AU3版本: 3.3.0.0
+> IP地址: 192.168.1.102
>运行 AU3Check (1.54.15.0) 开始目录:C:\autoit3
+>22:19:48 AU3Check 结束[CODE]:0
>运行:(3.3.1.0):C:\autoit3\autoit3.exe "C:\Documents and Settings\Administrator\桌面\xcv.au3"
+>22:19:50 AutoIT3.exe 完成:[CODE]:0
+>22:19:51 ACNWrapper 完成!
>退出代码: 0 时间: 3.277
编译exe测试过,没报错了
|