Sign in to follow this  
Followers 0
Andreik

IE functions

4 posts in this topic

#1 ·  Posted (edited)

I have a question about IE. I want to know how can I make difference when I use IE functions when I have same type of form elements? If I try to get objets by name "add_comment_text", everytime I will get the first one.

Maybe this photo it's more suggestive:

Posted Image

I want to make a script for a facebook game, where players left comments to add each other to make some teams in game.

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites



If they have same name try to find the good one by _IEFormElementGetCollection function

like _IEFormElementGetCollection ($oForm, 1 ) ; (1) for the second FormElement Posted Image

Is it really a game ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

^Yes, it's a game: Mafia Wars but I put this photo from a regular facebook page, form elements are same. :graduated:

I will try what you said there.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I tried some ways with _IEFormElementGetCollection() but I cannot use it properly. This is my attempt to make this script:

#include <IE.au3>

$IE = _IECreate("http://www.facebook.com",0,1,1,1)
$LOGIN = _IEGetObjByName($IE,"login_form")
$EMAIL = _IEFormElementGetObjByName($LOGIN,"email")
$PASS = _IEFormElementGetObjByName($LOGIN,"pass")
_IEFormElementSetValue($EMAIL,"myuser@yahoo.com")
_IEFormElementSetValue($PASS,"mypassword")
_IEFormSubmit($LOGIN)
_IELoadWait($IE)
_IENavigate($IE,"http://www.facebook.com/MafiaWars")
_IELoadWait($IE)
$ADD = _IEGetObjByName($IE,"add_comment_text")
For $INDEX = 0 To @extended-1
    $MSG = _IEGetObjByName($IE,"add_comment_text",$INDEX)
    _IEAction($MSG,"focus")
    _IEFormElementSetValue($MSG,"PM me with team offer!")
    $COMMENT = _IEGetObjByName($IE,"comment",$INDEX)
    _IEAction($COMMENT,"click")
Next

But seems to be a little goofy this script. In my page are maybe more than 25 objects with name add_comment_text and @extended value show something like 11.

Know someone why? :graduated:

Edited by Andreik

When the words fail... music speaks

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