Teoman Posted August 18, 2006 Report Share Posted August 18, 2006 I am new to Macro Express, and maybe my question has a very "naive" nature. I have a template text file "temp.txt" and want to parse a specific string, let say "writeme", to specific rows of the "temp.txt" file, say "10,20,30" I set the string variable "T1" to "writeme". But I could not find a way to parse T1 value to those rows. Is there any suggestion for that ? Thanks Teoman Quote Link to comment Share on other sites More sharing options...
joe Posted August 21, 2006 Report Share Posted August 21, 2006 Hello Teoman! I think you are saying that you want to insert "writeme" after each 10th line in the target text file. To do this you will need to use the Process Text File, Append to Text String, and Save Text String to File commands. You first need to count the lines and then divide by 10. The result is how many times you will need to loop because you are inserting at every 10th line. Set up a Repeat Loop from 1 to whatever the number is and increment by 10 each time. Use the Process Text File construct inside the loop. The line you want to start with is your counter. The number of lines to process is 10. Within this construct, append the next text line and a CR/LF to a fixed text variable, say %T10%. Essentially you are reading the text file into a variable one line at a time. Place an Append to Text String command after the End Text Process command. The text to append is "writeme" plus a CR/LF. At the end of the Repeat Loop, you will want to process the remaining lines so they too are appended to your fixed string. After that, just write the fixed string back to a text file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.