Is it possible to implement these 2 functions below?
1) Writes text to a specific line in a file.
C:\text.txt contain
hello1
hello2
hello3
hello4
hello5
Eg, write>Bye,3,C:\text.txt
Write Bye to c:\text.txt line number 3.
Then result
C:\text.txt now contain
hello1
hello2
Bye
hello4
hello5
2) Overwrite file with new text.
C:\text.txt contain
hello1
hello2
Bye
hello4
hello5
Eg, writefile>yeah,C:\text.txt
Overwrite c:\text.txt with text yeah.
Then result
C:\text.txt now contain
yeah
Writes text to specific line in file and overwrite file data
Moderators: JRL, Dorian (MJT support)
Yes it's possible.
Add text to specified line
Overwrite File
Add text to specified line
Code: Select all
ReadFile>C:\text.txt,vAllText
//Read text at line 3
ReadLn>C:\text.txt,3,vTextAtLine
//Add text to line 3
StringReplace>%vAllText%,%vTextAtLine%,Bye%CRLF%%vTextAtLine%,vModifiedText
DeleteFile>C:\text.txt
WriteLn>C:\text.txt,r,vModifiedText
Code: Select all
DeleteFile>C:\text.txt
WriteLn>C:\text.txt,r,yeah
In virtual mode, cant create new files or delete existing files, but can modify existing files.
Thats why I need native ms commands to do it. Since ms native commands using something like/similar called api I think(not sure what you call it, Im not that familliar with those terms).
Eg. I have 2 files named file1.txt and file2.txt in virtual mode.
I can use CopyFile>file1.txt,file2.txt function, it will copy file1.txt contents and overwrite into file2.txt contents in virtual mode.
But I cant use dos xcopy or copy commands to do it, because these commands need physical files(reside on hard disk), it cant work in virtual mode.
Thats why I need native ms commands to do it. Since ms native commands using something like/similar called api I think(not sure what you call it, Im not that familliar with those terms).
Eg. I have 2 files named file1.txt and file2.txt in virtual mode.
I can use CopyFile>file1.txt,file2.txt function, it will copy file1.txt contents and overwrite into file2.txt contents in virtual mode.
But I cant use dos xcopy or copy commands to do it, because these commands need physical files(reside on hard disk), it cant work in virtual mode.