Andreik Posted October 30, 2010 Share Posted October 30, 2010 (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: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 October 30, 2010 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
wakillon Posted October 30, 2010 Share Posted October 30, 2010 If they have same name try to find the good one by _IEFormElementGetCollection functionlike _IEFormElementGetCollection ($oForm, 1 ) ; (1) for the second FormElement Is it really a game ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Andreik Posted October 31, 2010 Author Share Posted October 31, 2010 ^Yes, it's a game: Mafia Wars but I put this photo from a regular facebook page, form elements are same. I will try what you said there. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Andreik Posted November 1, 2010 Author Share Posted November 1, 2010 (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? Edited November 1, 2010 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now