Jump to content
Macro Express Forums

How To Copy Log.txt File Row By Row?


Backup69

Recommended Posts

Hi all

 

I try figure out how copy text from one txt file to another and in the same time delete this row from source file.

I try fallowing command:

 

Delay 1 Seconds

Clipboard Empty

Text File Begin Process: "Log.txt"

Variable Modify String: Save %T1% to Clipboard

....here i use fiew "if" commands..

Clipboard Save Text: "Log4.txt"

Text File End Process

 

with this metod "Clipboard Save" delete previous row from new file but i want move source file row by row to new file

Can anyone give me fief clue.

 

ty

Link to comment
Share on other sites

1 - I would not do anything involving exchanging variable values with the clipboard, except in cases where it is actually required. If you are doing text file processing, then such exchanges are not required, as you can read from the file into a veritable and you can write or append from the variable to a file (with Variable modify string - save to text file).

 

2 - here's my answer, assuming that you can wait until the end of the macro to have the applicable lines deleted from the original file (rather than requiring that each line be deleted from the original file as it is encountered). As I read in each line from the original file, I would decide whether I want to retain that line or delete it. If I want to retain it, I would append it to a text variable (also appending a CRLF line break after each line of text that is appended), and then read in the next line. If I want to delete the line, I would just read in the next line without appending anything to the text variable. At the end of the macro, I would write this text variable to the original filename, and thus overwrite the file with a new file that does not contain the lines you want deleted.

Link to comment
Share on other sites

In cases like these I usually choose to read the entire text file into a text variable. I then get the position of the carriage return and line feed to copy part of the text variable to another texture of all much like the text file process does. Then I delete two characters, carriage return and line feed, from the beginning of the file and do it over again until the position equals zero meaning I've reached the end of the file. I save all the results of my logical massaging to other text variables and at the end of the macro commit them to files if need be. You're listening your dog install stop it

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...