Jump to content
Macro Express Forums

Processing Two Text Files At Once


Recommended Posts

I've got two text files. One has the path of a list of files, about 5,600 of them. The other has folder names in which each file belongs. Here's an example of both:




1750 Springhill Avenue
1750 Springhill Avenue
185 Louiselle Street
1855 Springhill Ave. - The Orthopaedic Group
192 Louiselle Street
192 Louiselle Street
192 Louiselle Street
192 Louiselle Street


I need a way to process both files at the same time so I can get the first variable from each file, and use them both to move the file to a new folder. I can do all of that, it's just getting the two variables at the same time that I'm having problems with. Can anyone help?


An easy workaround might be to merge the two text files together, each line in one file corresponding to its mate in the other file, seperated by something like a comma. But I'm not really sure how to do that, either.

Link to comment
Share on other sites

You can do it either way. Here is an example that uses two files:

Variable Set Integer %N1% to 0
Text File Begin Process: "MIMC.txt"
 Variable Modify Integer: Inc (%N1%)
 Text File Begin Process: "folder.txt"
   // Here T1 contains the filename and T2 contains the folder
 Text File End Process
Text File End Process

To see the values inside the Text File Begin Process commands, copy this and paste it into your macro:

<IVAR2:01:01:0><BTFBEG:001:000001:000000:e:\MIMC.txt><NMVAR:08:01:0:0000001:0:0000000><BTFBEG:002:N00001:000001:e:\folder.txt><REM2:Here T1 contains the filename and T2 contains the folder><BTFEND><BTFEND>

The macro is much simpler if you merge the two files first. For this approach you need to create a file that looks like this:

E:\MIMC-Archives\11-99\87454.TIF,"1750 Springhill Avenue"
E:\MIMC-Archives\11-99\87453.TIF,"1750 Springhill Avenue"
E:\MIMC-Archives\06-99\088412.TIF,"185 Louiselle Street"
E:\MIMC-Archives\06-99\088411.TIF,"1855 Springhill Ave. - The Orthopaedic Group"
E:\MIMC-Archives\06-99\088415.TIF,"192 Louiselle Street"
E:\MIMC-Archives\05-99\09038-22.TIF,"192 Louiselle Street"
E:\MIMC-Archives\05-99\09038-3.TIF,"192 Louiselle Street"
E:\MIMC-Archives\05-99\09038-1.TIF,"192 Louiselle Street"

Then use this simpler macro:

ASCII File Begin Process: "FileFolder.txt" (Comma Delimited Text )
 // Here T1 contains the filename and T2 contains the folder
ASCII File End Process

Link to comment
Share on other sites

Why do you do this?

Variable Modify Integer: Inc (%N1%)

When I tried to put a file processing loop inside of another one, it got stuck in the one inside and kept repeating there and wouldn't move onto the next line in the first file.


(and in order to merge the text files, i'd need to do it with ME, which would require me to process 2 files at the same time which is where the problem is, I guess)



OH. I see, incrementing N1 makes it start at line N1 instead of simply incrementing where it was last. THAT's the part I was missing. Thanks!

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