默认打开脚本目录下的“config.ini”进行编辑 
config.ini文本内容: 
[HardDisk] 
提示=因为是组数请保留一行 
 
这个原本封装工具里调用部署接口的,提出来与大家分享。 
 
 
 
 
 
#include <ButtonConstants.au3> 
#include <ComboConstants.au3> 
#include <GUIConstantsEx.au3> 
$Form1 = GUICreate("写、删、改", 296, 200, -1, -1) 
$Input1 = GUICtrlCreateInput("", 70,122,150,20) 
$Button1 = GUICtrlCreateButton("浏览", 225,120,60,25) 
$Button2 = GUICtrlCreateButton("删除", 70, 150, 60, 25) 
$Button3 = GUICtrlCreateButton("添加", 5, 150, 60, 25) 
$Button4 = GUICtrlCreateButton("修改", 135, 150, 60, 25) 
$Button5= GUICtrlCreateButton("保存修改", 200, 150, 60, 25) 
$Combo1 = GUICtrlCreateList("", 8, 25, 280, 85) 
$Combo2 = GUICtrlCreateCombo("", 5, 122, 60, 20, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) 
GUICtrlSetData(-1, "A1|A2|A3|A4|A5|A6|B1|B2|B3|B4|B5|B6|C1|C2|C3|C4|C5|C6|", "A1") 
GUISetState(@SW_SHOW) 
While 1 
        $nMsg = GUIGetMsg() 
        Switch $nMsg 
                Case $GUI_EVENT_CLOSE 
                        Exit 
                Case $Button1  
                   $Search1 = FileOpenDialog("请选择运行","\","程序文件(*.exe;*.reg;*.dll;*.bat;*.cmd;*.inf)",1+4);添加一个路径 
                   GUICtrlSetData($Input1,$Search1);路径显示                   
               Case $Button3                 ;添加 
 
                   $lb = GUICtrlRead($Input1)        ;读取路径 
                   $lb2 = GUICtrlRead($Combo2) 
                        If $lb ="" Then 
                                MsgBox(48,'提示','请选择要添加的条目') 
                        Else 
                                xie() 
                        EndIf 
               Case $Button2           ;删除 
                        $St=GUICtrlRead($Combo1)                   ;读取被选中控件值 
                        If $St ="" Then 
                                MsgBox(48,'提示','请选择要删除的条目') 
                        Else 
                                del() 
                        EndIf 
             Case $Button4                                    ;修改 
                      $Ss=GUICtrlRead($Combo1)                   ;读取被选中控件值 
                        If $Ss ="" Then 
                                MsgBox(48,'提示','你没有添加修改条目') 
                        Else 
                        $bName = StringSplit($Ss, "=")  
                        $name = $bName[$bName[0]]                          ;获取文件夹名    
                        $me = $bName[1]    
                        GUICtrlSetData($Input1,$name) 
                        GUICtrlSetData($Combo2,$me) 
                     EndIf 
            Case $Button5                             ;保存修改 
                      $Ss=GUICtrlRead($Combo1)                   ;读取被选中控件值 
                        If $Ss ="" Then 
                                MsgBox(48,'提示','你没有添加保存修改') 
                        Else 
                                back() 
                        EndIf 
                               
          EndSwitch            
    WEnd 
     Func xie()          ;添加 
                        FileWriteLine(@ScriptDir  & "\config.ini",$lb2&"="&$lb);写入 
                        $rdini = IniReadSection(@ScriptDir & "\config.ini", 'HardDisk') 
                        For $g = 1 To $rdini[0][0] 
                            $a = $rdini[$g][0] 
                            $b = $rdini[$g][1] 
                            GUICtrlSetData($Combo1, $a&"="&$b) 
                        Next 
                        GUICtrlSetData($Combo1,$lb2&"="&$lb);添加到列表框 
EndFunc;xie() 
 Func del()             ;删除 
                        $sText = FileRead('config.ini')                 ;打开文本 
                        $str = StringReplace($sText, $St, "")                  ;删除指定字符 
                        $Test = StringRegExpReplace($str,'\n\r','')    ;删除空格 
                        FileWriteLine('new.InI', $Test)                             ;另存新文本 
                        FileCopy('new.InI', 'config.ini', 1)                   ;替换原文本 
                        FileDelete('new.InI')                       ;删除新文本 
                        GUICtrlSetData($Combo1,"")                                        ;清空列表 
                        $rdini = IniReadSection(@ScriptDir & "\config.ini", 'HardDisk') 
                        For $g = 1 To $rdini[0][0] 
                            $a = $rdini[$g][0] 
                            $b = $rdini[$g][1] 
                            GUICtrlSetData($Combo1, $a&"="&$b) 
                        Next 
EndFunc;del() 
 
 |