Sign in to follow this  
Followers 0
mikeyr

waiting for IE to do something

11 posts in this topic

I am working on automating a web app that I use daily for repeated steps. I have it working up to the 6th page, on this page when I click on the "submit" button it goes and reads a XML file to fill in a database with the XML data, it works fine for one file but this web app has a 15,000 record per import limit and I input between 65,000 and 70,000 so I have my code breaking up my large XML file into x parts at 15,000 records per file.

This means I have to wait while IE imports the data and returns so that I can give it the next XML file, how do I wait ? I tried _IELoadWait but as soon as the page is loaded it continues on.

I am thinking I need to "read the screen" in a loop, the text on the screen while loading is

Import Status

Processing data...

x records processed:

x records added

x records replaced

x records already existed and were skipped

This page will automatically refresh every 10 seconds

This is done with a "Autorefresh" and ideally I want a way to wait until the refreshing is done. Failing that, since after its done loading it comes back with

The last data import for this collection successfully finished.

15,000 records processed:

14,998 records added

2 records replaced

0 records already existed and were skipped

I am thinking I can read the HTML for something like "finished" in a little loop and then enter the next file and do it all over again. The other thought is to go in "Sleep" for 15-20 minutes.

Looking for suggestions, right now I am going to code in the "Sleep" idea since that should work but would prefer a way to tell when the refreshing is finished.

Is there a better way ? unfortunately the HTML title is the same for both windows/forms so I can't read that to see when it is finished.

Mike

Share this post


Link to post
Share on other sites



Loop, read page, look for your text, loop or exit

While 1
    _IELoadWait($oIE) ; wait for any refreshes to complete
    If StringInStr(_IEBodyReadText($oIE), "The last data import for this collection successfully finished.") Then ExitLoop
Wend

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Loop, read page, look for your text, loop or exit

I wrote it last night with Sleep because I did not think that reading the screen would be that easy, after it was working with Sleep (a very poor way to do it since I had to allocate 15minutes when it usually only takes 4-6 minutes), I started reading about how to read the page, it sure looked easy and then this morning this gem was here and its even easier than I thought, THANKS.

Thanks, I am off to code it and finish my first real program with autoit...

Share this post


Link to post
Share on other sites

It worked, first time,no edits, just straight cut/paste and bingo it worked.

Look out MySQL here comes 70,000 records :)

Thanks again.

Share this post


Link to post
Share on other sites

Congrats!

I just noticed I forgot to put a Sleep command in that idle loop example... the way it is written will make your CPU fan get some exercise... Suggest you add Sleep(100) before the WEnd

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Good idea with that sleep, done, thanks !

Mike

Share this post


Link to post
Share on other sites

Loop, read page, look for your text, loop or exit

While 1
    _IELoadWait($oIE) ; wait for any refreshes to complete
    If StringInStr(_IEBodyReadText($oIE), "The last data import for this collection successfully finished.") Then ExitLoop
Wend

Dale

Hi Dale,

I have the same kind of problem, but for some reason I can't make it work. It gives me an error message that I should declare the variable...

Sorry for disturbing you with this, but I desperately need some help with this. The problem is that I'm not a programmer, and just need THIS function, so I don't have the time to get through all the manuals to find the answer to my question...so a "put this line here" type of answer would be really-really nice.

Thanks a lot!

b0ris

Share this post


Link to post
Share on other sites

Hi Dale,

I have the same kind of problem, but for some reason I can't make it work. It gives me an error message that I should declare the variable...

Sorry for disturbing you with this, but I desperately need some help with this. The problem is that I'm not a programmer, and just need THIS function, so I don't have the time to get through all the manuals to find the answer to my question...so a "put this line here" type of answer would be really-really nice.

Thanks a lot!

b0ris

the error message showed all, you forgot to declare the variable or you have put it after the code line request for it, if possible, please post your code here, then some1 can help you

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Share this post


Link to post
Share on other sites

the error message showed all, you forgot to declare the variable or you have put it after the code line request for it, if possible, please post your code here, then some1 can help you

Thanks for the quick reply.

The code is not so important as you can see below:

#Include <IE.au3>

;$oIE = 5000

Opt("WinWaitDelay",4000)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

MouseMove(277,1008)

MouseDown("left")

MouseUp("left")

Sleep(2000)

MouseMove(133,35)

MouseDown("left")

MouseUp("left")

Sleep(200)

MouseMove(166,486)

MouseDown("left")

MouseUp("left")

sleep(5000)

;While 1

; _IELoadWait($oIE) ; wait for any refreshes to complete

;Wend

MouseMove(383,383)

MouseDown("left")

MouseUp("left")

I know you are right, but I have no idea how to declare the variable this time.

Thanks for your help in advance!

Share this post


Link to post
Share on other sites

You'll find dozens of examples of using the _IE* functions in the helpfile. Every one of them is a stand-alone, fully functional code example and any one of them will demonstrate to you what you are missing and need to include in your code.

Please have a look.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

You'll find dozens of examples of using the _IE* functions in the helpfile. Every one of them is a stand-alone, fully functional code example and any one of them will demonstrate to you what you are missing and need to include in your code.

Please have a look.

Dale

Thanks a lot dude! Finally I could find some examples to start with. I don't know why I haven't figured out how to start searching for it...maybe just got used to usual windows crappy help files with no use at all. This one's really good for the first look, so I'll try to figure out how to write some real apps now.

Thanks again!

Share this post


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
Sign in to follow this  
Followers 0