Hey guys, total newbie here, hoping you guys could lend me a hand. I've done some Googling, but I think I am having trouble phrasing what I am trying to do.
Basically, I have a task that involves copying data from a spreadsheet and copying it into another sheet on a daily basis. The two sheets are structured exactly the same every day, so I figured it would be a good candidate for an AutoIT script. Essentially, I am trying to create a loop that will go through each column and copy out the data that I need. While creating the loop, I found that there were several sections where 4-10 of the steps were exactly the same, before going to a new line and having to select different cells/areas. What I would like to do is create functions for these repetitive steps, call them, then continue on with the loop. Example pasted below:
Function:
Func Excel()
$i=0
while $i = 0
Send("^c")
$i=$i+1
sleep(300)
WEnd
while $i = 1
MouseClick("left", 450, 1060, 1)
$i=$i+1
sleep(300)
WEnd
while $i = 2
Send("^v")
$i=$i+1
sleep(300)
WEnd
while $i = 3
Send("{RIGHT}")
$i=$i+1
sleep(300)
WEnd
while $i = 4
MouseClick("left", 450, 1060, 1)
$i=$i+1
sleep(300)
WEnd
EndFunc
Then, after writing the function, I am trying to call it in a loop as seen below:
while $i = 1
MouseClick("left", 450, 1060, 1)
$i=$i+1
sleep(300)
WEnd
while $i = 2
Send("^v")
$i=$i+1
sleep(300)
WEnd
while $i = 3
Send("{RIGHT}")
$i=$i+1
sleep(300)
WEnd
while $i = 4
call("excel")
WEnd
EndFunc
while $i = 5
MouseClick("left", 450, 1060, 1)
$i=$i+1
sleep(300)
WEnd
ETC...
Essentially, the issue I am having, is that the function is successfully called and executes properly, but the loop stops at the function and will not continue on to the next step ($i = 5 in this case).
That is the gist of it, hopefully I explained it adequately. I am just starting out on this, so I'm sure the code could be tightened up, and I appreciate any time and responses I receive.
Thanks,
Madrocks