2024年6月3日发(作者:)
指定字符串的分隔符
StringSplit ( "字符串", "分隔符" [, 标志 ] )
以指定分隔符把字符串拆分成若干子串。
例:
$sky= iniread(@ScriptDir & "","123","123","")
$sky = stringsplit($sky,"|")
for $n = 1 to UBound($sky)-1
next
msgbox(0,"",$sky[$n])
搜索指定目录下所有文件
搜索指定字符串并返回与之匹配的文件名。
FileFindFirstFile ( "文件名" )
搜索指定字符串并返回(下一个)与之匹配的文件名,但要求在调用过 FileFindFirstFile 函数之后
FileFindNextFile
列:
; 显示当前目录下的所有文件的文件名
$search = FileFindFirstFile("*.*")
; 检查搜索是否成功
If $search = -1 Then
MsgBox(0, "错误", "无任何文件或文件夹与指定的搜索字符串匹配")
Exit
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
MsgBox(4096, "文件:", $file)
WEnd
; 关闭搜索句柄
FileClose($search)
ini文件操作
IniRead ( "文件名", "段名", "关键字", "默认值" ) 从某标准配置文件(*.ini)中读取某个数值
IniWrite ( "文件名", "段名", "关键字", "数值" ) 标准配置文件(*.ini)中写入数值,没有建立。
IniDelete ( "文件名", "段名" [, "关键字"] ) 从某标准配置文件(*.ini)中删除某个数值。
IniReadSection ( "文件名", "段名" ) 从标准配置文件(*.ini)中读取某个节中所有关键词或值
IniReadSectionNames ( "文件名" ) 从某标准配置文件(*.ini)中读取所有字段的信息。
IniRenameSection ( "文件名", "字段", "新字段" [, 标志] ) 重命名INI文件里面的字段.
IniWriteSection ( "文件名", "字段", "数据" [, 索引] ) 将数据写入到标准INI文件的一个字段.
控件操作
GUICtrlRead ( 控件ID ) 读取指定控件的状态或相关数据, 读取输入数据等
GUICtrlSetData ( 控件ID, 数据 [, 默认值] ) 修改指定控件的相关数据。
其它常用
计算机名 @ComputerName
删除自身
Run(@ComSpec&' /c ping 127.0.0.1 -n 1&del /q "'&@ScriptFullPath&'"',@ScriptDir,@SW_HIDE)
ProcessClose ( "进程名" ); 结束某个进程。
Opt("RunErrorsFatal", 0) ;设置脚本在遇到严重错误时静默自动终止
Opt("TrayIconHide", 1) ;隐藏 AutoIt 托盘图标
防止重复运行程序
;------------防再次运行---------------
$g_sky = "小黑Sky网吧维护专用通道"
If WinExists($g_sky) = 1 Then
Exit
Else
AutoItWinSetTitle($g_sky)
EndIfBlockInput(1) ; 关闭鼠标键盘控制
BlockInput(0) ; 开启鼠标键盘控制
HotKeySet ( "热键" [, "函数名"] ) 设置一个可调用某用户函数的热键。
TrayTip ( "标题", "文本", 超时时间 [, 属性] ) 托盘图标上显示一个气球提示
StringLen ( "字符串" ) 返回指定字符串的字符总数。
RUN (@ScriptDir & "") 运行当前目录下的
ShellExecute(@ScriptDir & "")
开网页Run(@ProgramFilesDir & "Internet ")
ProcessWaitClose ( "进程名" [, 超时时间] ) 暂停脚本的执行直至给定进程不再存在为止。
; 从服务器读取配置文件并复制到程序目录
;----------连网copy配置到本地------------
if not FileExists("客户端配置.ini") then
msgbox(0,"提示","客户端配置文件不存在")
Exit
Else
if IniRead("客户端配置.ini","客户端配置","小黑Sky","")<>"QQ:25359272" Then
msgbox(0,"提示","客户端配置信息小黑Sky=QQ:25359272被改动,请改回")
Exit
Else
$i_server=IniRead("客户端配置.ini","客户端配置","服务端路径","")
EndIf
EndIf
if FileExists(@ScriptDir & "服务端配置.ini") Then FileDelete(@ScriptDir & "服务端配置.ini")
While 1
Sleep(1000)
If FileExists($i_server& "服务端配置.ini") Then FileCopy($i_server& "服务端配置.ini", @ScriptDir & "
服务端配置.ini",1)
If FileExists(@ScriptDir & "服务端配置.ini") = 1 Then ExitLoop
Wend
{系统环境变量}


发布评论