找回密码
 加入
搜索
查看: 76814|回复: 234

[AU3基础] 求[批量文本替换]源码[已解决]

 火...   [复制链接]
发表于 2010-9-27 22:28:09 | 显示全部楼层 |阅读模式
本帖最后由 afan 于 2015-6-8 18:26 编辑

在此谢谢水木子的帮助,问题已经解决。

在这里也不多说什么,发已经解决的源码和大家分享。

觉得值得收藏的就顶一下。
#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

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-9-28 08:44:57 | 显示全部楼层
沙发一下,看看是不是想要的
发表于 2010-9-28 11:03:10 | 显示全部楼层
看看啥内容。。
发表于 2010-9-28 13:46:39 | 显示全部楼层
在此也感谢楼主.
发表于 2010-9-28 20:53:21 | 显示全部楼层
那我就回复看看嘛
发表于 2010-9-28 22:02:09 | 显示全部楼层
看看能不能看得懂
发表于 2010-9-28 22:37:28 | 显示全部楼层
学习学习,俺对正则非常的头疼。
发表于 2010-9-28 22:44:23 | 显示全部楼层
嗯,对于路径类的字符无法替换。
发表于 2010-9-29 11:05:20 | 显示全部楼层
谢谢分享。。。。
发表于 2010-9-30 17:11:05 | 显示全部楼层
那我就回复看看嘛
发表于 2010-9-30 23:34:49 | 显示全部楼层
那我就回复看看嘛
发表于 2010-9-30 23:40:05 | 显示全部楼层
水木子人品非常不错的。
发表于 2010-10-1 00:25:37 | 显示全部楼层
本帖最后由 caodongchun 于 2010-10-1 00:28 编辑

所有文本文档,应该支持txt,php,htm,html,c,h,au3,rb等等
应该支持文件夹
应该支持文件拖拽
呵呵
发表于 2010-10-2 21:59:34 | 显示全部楼层
那我就回复看看嘛
发表于 2010-10-3 03:03:42 | 显示全部楼层
看看。。。。。。。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-30 00:59 , Processed in 0.083117 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表