精易论坛

标题: 按键精灵从文本TEXT1读取一行,保存到TEXT2里面, [打印本页]

作者: shunshun66    时间: 2025-2-26 12:56
标题: 按键精灵从文本TEXT1读取一行,保存到TEXT2里面,
按键精灵从文本TEXT1读取一行,保存到TEXT2里面。

作者: shunshun66    时间: 2025-2-26 12:57
应该是保存到TEXT2最后面并换行!
作者: shunshun66    时间: 2025-2-26 12:58
Text = Plugin.File.ReadFileEx("C:\Users\Admin\Desktop\新建文本文档.txt")
dim MyArray   
MyArray = Split(Text, "|")   
If UBound(MyArray)>=0 Then  
    i=0   
    For UBound(MyArray)   
        //下面这句是得到文本内容   
        i=i+1   
    Next  
End If   
读取到了, 但是保存不到新的文本里面!
作者: shunshun66    时间: 2025-2-26 13:21
Text = Plugin.File.ReadFileEx("C:\Users\Admin\Desktop\新建文本文档.txt")//文档位置你自己改
dim MyArray
MyArray = Split(Text, "|")

     //显示气泡提示信息第几行内容就改下面的数字-------------------------

    //一行一行读取-------------------------------------------------
If UBound(MyArray)>=0 Then
    i=0
    For UBound(MyArray)
      
        SayString Cstr(MyArray(i))
//        Delay 1000
//Msgbox "成功输入第 " & 1 &" 行文本内容为:"& Cstr(MyArray(1))
//        Delay 200
        i=i+1
    Next
End If
Call Plugin.File.WriteFileEx("C:\Users\Admin\Desktop\新建文本文档 (2).txt",MyArray(1))
        Call Plugin.Msg.Tips("【完成写入】"&MyArray(1))
这样保存是个空没数字!
作者: dnxl    时间: 2025-2-26 13:46
Set fso = createobject("scripting.filesystemobject")'创建对像
txt = fso.opentextfile("C:\Users\Admin\Desktop\新建文本文档.txt",1,true).readall()'读取第一个文本内容
txt = split(txt,vbcrlf)
set txt2 = fso.opentextfile("C:\Users\Admin\Desktop\新建文本文档 (2).txt",8,true)'以追加方试打开第二个文本
for i = 0 to ubound(txt)
txt2.writeline txt(i)'向第二个文本中追加一行内容
next
txt2.close'关闭第二个文本
set txt2 = nothing'销毁对像
set fso = nothing
作者: shunshun66    时间: 2025-2-26 13:52
问题 已经解决谢谢!




欢迎光临 精易论坛 (https://125.confly.eu.org/) Powered by Discuz! X3.4