abyss8000 Posted January 3, 2008 Report Share Posted January 3, 2008 Im trying to learn more about how to pull variables. For example, (and only an example) How would I, first open a webpage, say yahoo, and pull a phrase from a text file on my computer, click go to search. The part I cant figure out is how to make a text file with a list of things to search and have it rotate through that list of phrases. I am new to this and cant find a lot about "intro to variables" I am sure seeing this script would help me much better understand. Any assistance is GREATLY appreciated. PS Happy New Year everybody! Quote Link to comment Share on other sites More sharing options...
stan Posted January 4, 2008 Report Share Posted January 4, 2008 You would use the Text File Begin Process command. It works similar to a repeat loop. What it does is reads the first line of the file and saves the contents to a variable such as T1. Your macro would be structured something like this. After it searches for the first item in the text file, it repeats the process for the second line of the file and so on until finished. Text File Begin Process: "Sample.TXT" Command to open the web page. Open the Search field. Text Type: %T1% - This will type the text from the text file into the Search field. Rest of steps after entering the search Text File End Process Quote Link to comment Share on other sites More sharing options...
abyss8000 Posted January 4, 2008 Author Report Share Posted January 4, 2008 Awesome, Thanks so much Stan. I have a much better understanding now except for 2 things, it just opened a bazillion int explorer windows, I'd like to use the same one if possible. Also, how do I open the search field? Because I tried it with google, the cursor is automatically in the search box, so i cheated and just told it to press enter. I'd like to learn how to open the search box properly. Thanks so much! Quote Link to comment Share on other sites More sharing options...
stan Posted January 4, 2008 Report Share Posted January 4, 2008 Here's what I would do. Open the web page first. Each time through the loop, activate the IE window. If you never leave the IE window during the entire process, then leave out the Activate Window command. Use the Text Type command to press Ctrl f to open the Find window. Web Site: http://www.macros.com [internet Explorer - Wait to load] Text File Begin Process: "Sample.TXT" Activate Window: "IE Web Page" Text Type: <CONTROL>f - Opens the Find window in IE or the Find box in Firefox Text Type: %T1% - This will type the text from the text file into the Search field. Rest of steps after entering the search Text File End Process Quote Link to comment Share on other sites More sharing options...
abyss8000 Posted January 5, 2008 Author Report Share Posted January 5, 2008 Stan you are the greatest!!! Thank you so much. I have everything working but theres one little catch. I have 2 variables. T1 and T2. It is processing all of the data from the first variable text file while only posting the first line of the 2nd variable. if I switch the "text file begin" around and raise T1 above T2, it switches and processes only the first line of the variable T1 text file and processes all of the data from the 2nd text file in order. What I need to do it have it process 1 line from T1 and 1 line of T2, then line 2 of T1 and line 2 of T2... etc etc.... is this possible? Maybe this could be done be deleting a variable from the 2nd text file after it uses it. that would work for me also. Thanks so much!!! Quote Link to comment Share on other sites More sharing options...
stan Posted January 7, 2008 Report Share Posted January 7, 2008 Here's what I would suggest. At the beginning of your macro insert the Variable Set Integer command and set N1 to 1. Process Text File 1 as you normally would. In the Text File Begin Process edit window for the second file, Start Processing on record N1. Only Process Partial Records - enter 1 as the number of records to process. Before the End Process command insert a Variable Modify Integer command and choose the Increment option. This is what the above will do. The first line of File one is saved to T1. The first line of File 2 is saved to T2 because we instructed this command to start processing on line N1 - which is 1. It is only processing the one line. When it is finished, it bumps the value of N1 to 2. So the next time through the cycle, line 2 of both text files are processed and so on. 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.