AutoIt访问Windows注册表

AutoIt3 01/06 阅读 9462 views次 人气 80
摘要:

AutoIt3访问注册表与字符串操作。

Local $RegEuumKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache";

;读取指定值项的名称,参数(键名, 序数)
$regName1 = RegEnumVal($RegEuumKey,1);
MsgBox(64,"注册表信息",$regName1);

;读取注册表指定的值,参数(键名, 值项)
$regName2 = RegRead ( $RegEuumKey, "C:\Program Files\Tencent\QQ\Bin\QQ.exe");
MsgBox(64,"注册表信息",$regName2);
AutoIt字符串处理:
#include <Array.au3>

;字符串的大小写转换
$str01 = "abdcefg";
$result01 = StringUpper($str01);
$result02 = StringLower($result01);
MsgBox(64,"大小写转换结果","大写:" & $result01 & Chr(13) & "小写:" & $result02);

;字符串的长度
$str02 = "acer01acer02acer03acer04acer05";
$len = StringLen($str02);
MsgBox(64,"长度","字符串的长度为:" & $len );

;返回指定数量的字符串
$str03 = StringLeft($str02,12);
$str04 = StringRight($str02,12);
MsgBox(64,"返回指定字符数","左边的12个字符:" & $str03 & Chr(13) & "右边的12个字符:" & $str04);

;字符串替换
$str05 = "a-b-c-d-e-f-g";
$str06 = StringReplace($str05,"-","=");
$replaceNum = @extended;
MsgBox(64,"字符替换","原串:" & $str05 & Chr(13) & "替换后的串:" & $str06  & Chr(13) & "替换个数:" & $replaceNum);

;字符串分割
$str07 = "123,456,789,0,a,d,gg";
$array01 = StringSplit($str07,",",1);
MsgBox(64,"分割字符串", "分割后的数量:" & $array01[0] & Chr(13) & "第3个串:" & $array01[3]);

;将字符串转换为数组
$array02 = StringToASCIIArray($str01);;默认为UNICODE
$array03 = StringToASCIIArray($str01,"GBK");
$array04 = StringToASCIIArray($str01,2,4,"GBK");;从第2个开始第5个结束
_ArrayDisplay($array02,"");
_ArrayDisplay($array03,"");
;MsgBox(64,"数组长度", ;
 

评论

该文章不支持评论!

分享到: