关于AU3如何实现读写INI文件配置信息
以下这段代码如何实现接替读写Eprep.ini这个文件里面的配置信息?#include<guiconstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
GUICreate("",@DesktopWidth,@DesktopHeight,"","",$ws_popup)
GUICtrlCreatePic(@SystemDir&"\setup.bmp",0,0,@DesktopWidth,@DesktopHeight,BitOR($ss_notify,$ws_group,$ws_clipsiblings))
GUISetState(@SW_SHOW)
While 1
if FileExists(@HomeDrive&"\ntldrbi_") Then
FileSetAttrib(@HomeDrive&"\ntldr","-HSR")
FileSetAttrib(@HomeDrive&"\ntldr.bi_","-HSR")
FileDelete(@HomeDrive&"\ntldr")
FileMove(@HomeDrive&"\ntldr.bi_", @HomeDrive&"\ntldr")
FileSetAttrib(@HomeDrive&"\ntldr","+HSR")
EndIf
FileSetAttrib(@HomeDrive&"\boot.ini","-HSR")
if FileExists(@HomeDrive&"\boot.ini.in_") Then
FileDelete(@HomeDrive&"\boot.ini")
FileMove(@HomeDrive&"\boot.ini.in_", @HomeDrive&"\boot.ini")
Else
iniwrite(@homedrive&"\boot.ini","boot loader","timeout","5")
FileSetAttrib(@HomeDrive&"\boot.ini","+HSR")
EndIf
RunWait(@HomeDrive&"\sysprep\sysprep.exe -clean", '', @SW_HIDE)
RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\setup","cmdline")
RunWait("setup.exe -newsetup –mini")
;无需驱动程序验证 1=询问验证,2=必须验证通过才可安装
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Driver Signing', 'Policy', 'REG_BINARY', '00')
;不提示搜索驱动
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverSearching', 'DontPromptForWindowsUpdate', 'REG_DWORD', '0x00000000')
;不创建Windows Media Player快捷方式
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{22d6f312-b0f6-11d0-94ab-0080c74c7e95}', 'IsInstalled', 'REG_DWORD', '0x00000001')
filedelete("c:\documents and settings\allusers\桌面\windows media player.lnk")
;不起用个人设置窗口
RegWrite('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{89820200-ECBD-11cf-8B85-00AA005B4383}', 'IsInstalled', 'REG_DWORD', '0x00000001')
exit
WEnd
Eprep.ini文件配置部分
Ext1=
Ext2=
Ext3=
; 扩展接口,系统部署前运行,支持批处理及可执行程序
set1=
set2=
set3=
; 扩展接口,系统部署后运行,支持批处理及可执行程序
run1=
run2=
run3=
; 扩展接口,首次进入系统运行,支持批处理及可执行程序
neting=
;去除应用个人设置对话框,1启用 空为不启用
Cleanvga=
;清除显卡的桌面右键菜单,1启用 空为不启用
delwmp=
;删除MdeiaPlayer图标,1启用 空为不启用
CleanSrs=
;清除未使用的SRS驱动服务,1启用 空为不启用
DisPolicy=
;是否关闭驱动签名验证,1启用 空为不启用
================================================================== #include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Path = @ScriptDir & "\config.ini"
GUICreate("ini", 280, 270)
$ListView1 = GUICtrlCreateListView("账号 |密码 |", 10, 10, 260, 150)
$Button1 = GUICtrlCreateButton("添加", 185, 178, 75, 25, $WS_GROUP)
$Input1 = GUICtrlCreateInput("", 60, 180, 120, 21)
$Input2 = GUICtrlCreateInput("", 60, 220, 120, 21)
$Label1 = GUICtrlCreateLabel("账号:", 20, 183, 36, 17)
$Label2 = GUICtrlCreateLabel("密码:", 20, 223, 36, 17)
$Label3 = GUICtrlCreateLabel("数据", 200, 223, 36, 17)
$Label4 = GUICtrlCreateLabel("0", 230, 223, 36, 17)
GUISetState(@SW_SHOW)
$z = 0
_GUICtrlListView_DeleteAllItems($ListView1)
$read = IniReadSection($Path, "config")
If Not @error Then
For $i = 1 To $read
GUICtrlCreateListViewItem($read[$i], $ListView1)
_GUICtrlListView_AddSubItem($ListView1, $z, $read[$i], 1, $z + 1)
GUICtrlSetData($Label4, $z + 1)
$z += 1
Next
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case - 3
Exit
Case $Button1
$z = GUICtrlRead($Label4)
$a = GUICtrlRead($Input1)
$b = GUICtrlRead($Input2)
If $a <> "" And $b <> "" Then
IniWrite($Path, "config", $a, $b)
GUICtrlCreateListViewItem($a, $ListView1)
_GUICtrlListView_AddSubItem($ListView1, $z, $b, 1, $z + 1)
MsgBox(0, "提示", " 账号: " & $a & " 密码: " & $b & " 保存成功 ")
GUICtrlSetData($Input1, "")
GUICtrlSetData($Input2, "")
GUICtrlSetData($Label4, $z + 1)
EndIf
EndSwitch
WEnd
页:
[1]