#include <WindowsConstants.au3>
GUICreate("Form1", 280, 250)
GUICtrlCreateLabel("文本路径", 20, 24, 73, 17)
$Input1 = GUICtrlCreateInput("", 85, 20, 121, 21)
GUICtrlCreateLabel("要修改的内容", 4, 48, 76, 17)
$Input2 = GUICtrlCreateInput("", 85, 45, 121, 21)
GUICtrlCreateLabel("修改为:", 24, 72, 52, 17)
$Input3 = GUICtrlCreateInput("", 85, 70, 121, 21)
$But1 = GUICtrlCreateButton("浏览", 210, 18, 50, 25, $WS_GROUP)
$Button1 = GUICtrlCreateButton("替换", 60, 120, 50, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("关闭", 120, 120, 50, 25, $WS_GROUP)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case - 3, $Button2
Exit
Case $Button1
FileWrite(StringTrimRight(StringRegExpReplace(GUICtrlRead($Input1), '.+\\', ''), 4) & '~.TXT', StringRegExpReplace(FileRead(GUICtrlRead($Input1)), GUICtrlRead($Input2), GUICtrlRead($Input3)))
MsgBox(0, '', '完成')
Case $But1
$folder = FileOpenDialog("查找", '', "可执行文件(*.txt)")
If Not @error Then GUICtrlSetData($Input1, $folder)
EndSwitch
WEnd