Teddy Posted July 15, 2004 Report Share Posted July 15, 2004 I have a text file full of oneliners. What I want to do is create a macro that posts a completely random line from the file to a certain window. I have been looking at the random functions, but I cannot see how this can be done Quote Link to comment Share on other sites More sharing options...
joe Posted July 16, 2004 Report Share Posted July 16, 2004 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 Quote Link to comment Share on other sites More sharing options...
Teddy Posted July 18, 2004 Author Report Share Posted July 18, 2004 Thanks Joe, that is a very neat little script. What i don't understand how does it know what variable to put the text in? I don't see T2 referenced anywhere. Is there a good place to read up on the use of variables? Quote Link to comment Share on other sites More sharing options...
msiivola Posted July 18, 2004 Report Share Posted July 18, 2004 T2 seems to be defined in line "Text File Begin Process: "email2.txt" Click the line open, so you see it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.