找回密码
 加入
搜索
查看: 3160|回复: 5

批量打开文件操作

[复制链接]
发表于 2008-9-23 23:35:02 | 显示全部楼层 |阅读模式
比如批量处理同目录下的文本文件 比如 打开以供读写
或批量修改同目录下所有文件名
 楼主| 发表于 2008-9-24 10:15:56 | 显示全部楼层
可能没说明白
fileopendialog或其他选择文件的函数  加了参数后 多选文件
但是返回的值并不是每个文件的路径   
一般对多个文件同时操作 应该怎么做
 楼主| 发表于 2008-9-24 10:33:32 | 显示全部楼层
呵呵 求人不如求己  解决了
发表于 2009-3-2 16:33:33 | 显示全部楼层
是怎么解决的啊,教教我啊
发表于 2009-3-2 19:09:55 | 显示全部楼层
#Include <File.au3>
;选择一个或多个文本文件
Dim $strFiles = FileOpenDialog("选择一个或多个文本文件", @WindowsDir & "\", "文本文档(*.txt)", 1+4)

If @error Or $strFiles = "" Then
        MsgBox(4096, "警告", "选择文件失败!")
        Exit
EndIf
;将多个文件路径分割
Dim $arrFileList = StringSplit($strFiles, "|")
Dim $iFileIndex = 1

For $iFileIndex = 1 To $arrFileList[0]
        ;替换文件中的autoit为AUTOIT,大小写敏感
        _ReplaceStringInFile($arrFileList[$iFileIndex], "autoit", "AUTOIT", 1)
Next

MsgBox(4096, "提示", "操作完成!")
发表于 2009-3-3 04:02:50 | 显示全部楼层
字符串函数里有转换大小写

Dim $strFiles = FileOpenDialog("选择一个或多个文本文件", @WindowsDir & "\", "文本文档(*.txt)", 1+4)

If @error Or $strFiles = "" Then
        MsgBox(4096, "警告", "选择文件失败!")
        Exit
EndIf
;将多个文件路径分割
Dim $arrFileList = StringSplit($strFiles, "|")
Dim $iFileIndex = 1

For $iFileIndex = 1 To $arrFileList[0]
        ;替换文件中的autoit为AUTOIT,大小写敏感
;~         _ReplaceStringInFile(, "autoit", "AUTOIT", 1)
                $s = StringLower($arrFileList[$iFileIndex])                
Next
MsgBox(0, 0, $s)
MsgBox(4096, "提示", "操作完成!")
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-23 07:21 , Processed in 0.088174 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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