Jump to content
Macro Express Forums

Increasing Text Inputs With A Loop?


kmaster

Recommended Posts

Hello.

 

 

Here is my question.

 

I have a list of names , lets say 100 each on a separate line. I want to take them one at a time and set the variable in a macro that loops until they are all completely added in.

 

Example List:

 

apple

orange

grape

cherry

peach

 

Lets say I have a website and I want to create a folder for each of these variables.

 

I want my macro to first grab the text file

then read how many lines there are

then make a directory for the each line with the text from that line

when their are no more lines, then I want my macro to continue.

 

How do I get it to do this???

 

 

thanks for the help

Link to comment
Share on other sites

Welcome to the group!

 

What you want is fairly simple. Let's say the file of names is called fruit.txt, and it contains what is in your example. Furthermore, we will assume that you are creating folders in c:\temp. The primary commands you need are Text File Process and Create Folder. Do this:

// Create folders.
Text File Begin Process: "fruit.txt"
 Create Folder: "c:\temp\%T1%"
Text File End Process

<REM2:Create folders.><BTFBEG:001:000001:000000:c:\temp\fruit.txt><DOFILE:02:NN:c:\temp\%T1%>><BTFEND>

To count line in a file do this:

// Count the lines in a file saving results to N1.
Variable Set Integer %N1% to 0
Text File Begin Process: "fruit.txt"
 Variable Modify Integer: Inc (%N1%)
Text File End Process

<REM2:Count the lines in a file saving results to N1.><IVAR2:01:01:0><BTFBEG:001:000001:000000:c:\temp\fruit.txt><NMVAR:08:01:0:0000001:0:0000000><BTFEND>

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