所所思 发表于 2008-9-23 23:35:02

批量打开文件操作

比如批量处理同目录下的文本文件 比如 打开以供读写
或批量修改同目录下所有文件名

所所思 发表于 2008-9-24 10:15:56

可能没说明白
fileopendialog或其他选择文件的函数加了参数后 多选文件
但是返回的值并不是每个文件的路径   
一般对多个文件同时操作 应该怎么做

所所思 发表于 2008-9-24 10:33:32

呵呵 求人不如求己解决了

ipgss 发表于 2009-3-2 16:33:33

是怎么解决的啊,教教我啊

firewzy 发表于 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
        ;替换文件中的autoit为AUTOIT,大小写敏感
        _ReplaceStringInFile($arrFileList[$iFileIndex], "autoit", "AUTOIT", 1)
Next

MsgBox(4096, "提示", "操作完成!")

xayle 发表于 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
      ;替换文件中的autoit为AUTOIT,大小写敏感
;~         _ReplaceStringInFile(, "autoit", "AUTOIT", 1)
                $s = StringLower($arrFileList[$iFileIndex])               
Next
MsgBox(0, 0, $s)
MsgBox(4096, "提示", "操作完成!")
页: [1]
查看完整版本: 批量打开文件操作