Jump to content
Macro Express Forums

Reading Variables from a text file


Recommended Posts

I'm new to ME variables so please don't jump on me if this is a stupid question. I have a text file with each line being a person's name. I want to use a macro to type that name into a application I use. I know how to do that for a literal but reading up I think the VARIABLE FROM FILE reads in the whole file as a single variable.


1. Is that assumption true?

2. If so, how do I get T1,T2,T3,T4...T99 to each be a name from the sequence? There is a CR after each name.


ANY help would be greatly appreciated. I have the rest of the macro done but I have no idea how to change the value of the variable or how to assign each line to a new variable (I suppose redefining T1 with a new name would be more efficient-can that be done?????)


Thank yo SO much for any assistance.



Link to comment
Share on other sites

  • 1 year later...

I've got a problem with this type of function.....


Big picture, I just want to pull individual variables from each line in the CSV and then have them treated as individual variables unique to only one line in the CSV.


I've read every help file I can find, I've read every forum post that I can find, I bought a book on macro express, I bought macro express pro...I'm days and days into trying to figure this out with no luck.



Originally, when I have a CSV file, it might look like this:


Thinger1, Dinky1, Ferbix1


Thinger2, Dinky2, Ferbix2


Thinger3, Dinky3, Ferbix3


Thinger4, Dinky4, Ferbix4


I'll then process the ASCII file starting with variable T1

T1 will then contain:







But instead, I JUST want it to contain:




I then attempted to use the split string function to separate Line 1 (Thinger1, Dinky1, Ferbix1) into individual elements with a new variable that I created:

Variable1: Thinger1

Variable2: Dinky1

Variable3: Ferbix1


After I'm done processing line 1, I will need to then start with line 2 (Thinger2, Dinky2, Ferbix2) and also have each of those individual elements that I can use. For example, I just then want T1 to contain Thinger2. I don't care if it becomes "T4", I just want it to be an individual element and not an array of values that can't entered into a field online.


One problem is that there are no real examples of how to do this. There are all sorts of variables within the ASCII process function that seem to change things. Such as whether to process the file into an array or not. If I dont process into an array, it tells me that the variable is too short and dumps my macro. I have the same problems when I try to split strings....the end result is seen in some examples, but individual small changes when the code is built have bearing on how all this cooperates. I cant make any sense of it.



Please help!!

Link to comment
Share on other sites

The Text File Begin/End Process commands get the entire line into a variable. The ASCII File Begin/End Process command will divide each element on a line into separate variables. If the information is in the wrong variables you can copy from one variable to another inside the Begin/End process loop.

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