Jump to content

A little trouble.


Recommended Posts

Hi

I'm the moderator of a forum.

I've built a autoit script that will change websites frequently.

It runs really well using just the basic mousecontrols and keyboard controls.

However, sometimes a website will lagg out, meaning it takes ages to load. The autoit script doesn't know it laggs out so it just carries on with what it's doing.

Is there a way I can ask the script to check if the website has loaded? before it continues executing.

Thank you.

I also forgot to say; I'm using Internet Explorer 7. Thanks.

Edited by testtestthisisatest
Link to comment
Share on other sites

Look at the example in the help file, it's pretty straight forward. You can see it working by using it on a site that you find to be slow, and put a MsgBox after _IELoadWait. It won't pop up until the site has finished loading.

Link to comment
Share on other sites

Look at the example in the help file, it's pretty straight forward. You can see it working by using it on a site that you find to be slow, and put a MsgBox after _IELoadWait. It won't pop up until the site has finished loading.

The only problem with the example is that it creates a new page. I just need it to check the website that my script has already opened. How do I make it do that?

Link to comment
Share on other sites

The only problem with the example is that it creates a new page. I just need it to check the website that my script has already opened. How do I make it do that?

to finde what you need first you need to understand 3 functions from _IE

_IECreate

&

_IEAttach

and then when you understand them move foward to

_IELoadWait

(or try to post some exsample code so that others can see what r you dooing and where r you gooing)

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Ok it's basically just this:

;this will click submit
MouseMove(500,609)
MouseDown("left")
Sleep(100)
MouseUp("left")

; after submit is clicked it will take you to a 'successful page'. However, the successful page skips back to the submit page quite quick. eg. -

Submit page = www.forum.com/post (where you make a post and submit it)
Successful page = www.forum.com/successful (where it tells you the post was successful, this appears for only a couple of seconds and then returns to where your post is)

; I then want it to move to another webpage by using:

MouseWheel("down", 7)
MouseMove(309,714)
MouseDown("left")
Sleep(100)
MouseUp("left")
MouseMove(194,333)
MouseDown("left")
Sleep(100)
MouseUp("left")
Sleep(3000)

so basically i want it to carry on the execution which is the "; I then want it to move to another webpage by using:" part, after the successful page has been and gone. (because it appears for about 2 seconds then goes back to where your post is.

Link to comment
Share on other sites

so basically i want it to carry on the execution which is the "; I then want it to move to another webpage by using:" part, after the successful page has been and gone. (because it appears for about 2 seconds then goes back to where your post is.

ok so you first need

_IEAttach

so that you can attach the curent page for the next function

#include <IE.au3>

$oIE = _IEAttach ("Google")

or you can use

#include <IE.au3>

$oIE = _IECreate ("www.google.com")

so that the page will b created and you dont need to reattach it

next you need to tell the script where to put text so that you can later submit it, to do that you must know form element numbers

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 1)

and to tell what data to put

_IEFormElementSetValue ($oQuery, "A little trouble au3 forum")

you can experimente with colection and its numers so that you send data to rite place

if you put that $oQuery = _IEFormElementGetCollection ($oForm, 2)

that will set data "A little trouble au3 forum" on the button and not on the search field

instead of this you can use _IEFormGetObjByName if you know how to finde the name of the field that your trying to set data

then you need it to submit the data

_IEFormSubmit

look at this func it have nice exsamples on it

so

#include <IE.au3>
$oIE = _IECreate ("www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "autoit")
_IEFormSubmit ($oForm)
_IENavigate ($oIE, "http://www.autoitscript.com/forum/index.php?showtopic=76351")oÝ÷ Ùæ¬Ë²jëh×6#include <IE.au3>

If WinExists("google") Then
$oIE = _IEAttach ("google")
WinSetState("google","",@SW_MAXIMIZE)
Send("I LOWE YOU")
MouseMove(500,609)
MouseDown("left")
Sleep(100)
MouseUp("left")
MouseClick("",50,60)
_IELoadWait ($oIE)
MouseWheel("down", 7)
MouseMove(309,714)
MouseDown("left")
Sleep(100)
MouseUp("left")
MouseMove(194,333)
MouseDown("left")
Sleep(100)
MouseUp("left")
Sleep(3000)
.........
hard way

and i dono will this hard way work at all :/

so did this helped you or not?

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

ok so you first need

_IEAttach

so that you can attach the curent page for the next function

#include <IE.au3>

$oIE = _IEAttach ("Google")

or you can use

#include <IE.au3>

$oIE = _IECreate ("www.google.com")

so that the page will b created and you dont need to reattach it

next you need to tell the script where to put text so that you can later submit it, to do that you must know form element numbers

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 1)

and to tell what data to put

_IEFormElementSetValue ($oQuery, "A little trouble au3 forum")

you can experimente with colection and its numers so that you send data to rite place

if you put that $oQuery = _IEFormElementGetCollection ($oForm, 2)

that will set data "A little trouble au3 forum" on the button and not on the search field

instead of this you can use _IEFormGetObjByName if you know how to finde the name of the field that your trying to set data

then you need it to submit the data

_IEFormSubmit

look at this func it have nice exsamples on it

so

#include <IE.au3>
$oIE = _IECreate ("www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "autoit")
_IEFormSubmit ($oForm)
_IENavigate ($oIE, "http://www.autoitscript.com/forum/index.php?showtopic=76351")oÝ÷ Ùæ¬Ë²jëh×6#include <IE.au3>

If WinExists("google") Then
$oIE = _IEAttach ("google")
WinSetState("google","",@SW_MAXIMIZE)
Send("I LOWE YOU")
MouseMove(500,609)
MouseDown("left")
Sleep(100)
MouseUp("left")
MouseClick("",50,60)
_IELoadWait ($oIE)
MouseWheel("down", 7)
MouseMove(309,714)
MouseDown("left")
Sleep(100)
MouseUp("left")
MouseMove(194,333)
MouseDown("left")
Sleep(100)
MouseUp("left")
Sleep(3000)
.........
hard way

and i dono will this hard way work at all :/

so did this helped you or not?

the url always changes so it's not just one url. it's just a randomized url. is there a way autoit can find out what the url then test it to see if it's loaded?
Link to comment
Share on other sites

bump

it can (at least i hope it can) muttley

#include <IE.au3>
$oIE = _IECreate ("www.google.com")
_IELoadWait ($oIE)
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "autoit")
$yoururl_1 = _IEPropertyGet ( $oIE, "locationurl" )
WinSetState("Google","",@SW_MAXIMIZE)
MouseClick("",534, 353) ;<== change mouseclick coordinates so that they hit button on your google page

_IELoadWait ($oIE);<== if you delite this line youl see the difrance on    did the page is loaded or not

ToolTip("THE URL "&$yoururl_1&"")
$yoururl_2 = _IEPropertyGet ( $oIE, "locationurl" )

;~ MsgBox(0,"",$yoururl_1&"  "&$yoururl_2)

$yoururl = _IEPropertyGet ( $oIE, "busy" )
Select
    Case $yoururl = "-1"
        MsgBox(0,"","IM STILL LOADING THE PAGE")
    Case $yoururl = "0"
        MsgBox(0,"","THE PAGE IS LOADED")
EndSelect

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Ok well the attach seems to work well. It waits for the page now, so thanks for that.

Just changing the suject a bit, I'd like to know more about this

$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "autoit")

What does that exactly do? I tried doing that with Google and it typed in "blabla" then submited it, but when I try it on my forum it doesn't work. I'm guessing it searches for a textbox, puts in the text and submits it? It could be because there are a few textboxes. How do I get it to direct to the textbox I need?

Link to comment
Share on other sites

Just changing the suject a bit, I'd like to know more about this

$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "autoit")

What does that exactly do? I tried doing that with Google and it typed in "blabla" then submited it, but when I try it on my forum it doesn't work. I'm guessing it searches for a textbox, puts in the text and submits it? It could be because there are a few textboxes. How do I get it to direct to the textbox I need?

.......

Picture click on me

.......

so every form have Element

you put the number of form and put the number of element for that form to set its data

but if you have its form and element name

<form action="/search" name=f>

name=f

<input maxlength=2048 name=q size=55 title="Google Search" value="">

name=q

you can use

#include <IE.au3>

$oIE = _IECreate ("http://www.google.com")

$oForm = _IEFormGetObjByName ($oIE, "f")

$oQuery = _IEFormElementGetObjByName ($oForm, "q")

_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")

_IEFormSubmit ($oForm)

do you now understand it? muttley

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Ok how do I find out the "number of form" and "number of element"?

forms name is hard to get becose in alot of cases they dont have name

but now many of them isnt

from the help file

#include <IE.au3>
$oIE = _IECreate ("www.google.com")
$oForms = _IEFormGetCollection ($oIE)
MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")
For $oForm In $oForms
    MsgBox(0, "Form Info", $oForm.name)
NextoÝ÷ Ù8^-Á¬­¡ø§uì!jÙʧyçb²Ú)ºØ­¢v¥-z÷«Éú+©ÝzW¦z{ZºÚ"µÍÚ[ÛYH   ÒQK]LÉÝÂÌÍÛÒQHHÒQPÜX]H
    ][ÝÝÝÝËÛÛÙÛKÛÛI][ÝÊBÒQSØYØZ]
    ÌÍÛÒQJBÌÍÛÑÜHHÒQQÜQÙ]ÛÛXÝ[Û
    ÌÍÛÒQK
BÌÍÛÔ]YHHÒQQÜQ[[Y[Ù]ÛÛXÝ[Û
    ÌÍÛÑÜKJBÒQQÜQ[[Y[Ù][YH
    ÌÍÛÔ]YK ][ÝÌI][ÝÊBÌÍÛÔ]YHHÒQQÜQ[[Y[Ù]ÛÛXÝ[Û
    ÌÍÛÑÜKBÒQQÜQ[[Y[Ù][YH
    ÌÍÛÔ]YK ][ÝÌ][ÝÊBÌÍÛÔ]YHHÒQQÜQ[[Y[Ù]ÛÛXÝ[Û
    ÌÍÛÑÜKÊBÒQQÜQ[[Y[Ù][YH
    ÌÍÛÔ]YK ][ÝÌÉ][ÝÊBÌÍÛÑÜHHÒQQÜQÙ]ÛÛXÝ[Û
    ÌÍÛÒQKJBÌÍÛÔ]YHHÒQQÜQ[[Y[Ù]ÛÛXÝ[Û
    ÌÍÛÑÜKJBÒQQÜQ[[Y[Ù][YH
    ÌÍÛÔ]YK ][ÝÌKI][ÝÊBÌÍÛÔ]YHHÒQQÜQ[[Y[Ù]ÛÛXÝ[Û
    ÌÍÛÑÜKBÒQQÜQ[[Y[Ù][YH
    ÌÍÛÔ]YK ][ÝÌK][ÝÊBÌÍÛÔ]YHHÒQQÜQ[[Y[Ù]ÛÛXÝ[Û
    ÌÍÛÑÜKÊBÒQQÜQ[[Y[Ù][YH
    ÌÍÛÔ]YK ][ÝÌKÉ][ÝÊBÌÍÛÔ]YHHÒQQÜQ[[Y[Ù]ÛÛXÝ[Û
    ÌÍÛÑÜK
BÒQQÜQ[[Y[Ù][YH
    ÌÍÛÔ]YK ][ÝÌK
    ][ÝÊB

and then youl now what number or what form you need

(if i remamber correctly someone made someething for something like this to help out but im too lazy now to search forums)

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

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