Jump to content
Macro Express Forums

Read Random Line From Text File


Teddy

Recommended Posts

Hello Teddy!

 

Here is a short macro that will do the trick:

Variable Set Integer %N1% to 0
Text File Begin Process: "email2.txt"
 Variable Modify Integer: Inc (%N1%)
Text File End Process
Variable Set Integer %N2% with a Random Number
Text File Begin Process: "email2.txt"
Text File End Process

I've attached the .mxe file.

 

The first loop counts the lines in the text file and saves the value to N1. Then the N1 variable is used to set the maximum value for the Random Number command, which creates a random value for N2. The second loop simply processes a single line in the text file using the N2 variable, saving the single line to the T2 variable.

RandomLine.zip

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