Jump to content

Recommended Posts

Posted

I use AutiIt to copy/paste a lot of text from one website to another.

Sometimes the server is slow and then my script fucks up because its trying to continue before the page is done loading.

Can u somehow get the script to check for that?

Posted (edited)

If you use AutoSpy to watch a page as it loads, have a look at the section called Status Bar Text.

You can monitor this from your script, and continue only when the right message appears.

EG: (using MSIE), while loading a page, mine gives a whole list of messages while the page is loading, and then a final one that says Done, when it has finished.

This might be different depending on the site(s) and browser you're using. Which is why you need to use AutoSpy to see what's good for you :D

Edited by trids
Posted

..OR..

You can monitor the animation that plays while a file is loading: when a pixel stays the same for a second or two, then you can assume the load has finished.

In MSIE, the animation I'm referring to is the logo in the top right corner, that revolves around a globe.

Again, monitor a page with AutoSpy .. and see how the Pixel Colour Under Mouse section changes while you hover your mouse over the logo.

See the help file for AutoItSetOption ("PixelCoordMode",param) and PixelGetColor if you want to use this approach.

Hope this helps :D

Posted

It's correct that in windows Spy it says:

>>>>>>>>>( Status Bar Text )<<<<<<<<

(1): Done

(2):

(3):

(4):

(5):

(6): Internet

Dos any one know how to set the script to look for (1) to be Done ??

Posted

I move the mouse cursor to the top of the page,

and waits until it turns into a normal arrow.

Works 100 percent.

MouseMove(100, 1, 0)

$x = MouseGetCursor()

Do
$x = MouseGetCursor()
Sleep(500)
Until $x = 2
  • Administrators
Posted

..OR..

You can monitor the animation that plays while a file is loading: when a pixel stays the same for a second or two, then you can assume the load has finished.

In MSIE, the animation I'm referring to is the logo in the top right corner, that revolves around a globe.

Again, monitor a page with AutoSpy .. and see how the Pixel Colour Under Mouse section changes while you hover your mouse over the logo.

See the help file for AutoItSetOption ("PixelCoordMode",param) and PixelGetColor if you want to use this approach.

Hope this helps  :D

The PixelChecksum() function in the new unstable is also cool for things like that.
Posted

Dos any one know how to set the script to look for (1) to be Done ??

I think StatusbarGetText ( "title" [, "text" [, part]] ) is what you're after :D
Posted

Thank you all very much.

I have choosen SlimShady solution because then my scirpt will work on all IE browses no matter what "page is loading" image it's using.

Now i only have one question SlimShady. If the page is reel heavy and take a long time to load the scripts stops.

Why?

Posted

This is what I use,seems to work like a charm

$MousePos = MouseGetPos()

$CursorActivity = MouseGetCursor()

Do

Sleep(500)

MouseMove(100, 1, 0)

$CursorActivity = MouseGetCursor()

Until $CursorActivity = 2 And StatusbarGetText(WinGetTitle("")) = "Done"

MouseMove($MousePos[0], $MousePos[1], 0)

Posted

I don't understand. I use this as an example and it works perfect:

AutoItSetOption("WinTitleMatchMode", 2)

Run("explorer http://www.msn.com")

WinWait("Internet Explorer")
Sleep(1000)
WinSetState("Internet Explorer", "", @SW_MAXIMIZE)

MouseMove(100, 1, 0)

$x = MouseGetCursor()

Do
$x = MouseGetCursor()
Sleep(500)
Until $x = 2
Posted

The script stops like if its done.

do you mean 'done', like it stops when the bottom of the page says "done"?
-Brett
Posted

This is what I use,seems to work like a charm

  $MousePos = MouseGetPos()

  $CursorActivity = MouseGetCursor()

  Do

      Sleep(500)

      MouseMove(100, 1, 0)

      $CursorActivity = MouseGetCursor()     

  Until $CursorActivity = 2 And StatusbarGetText(WinGetTitle("")) = "Done"

  MouseMove($MousePos[0], $MousePos[1], 0)

Got this from Larry a long time ago and edited it a bit

func pageloaded($a)

MouseMove(0,0)

$bSure = 0

While $bSure < 5

$ret=StatusBarGetText($a) == "Done"

If StatusBarGetText($a) == "Done" or StatusBarGetText($a) =="" then

$bSure = $bSure + 1

Else

$bSure = 0

EndIf

Sleep(150)

Wend

;MsgBox(4096, "AutoIt", $ret)

;Return $a

EndFunc

;Rick

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