Jump to content

.NET Downloads file and autoit to save file


Recommended Posts

Hello,

I'm a developer taking over an existing developers code and he is using AutoIT to save files to a specific directory when the save dialogue box comes up. He does this until the loop in .NET finishes but I'm having trouble figure out why the code only executes after the first time it runs.

Here's in an example of the script:

While (True)
WinWaitActive("File Download")
Sleep(1000)
Send("!{s}")
Sleep(500)
WinWaitActive("Save As")
Send("{HOME}C:PRPTempFedExRAW")
Send("!{s}")
WinWaitActive("Download complete", "Close")
Send("{ENTER}")
WEnd
 
So if I have three records to download from .NET application the first record will download correctly but the next three I have to manually click the save button.
 
Any ideas on how to make sure this code executes every time?
 
Thanks in advance :)
Link to comment
Share on other sites

Probably its is waiting on one of the windows that is not appearing, add console writes and see which one.

While (True)
ConsoleWrite("File Download")
WinWaitActive("File Download")
Sleep(1000)
Send("!{s}")
Sleep(500)
WinWaitActive("Save As")
ConsoleWrite("Save As")
Send("{HOME}C:\PRPTemp\FedExRAW\")
Send("!{s}")
ConsoleWrite(("Download complete")
WinWaitActive("Download complete", "Close")
Send("{ENTER}")
WEnd
Link to comment
Share on other sites

That example seems incomplete.

For starters, there appears to be no way out of the While...Wend loop, except if somehow False is introduced.

Otherwise I just imagine the code keeps running non-stop, until something kills the program.

Generally, most use While 1 .... Wend, and then have some kind of check that gives an eventual ExitLoop.

Why a bracketed True is used instead of 1, I don't know.

So as it appears to me, the significant portion of code is missing, especially as you say it all completes correctly for the first download.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Yes the program run infinitely and I kill the program when windows app is completely finished. I wasn't able to change the script because when I compiled the program my company's antivirus prevented it. So what I'm doing is stopping the existing process and restarting it for every download which seems to work in the mean time so thanks guys for your input.

Link to comment
Share on other sites

Did you have UPX compression selected when compiling?

It might compile without that, if you did?

Obfuscation may even be a cause, if that was selected?

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...