prufrock101 Posted May 23, 2008 Report Share Posted May 23, 2008 I have a file and a macro loop. I want part of the macro loop to involve typing or pasting a different line from the file each iteration... the first iteration will use the first line, the second iteration the second line... etc. I can't seem to figure out how to do this. Help? Thanks Quote Link to comment Share on other sites More sharing options...
rberq Posted May 23, 2008 Report Share Posted May 23, 2008 I have a file and a macro loop. I want part of the macro loop to involve typing or pasting a different line from the file each iteration... the first iteration will use the first line, the second iteration the second line... etc. I can't seem to figure out how to do this. Help? If it's a text file, and not too huge, try something like this: Launch notepad passing it the file name (or just open it manually if this is a one-time chore) Type CTRL_Home to position at beginning of file Repeat begin Type Shift_End to highlight current line of file Type CTRL_C to copy line to clipboard Check whether it is time to exit from repeat loop Type Home and arrow down to position to next line of file Activate window that you want to paste into Type CTRL_V to paste from clipboard Activate notepad window Repeat You will have to use some kind of logic to exit from the loop at end of file. Maybe insert a dummy line of funny characters that you can check for after you copy into the clipboard. Alternatively, I think the help screens or the online knowledge base describe a better technique of bringing the whole file into a variable, then indexing through the variable to handle one line at a time. I've never done it and I don't know the details. Quote Link to comment Share on other sites More sharing options...
stan Posted May 23, 2008 Report Share Posted May 23, 2008 It sounds like you would want to use the Text File Begin Process. This file reads the first line of the file and saves to a variable. Do what you need with the variable and close the loop with a Text File End Process command. The macro then loops back and reads line 2 of the file, and so on until the end of the file. The help topic explains this in more detail. 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.