Hello team,
I tried out this action script from this post Adding a New line to a text file that will let me write on the next line of the file.
//getting the Remarks input
action parameter query "REMARKS" with description "Please enter the Remarks for the machine:" with default value ""
// store the file location
parameter "filename" = "C:\AT\Remarks.txt"
if {not exists file "C:\AT\Remarks.txt"}
createfile until end
{parameter "REMARKS" of action}
end
delete C:\AT\Remarks.txt
copy __createfile C:\AT\Remarks.txt
else
// add some new text
appendfile {concatenation "%0d%0a" of lines of file (parameter "filename") & (parameter "REMARKS" of action) & "%0d%0a"}
// backup the old file (first delete any old backup files)
delete "{parameter "filename"}.bak"
move "{parameter "filename"}" "{parameter "filename"}.bak"
// replace with the new file
move __appendfile "{parameter "filename"}"
However, I need to have the action always write on the top instead of going to the next line and putting the string from there.
Is there some sort of function that will point the new string to the top line of the file to write the new string from there?
Thanks in advance for any feedback