Jump to content

Incrementing DOWN command?


Recommended Posts

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 post
Share on other sites

$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 by Burrup

qq

Link to post
Share on other sites

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 post
Share on other sites

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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...