請問如何尋找並取代文字
---------------------------------------------------------------------------------------------------MsgBox(0,"Find and replace","Let's get started!")
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\1.txt")
$oDoc = _WordDocGetCollection($oWordApp, 0)
$oFind = _WordDocFindReplace($oDoc, "1:", "!@#$:")
$oFind = _WordDocFindReplace($oDoc, "2:", "1:")
$oFind = _WordDocFindReplace($oDoc, "3:", "2:")
$oFind = _WordDocFindReplace($oDoc, "4:", "3:")
$oFind = _WordDocFindReplace($oDoc, "5:", "4:")
$oFind = _WordDocFindReplace($oDoc, "6:", "5:")
$oFind = _WordDocFindReplace($oDoc, "7:", "8:")
$oFind = _WordDocFindReplace($oDoc, "0:", "9:")
$oFind = _WordDocFindReplace($oDoc, "!@#$:", "6:")
If $oFind Then
MsgBox(0, "FindReplace", "Found and replaced.")
Else
MsgBox(0, "FindReplace", "Not Found")
EndIf
_WordQuit ($oWordApp, 0)
---------------------------------------------------------------------------------------------------
以上是用word尋找"1:"取代成"!@#$:"等等的事件, 感覺很慢
可不可以用notepad開然後做以上的事???
---------------------------------------------------------------------------------------------------
MsgBox(0,"Find and replace","Let's get started!")
Run("notepad.exe 1.txt")
之後就不懂了...
[ 本帖最后由 wongfung 于 2009-1-20 19:53 编辑 ] 请在强大的帮助文件中搜索
_ReplaceStringInFile
页:
[1]