需要做一个功能:先用txt格式打开一个htm文件,删除其中的URL地址,然后保存。
请问如何实现?
------解决方案--------------------
open这个方法可以实现,你可以看看帮助,就是
Open file for Read Write as ...
然后根据你的逻辑判断URL地址,并作相应的操作。
Open方法的格式:(具体可以看帮助里面的实例)
Open fileName
[ For { Random | Input | Output | Append | Binary } ]
[ Access { Read | Read Write | Write } ]
[ { Shared | Lock Read | Lock Read Write | Lock Write } ]
As [#]fileNumber
[ Len = recLen ]
[Charset = MIMECharsetName]
------解决方案--------------------
仅供参考
- VBScript code
Dim Session As New notessession Dim FilePath As String '用来确定文件的位置 Dim n As Integer Dim Remain As Integer Dim FileNum As Integer Dim SecLen As Integer SecLen=20000 FilePath=Session.GetEnvironmentString("Directory", True) &"/domino/html/uploadfile/"+doc.wordunid(0)+".htm" fileName$ = Dir$(FilePath, 0) If fileName$<>"" Then FileNum=Freefile() '打开一个二进制文件 Open FilePath For Input As FileNum Dim text As String Dim FistStrFile() As String Dim i As Integer i=1 Redim Preserve FistStrFile(i) Do Until Eof(FileNum) Line Input #FileNum, text If Len(FistStrFile(i))>20000 Then i=i+1 Redim Preserve FistStrFile(i) FistStrFile(i)=FistStrFile(i)+text+Chr(13)+Chr(10) 'FistStrFile(i)=FistStrFile(i)+text+" " Else FistStrFile(i)=FistStrFile(i)+text+Chr(13)+Chr(10) 'FistStrFile(i)=FistStrFile(i)+text+" " End If Loop