Jump to content

Wait Time for Rare Execptions


Recommended Posts

After clicking on a link the software waits for the screen to be painted, specifically looking for a pixel color at a sepecific location. Once there the software continues. I have found utilizing this method as opposed to the StatusbarGetText for "Done" satisfy some speed issues.

The problem becomes some of the links will execute a Javascript and no way to determine when it will popup a Warinig: Javascript window.

So this happens very rarely so do not want to code a wait time for this possible window and a response because 99% of the time it will not appear. I would have a extreme amount of wait for something that will not happen.

Could someone provide a solution as to avoid wait time for a window that most likely will not appear; ie how to anticipae a Javascript that may or may not execute. Can you determine a specific Javascript is execying after clicking on a link.

Thank you,

Fred

Link to comment
Share on other sites

Well, without code to work off, I'd recommend (and do take this with a grain of salt, as I'm making a blind recommendation) that you try and test for the window's existence with WinExists().

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

Thanks for the response and suggestion. The problem becomes how long do I wait before checking for the existance of the window, if it pops up. If I code for 3 seconds, due to possible slow speeds, at times, then 3 seconds are lost 99% of the time. We process 100s of emails a day with this application.

The actual popup Javascript window displays a split second after the linked data but can vary depending on the traffic, load, etc, etc.

This could be a command I may need to use (with a sleep function) if I cannot come up with a function to handle varying response times.

Thank you again.

Fred

Link to comment
Share on other sites

I might suggest putting a timeout of some sort, so that if it the pixel test hasn't come up positive after say 3 seconds, to check for the Javascript window. If there is the window, then great, otherwise log as abnormal and go back to checking for the pixel for another 3 seconds. Rinse and repeat a few times before throwing a fatal error. This way you have 4 possible cases:

1: Pixel comes up in < 3 seconds = wonderfull

2: Javascript window comes up = wasted 3 seconds, but oh well, it only happens once in a while.

3: Pixel comes up after 3 seconds = no problem, we wasted a few cycles checking for the window, but considering how long it took the data to come back it's not a big deal

4: Neither Javascript window nor pixel comes up after, let's say, 9 seconds = Big problem with connectivity/something else. It should warn you and fail before mangling any data trying vainly to continue

Just my thoughts, like I've said, I havn't seen your code, so this is pretty much a shot in the dark.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

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...