Jump to content
Macro Express Forums

Easy Crlf Question


Cory

Recommended Posts

I’m being lazy and thought I would ask instead of experiment. Sorry!

 

I want to write a series of strings to a string variable but I want to have them on separate lines. In the Variable Modify String Append to Text file you can add a carriage return. I want to do that but just keep adding it to a sting var instead of writing a file.

 

My question is do I need both the CR and LF to do this? I’ve seen other’s macros where they create the CR and LF character from decimal and merge them to a string var and then use that. I think it was decimal 10 and 13.

 

In practice what I am using this for is for a simple search tool. I can buzz thru a list of suspects and write all the matches to a string var. Then, to my surprise, I found you can write this to the multiple choice dialog box! Sweet. People can just choose one then. I don’t even need to keep track of them as I can pass them on as the actual text values.

Link to comment
Share on other sites

I've always used the following becaue I have just assumed that you need CR & LF together:

 

// Set CRLF
Variable Set %T95% to ASCII Char of 13
Variable Set %T96% to ASCII Char of 10
Variable Set String %T95% "%T95%%T96%"
// Set CRLF
// Set TAB
Variable Set %T94% to ASCII Char of 9
// Set TAB

<REM2:Set CR><ASCIIC:95:1:13><ASCIIC:96:1:10><TVAR2:95:01:%T95%%T96%><REM2:Set CR><REM2:Set 
TAB><ASCIIC:94:1:9><REM2:Set TAB>

 

This is probably similar to what you've seen in other posts. It works and I really haven't thought to try it any other way.

 

I frequently use the TAB character also.

Link to comment
Share on other sites

Exactly what I've seen. I think I'll just have to copy that.

 

I'm still curious if you really need both. I'm just thnking back to my report writing days and I don't remember a need for two char's. BoF,EoF and CR was about it.

Link to comment
Share on other sites

OK, now I see. Newline is only LF in Unix but you need both in MS.

 

FYI I tried both by themselves and they didn't work. It must be CRLF.

 

How come this isn't built into ME of it's used so much? <don't hit me>

 

Thanks for the good example.

Link to comment
Share on other sites

In your little routine you can eliminate a var. Do as you in the CRLF section then recycle the now unused var for the TAB.

 

It's a nit pick, I know. I just can't help looking for ways to improve stuff. <g>

Link to comment
Share on other sites

Or to take it further, use no strings at all; or only 2, and then empty them;

I have started using environment variables a lot more as I only need to keep track of their names, not whether I've used them before;

// Set CR

Variable Set %T95% to ASCII Char of 13

Variable Set %T96% to ASCII Char of 10

Variable Set String %T95% "%T95%%T96%"

Variable Modify String: Save %T95% to Environment Variable

// Set CR

// Set TAB

Variable Set %T95% to ASCII Char of 9

Variable Modify String: Save %T95% to Environment Variable

// Set TAB

Variable Set String %T95% ""

Variable Set String %T96% ""

Text Box Display: CRLF etc using Environment variables

 

<REM2:Set CR><ASCIIC:95:1:13><ASCIIC:96:1:10><TVAR2:95:01:%T95%%T96%><TMVAR2:19:95:00:000:000:CRLF><REM2:Set CR><REM2:Set

TAB><ASCIIC:95:1:9><TMVAR2:19:95:00:000:000:TAB><REM2:Set TAB><TVAR2:95:01:><TVAR2:96:01:><TBOX4:T:1:CenterCenter000278000200:000:CRLF etc using Environment variablesHi%CRLF%2nd line>

Best, Randall

Link to comment
Share on other sites

You only have to create them once for each macro session (till you terminate Macro Express session)! Sure, they are not preserved, but that is good as far as I'm concerned; I wouldn't want to have to keep track of them and empty them after each macro session. (They would clog memory eventually)

My point is the lack of having to remember which "T string"variables to use.

Best, Randall

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