Jump to content
Macro Express Forums

Newbie "how To Question


Recommended Posts

I am very new to M.E. having used it for about two months, I have gone through the tutorials and the help and have not been able to find what I need.


I want to take a line from a text file (random length) such as:


"This is the information I want to learn today."


I want to have Text typed to breakup each word with simple HTML code-- I have setup T1, T2, T3 to represent the simple code and I have so far gotten it to process a few words but I don't know how to get it to continue to the end of the line copy and paste to another text file then move down one line and process another line.

Link to comment
Share on other sites

I’m not 100% clear what you are trying to do but it sounds like you are taking a multi line text file one line at a time and adding HTML tags to the plain text which you then want save in another file. I don’t know what HTML you want to use but let’s say you wanted to color each other line red white and blue. If this is the case….


One thing that jumps out is that you referenced the command Text Type. If I understand you correctly I would not use this command to accomplish this task. Also it sounds as if you are trying to use some editor interactively to create this file Again, I would make my life simpler by not using any external application but rather doing it all internal in ME.


In order to do this you need to understand a little better about using invisible characters like CRLF and such. I wrote a subroutine you can get at my website to generate CRLF and tabs you might want to look at and I also wrote up a deal about using a hex editor. Now you don’t need to use a hex editor but it would help lift the veil for you. Click here to get to my main macros page.


Let me give you a brief idea of how I might approach such a problem. Now bear in mind simple HTML pages are plain text, this would not work for a compressed Word document.


First I would write my HTML file header. I would set T1 to <HTML> and use Variable Modify String to append it to a text file with a CRLF. Then I would set T1 to nothing and append it to the text file with a CRLF to give a blank line. Then I would set T1 to <body> and write it to the file. See where I’m going? Now I would do a Repeat With File to grab each line and stuff it in T1. Then I would modify T1 to be “<p><font color="#FF0000">%T1%t</font><p>” to make it red. I would then write it to the text file.


Now of course I would have to write some logic in to change the font color each time so that they would alternate but hopefully you get the idea. Does this sound like it would work for you?

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.

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.

  • Create New...