Alan Posted April 15, 2005 Share Posted April 15, 2005 I have included my total script at the end of this POST. What this script does is open an excel file and save it as a TAB delimited text file. The script runs one time, selects the first excel file in the OPEN dialog box, opens it, and then saves it as a TAB delimited text file. However, what I want to be able to do is to run this complete script 800 times and each time I want to select the next excel file (there are 800 of them) to open and save as a TAB delimited text file. Midway through the script I have put some comments around that part of the script where I need to increment the DOWN command by one each time the complete script is run so it will select the next excel file to open. Just as a note, I know I also need to add the command at the beginning and end of the script to repeat the complete script 800 times. I think I know how to do that. What I need help with is incrementing the DOWN command in the middle of the script so it will select the next file to open. Can anyone help me solve this problem? Thanks in advance! ; =========== Scriptlet Starts Here =========== Send, ^{ESC} Send, {UP 7} Send, {RIGHT}{ENTER} Send, {LEFT} send, {DOWN 3}{ENTER} WinWaitActive, Microsoft Excel - PERSONAL Send, !{F}{ENTER} Repeat, 4 Send, {TAB} EndRepeat Send, {RIGHT}{ENTER} Repeat, 6 Send, {TAB} EndRepeat Send, {DOWN} Send, {DOWN} Send, {DOWN}{ENTER} Send, {DOWN} ;============= ;INCREMENT THE {DOWN} COMMAND TO SELECT NEXT INDIVIDUAL EXCEL FILE EACH TIME THE TOTAL SCRIPT LOOPS Send, {DOWN}{ENTER} ;============= Send, {TAB} Send, {TAB} Send, {TAB}{ENTER} Send, !{F} Send, {DOWN} Send, {DOWN}{ENTER} Send, {TAB} Send, {DOWN} Send, {DOWN} Send, {DOWN} Send, {DOWN}{ENTER} Send, {TAB} Send, {TAB} Send, {TAB} Send, {UP} Send, {Up} Send, {Up}{ENTER} Send, {TAB} Send, {TAB} Send, {TAB} Repeat, 9 Send, {DOWN} EndRepeat Send, {DOWN}{ENTER} Send, {TAB} Send, {TAB} Send, {TAB}{ENTER}{ENTER}{ENTER} Send, !{F} Repeat, 7 Send, {DOWN} EndRepeat Send, {DOWN}{ENTER} Send, {RIGHT}{ENTER} ; =========== Scriptjlet Ends Here =========== Link to comment Share on other sites More sharing options...
automagician Posted April 15, 2005 Share Posted April 15, 2005 Do you mean the first time through press down once, the second time press down twice, etc? If that is the case, just put that one Send("{DOWN}") in a loop that loops $n times, and just keep incrementing $n. Is that what you meant? Link to comment Share on other sites More sharing options...
Alan Posted April 15, 2005 Author Share Posted April 15, 2005 Yes this is what I want to do. However, I do not know how to do the loop correctly. Can you help? Link to comment Share on other sites More sharing options...
buzz44 Posted April 15, 2005 Share Posted April 15, 2005 (edited) $n = 1 $Count = 0 While $Count <> 800 Send("{DOWN " & $n & "}") $n = $n + 1 $Count = $Count + 1 Wend Using a While...Wend loop is just one way of doing this, you could also use a Do...Until and a For...Next Loop Edited April 15, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
automagician Posted April 15, 2005 Share Posted April 15, 2005 (edited) $i = 1 Do ; All your other code Send("{DOWN " & $x & "}") ; All your other code $i = $i + 1 Until $i = 800 Edited April 15, 2005 by automagician Link to comment Share on other sites More sharing options...
Alan Posted April 15, 2005 Author Share Posted April 15, 2005 Thanks for the help! I'll give it a try... Link to comment Share on other sites More sharing options...
Alan Posted April 15, 2005 Author Share Posted April 15, 2005 Automagician I entered all the code as follows but I get an AutoIt Error that says: Line1: $1=1 Error: Unknown command $i = 1 Do ; All your other code Send, ^{ESC} Send, {UP 7} Send, {RIGHT}{ENTER} Send, {LEFT} send, {DOWN 3}{ENTER} WinWaitActive, Microsoft Excel - PERSONAL Send, !{F}{ENTER} Repeat, 4 Send, {TAB} EndRepeat Send, {RIGHT}{ENTER} Repeat, 6 Send, {TAB} EndRepeat Send, {DOWN} Send, {DOWN} Send, {DOWN}{ENTER} Send, {DOWN} Send("{DOWN " & $i & "}") ; All your other code Send, {TAB} Send, {TAB} Send, {TAB}{ENTER} Send, !{F} Send, {DOWN} Send, {DOWN}{ENTER} Send, {TAB} Send, {DOWN} Send, {DOWN} Send, {DOWN} Send, {DOWN}{ENTER} Send, {TAB} Send, {TAB} Send, {TAB} Send, {UP} Send, {Up} Send, {Up}{ENTER} Send, {TAB} Send, {TAB} Send, {TAB} Repeat, 9 Send, {DOWN} EndRepeat Send, {DOWN}{ENTER} Send, {TAB} Send, {TAB} Send, {TAB}{ENTER}{ENTER}{ENTER} Send, !{F} Repeat, 7 Send, {DOWN} EndRepeat Send, {DOWN}{ENTER} Send, {RIGHT}{ENTER} $i = $i + 1 Until $i = 2 Link to comment Share on other sites More sharing options...
Developers Jos Posted April 15, 2005 Developers Share Posted April 15, 2005 you are mixing Version 2 and Version 3 syntax!!! SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
buzz44 Posted April 15, 2005 Share Posted April 15, 2005 I thought it looked a bit funny lol, with Repeat, 9. I thought he was just showing us that he wanted it repeated 9 times lol. qq Link to comment Share on other sites More sharing options...
automagician Posted April 15, 2005 Share Posted April 15, 2005 Yes, I thought something was strange with that too... Alan, you should upgrade to v3, the syntax is slightly different, but the code that I gave you will work in v3.....sorry for the mixup. Link to comment Share on other sites More sharing options...
Alan Posted April 15, 2005 Author Share Posted April 15, 2005 Automagician Thanks for the heads up. I will convert to V3. Link to comment Share on other sites More sharing options...
quaizywabbit Posted April 15, 2005 Share Posted April 15, 2005 If your tab delimited files have the same name as the corresponding excel files then you could check each excel file to see if it had a corresponding tab delimited file, If true then move to next excel file, if not, create one. [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
Alan Posted April 18, 2005 Author Share Posted April 18, 2005 quaizywabbit Thanks for the suggestion. I like it the idea because then I don't have to know exactly how many files I have and then have to loop exactly that many times. Unforetunately being completely new to programming and using AutoIt I was wondering if you could help kick start me by giving me some code ideas on how to implement it. I thank all you guys for being on the forum and for your willingness to help a newbee. Alan, Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now