Jump to content
Macro Express Forums

append CR to text file


randallf
 Share

Recommended Posts

Hello,

 

Can anyone help me with how to put an 'enter' or CR in a text file after something like

 

Variable Modify String: Append %T23% to Text File

 

THANKS!

 

To clarify my looped appends look like this

 

STUFF - 12345STUFF - 12345STUFF - 12345STUFF - 12345STUFF - 12345STUFF - 12345STUFF - 12345STUFF - 12345

 

And I want this

 

STUFF - 12345

STUFF - 12345

STUFF - 12345

STUFF - 12345

STUFF - 12345

STUFF - 12345

Link to comment
Share on other sites

I tried

 

Variable Set %T69% to ASCII Char of 10

Variable Modify String: Append %T23% to Text File

Variable Modify String: Append %T69% to Text File

 

But I just end up with ASCII chars inbetween in the .txt file... I tried ASCII 13 as well and nothing seems to work...

 

How do I put a CR/LF in there that 'notepad' will recognize?

Link to comment
Share on other sites

Have you tried clicking the checkbox 'Add Trailing CR/LF' in the Variable Modify String: Append %T13% to Text File command dialog?

 

Here is another approach:

Variable Set %T13% to ASCII Char of 13  // put CR in T13
Variable Set %T10% to ASCII Char of 10  // put LF in T10
Variable Set String %T13% "%T13%%T10%"  // put CRLF in T13
Variable Modify String: Append %T13% to Text File // append to the file

Link to comment
Share on other sites

Have you tried clicking the checkbox 'Add Trailing CR/LF' in the Variable Modify String: Append %T13% to Text File command dialog?

 

Here is another approach:

Variable Set %T13% to ASCII Char of 13  // put CR in T13
Variable Set %T10% to ASCII Char of 10  // put LF in T10
Variable Set String %T13% "%T13%%T10%"  // put CRLF in T13
Variable Modify String: Append %T13% to Text File // append to the file

 

 

Yes sir I just found it thank you :blink:

 

also nice to know how those work in tandem, CRLF that is, as I'd never seen it before (stands to reason)... thanks much!

Link to comment
Share on other sites

  • 3 months later...

Almost similar but this bring me one question with the clipboard

How to Past CR /LF directly in the clipboard

Example

Variable modify sting append “ is red” to T 8%

Variable modify sting append “ is blue” to T 12%

Variable modify sting append T 8% to T 12%

Variable modify sting save T 12% to clpboard

 

I got when I paste the clipboard

the balloon is blue the square is red

but I want to get

the balloon is blue

the square is red

Probably I have to use the clipboard append text but I’m not sure about this one?

 

:angry:

Link to comment
Share on other sites

How to Past CR /LF directly in the clipboard

Example

Variable modify sting append “ is red” to T 8%

Variable modify sting append “ is blue” to T 12%

Variable modify sting append T 8% to T 12%

Variable modify sting save T 12% to clpboard

 

I got when I paste the clipboard

the balloon is blue the square is red

but I want to get

the balloon is blue

the square is red

Probably I have to use the clipboard append text but I’m not sure about this one?

Guliver,

 

For what you're trying to do, you'll have to create a variable which contains the CR/LF values, then append that variable to your %T12% variable before appending the %T8% variable.

 

Try this:

// Based on your post, I will assume %T8% contains "The square" and %T12% contains "The balloon"
Variable Set String %T8% "The square"
Variable Set String %T12% "The balloon"
// First we create the CR/LF variable:
Variable Set %T1% to ASCII Char of 13
Variable Set %T2% to ASCII Char of 10
Variable Modify String: Append %T2% to %T1%
// Now we can do what you were trying to do:
Variable Modify String: Append " is red." to %T8%
Variable Modify String: Append " is blue." to %T12%
Variable Modify String: Append %T1% to %T12%
Variable Modify String: Append %T8% to %T12%
Variable Modify String: Save %T12% to Clipboard

<REM2:Based on your post, I will assume %T8% contains "The square" and %T12% contains "The balloon"><TVAR2:08:01:The square><TVAR2:12:01:The balloon><REM2:First we create the CR/LF variable:><ASCIIC:1:1:13><ASCIIC:2:1:10><TMVAR2:08:01:02:000:000:><REM2:Now we can do what you were trying to do:><TMVAR2:07:08:00:000:000: is red.><TMVAR2:07:12:00:000:000: is blue.><TMVAR2:08:12:01:000:000:><TMVAR2:08:12:08:000:000:><TMVAR2:16:12:00:000:000:>

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...
 Share

×
×
  • Create New...