;计时器示例 Func _timer_() Local $begin = TimerInit() Sleep(3000) Local $dif = TimerDiff($begin)/1000 ;MsgBox(0, "结束", $dif) EndFunc ;打印log Func _logs_($logPath, $str) $file = FileOpen($logPath, 1) ; 检查打开的文件是否可写 If $file = -1 Then MsgBox(0, "错误", "不能打开文件.") Exit EndIf FileWriteLine($file, $str) FileWriteLine($file, @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & ":"& @MSEC) FileClose($file) EndFunc ;执行cmd命令 ;RunWait函数返回执行第一条语句的退出码,如果中间执行多条语句,如用“|”或者“&”连接的命令,只返回第一条执行的结果。 ;_RunDOS函数返回执行所有语句的退出码,需包含#include
头文件 ;run函数退出码是进程号 ;_RunProgram也可以运行程序,如 _RunProgram(0, $appPath) ;拼接字符串 ;带$的均为自定义的变量 $cmd = StringFormat("net localgroup %s | findstr %s", $InGroup, $userName) ;根据标题寻找相应的类名 $title = "XXX" Local $handle = WinGetHandle($title) $str = WinGetClassList($handle) Local $split = StringSplit ( $str, @CRLF ) For $i = 1 To $split[0] MsgBox(4096, $title, $split[$i]) Next
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/217380.html原文链接:https://javaforall.net
