Sign in to follow this  
Followers 0
UnknownWarrior

vBulletin _IEFormGetCollection

18 posts in this topic

I am trying to automate an auto-register and auto-login on a vBulletin forum I use.

However, I am having great difficulty determining how to use the _IE functions to achieve the first step in the registration process.

The link I will use for example is this:

http://www.overclockers.com/forums/register.php

Looking through the source code I came along this:

<form action="register.php?do=checkdate" method="post" onsubmit="return checkform(this)">

and shortly below

Month:<br />
                        <select name="month">

                            <option value="" selected="selected">-</option>
                            <option value="01">January</option>
                            <option value="02">February</option>
                            <option value="03">March</option>
                            <option value="04">April</option>
                            <option value="05">May</option>

                            <option value="06">June</option>
                            <option value="07">July</option>
                            <option value="08">August</option>
                            <option value="09">September</option>
                            <option value="10">October</option>
                            <option value="11">November</option>

                            <option value="12">December</option>
                        </select>
                    </td>
                    <td>
                        Day:<br />
                        <select name="day">
                            <option value="" selected="selected">-</option>

                            <option value="01">1</option>
                            <option value="02">2</option>
                            <option value="03">3</option>

I am curious... How would I go about selecting those options? Beings there is no ID I cannot use _IEFormGetObjByName, so I'm stuck with indexing the Forms. I counted the Forms, and the form I need (1st code snippet above) is the 5th <form> tag on the page.

So, according to my understanding, I could use this:

$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 4)

I would use 4 off of a 0 based index, so my <form action="register.php?do=checkdate" method="post" onsubmit="return checkform(this)"> is the 5th one, thus being 4 in the index.

So far, I hope I am right.

The reason that I could not test this is because... I don't know how to set the values of the Months and Days exactly.

I know I need to be using _IEFormElementOptionselect.

This is my failed attempt at doing it so far:

#include <IE.au3>
$oIE = _IECreate ("http://www.overclockers.com/forums/register.php")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 4)
$oSelect = _IEFormElementGetObjByName ($oQuery, "month")
_IEFormElementOptionselect($oQuery, "March", 1, "byText")
exit

I think I'm a bit confused on how to use the FormGetCollection properly.

Any help would be great, thanks!

Share this post


Link to post
Share on other sites



and why do you need to automate vbulletin registration?

Share this post


Link to post
Share on other sites

and why do you need to automate vbulletin registration?

A friend has asked me to try and make a bot to do this because recently he has been having many bots signing up on his vBulletin forum. It's the theory of 'think like a murderer' when trying to solve the case. If I can make a working bot to do the steps that the bots are doing on his forum, he can build a slight alteration to the script and make the bot makers have to update it.

Dang spammers -.-

Share this post


Link to post
Share on other sites

they are probably using a program called xrumer...

google that.

your best bet is to change the email confirmation messages to remove links completely and make them copy and paste the confirmation code into the form instead of clicking the confirmation code.

standard captcha wont stop them

adding additional forms wont stop them

you could remove visual captcha and make it audio captcha

i have been battling these bots for months now...

on my forum i have a captcha that always says its wrong unless you input a specific data then my signup says email me for password.

Share this post


Link to post
Share on other sites

they are probably using a program called xrumer...

google that.

your best bet is to change the email confirmation messages to remove links completely and make them copy and paste the confirmation code into the form instead of clicking the confirmation code.

standard captcha wont stop them

adding additional forms wont stop them

you could remove visual captcha and make it audio captcha

i have been battling these bots for months now...

on my forum i have a captcha that always says its wrong unless you input a specific data then my signup says email me for password.

Thanks, but I'm aware of all these problems unfortunately. I've been trying to help him solve the spammers for a long time now, but to no success. People on our forum do not want to wait 24-48 hours for us to approve their registration, and plus, we can't tell if they are a bot or not. Audio captcha is a good idea, but it will be one of my last resorts.

I still just want to figure this out so I can replicate ANY BOT ever created, not just 'xrumer'. A prime is example is a S.W.A.T. team doing tests on different hostage situations. If they only relied on testing on the same building, the same timing... etc... They wouldn't be prepared for bigger problems.

Share this post


Link to post
Share on other sites

im sorry im not gonna help you.

if i wanted to help people spam i would make alot more money on vworker.com

if you want to stop the spammers add audio captcha.

you dont need to make manual approval just remove all links from the confirmation email and you will stop 90% of all spammers.

Share this post


Link to post
Share on other sites

Why do you think I am trying to spam? I told you my reason, take it for what it's worth I guess.

Hopefully someone else can help me out here :graduated:

Share this post


Link to post
Share on other sites

Yet another failed attempt :graduated:

#include <IE.au3>
$oIE = _IECreate ("http://www.overclockers.com/forums/register.php")
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
MsgBox(0, "Forms Info", "There are " & $iNumForms & " forms on this page")
For $i = 0 to $iNumForms
    $oForm = _IEFormGetCollection ($oIE)
    $oQuery = _IEFormElementGetCollection ($oForm, $i)
    MsgBox(0,"", $i)
    $oSelect = _IEFormElementGetObjByName ($oQuery, "month")  ;--- month list
      _IEFormElementOptionselect ($oSelect, 5, 1, "byIndex") ;--- the 5th month on the list
Next

Share this post


Link to post
Share on other sites

Bump :graduated:

Share this post


Link to post
Share on other sites

Make sure you run your code in SciTe and make sure you study the output to the SciTe console... IE.au3 does a lot of work to simplify error identification for you if you learn what those messages mean. Running your code I saw:

--> IE.au3 V2.4-0 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetCollection, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidDataType


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#include <IE.au3>
$oIE = _IECreate ("http://www.overclockers.com/forums/register.php")
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
MsgBox(0, "Forms Info", "There are " & $iNumForms & " forms on this page")
For $i = 0 to $iNumForms
    $oForm = _IEFormGetCollection ($oIE)
    $oQuery = _IEFormElementGetCollection ($oForm, $i)
    MsgBox(0,"", $i)
    $oSelect = _IEFormElementGetObjByName ($oQuery, "month")  ;--- month list
      _IEFormElementOptionselect ($oSelect, 5, 1, "byIndex") ;--- the 5th month on the list
Next
You need to spend some time learning the basics and how to use all the indications you get, as Dale said.

Your loop is pulling the entire collection of forms every time because you left the index off at _IEFormGetCollection($oIE), then you try to pass the collection to _IEFormElementGetCollection() instead of a single form.

:graduated:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

I understand that basics, those were just quick attempts at a concept I don't understand.

What I realize that I NEED to do is:

1. Get the form by index (_IEFormGetCollection)

2. Get the 'name' [in this case 'month'] (_IEFormElementGetObjByName)

3. Then select the month.

It's just confusing putting IDs with a 'name' function. Much help would be appreciated. Thanks!

Share this post


Link to post
Share on other sites

In the IE DOM, 'name' and 'id' attributes share the same name-space. The only difference between them is that an 'id' is required to be unique, while the same 'name' can be used on multiple elements. An element can have both 'name' and 'id' attributes set, too.

So if you look at _IEGetObjByName() or _IEFormElementGetObjByName(), they can match either the name or ID, and they have an index parameter because there might be more than one element with the same name.

Now look at _IEGetObjById(), which can also match either name or ID, but it has no index parameter because an element ID has to be unique.

The confusing nature of it comes from the design of the DOM, not from AutoIt or the IE.au3 UDF.

:graduated:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

In the IE DOM, 'name' and 'id' attributes share the same name-space. The only difference between them is that an 'id' is required to be unique, while the same 'name' can be used on multiple elements. An element can have both 'name' and 'id' attributes set, too.

So if you look at _IEGetObjByName() or _IEFormElementGetObjByName(), they can match either the name or ID, and they have an index parameter because there might be more than one element with the same name.

Now look at _IEGetObjById(), which can also match either name or ID, but it has no index parameter because an element ID has to be unique.

The confusing nature of it comes from the design of the DOM, not from AutoIt or the IE.au3 UDF.

:graduated:

I want to try this out myself.

But I just need one reference:

Could you give me the list of _IE functions that I need to use in order to complete my task? I don't want to guess anymore, I look like a fool doing so. I would just like the list, and I'll try coding it from there.

Thanks in advance :(

Share this post


Link to post
Share on other sites

bump :graduated:

Share this post


Link to post
Share on other sites

Could you give me the list of _IE functions that I need to use in order to complete my task? I don't want to guess anymore, I look like a fool doing so. I would just like the list, and I'll try coding it from there.

For the list, see the help file under "IE Management" for all the _IE* functions.

You are not going to be able to do more complex tasks until you get down some basics. The easiest way to do that is by running the running the example scripts from the help file to see how they work.

Guessing might make you look like a fool, but experimenting with the basics and slowly progressing to more complex material makes you look like a intelligent learner, and it really is necessary.

:graduated:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

For the list, see the help file under "IE Management" for all the _IE* functions.

You are not going to be able to do more complex tasks until you get down some basics. The easiest way to do that is by running the running the example scripts from the help file to see how they work.

Guessing might make you look like a fool, but experimenting with the basics and slowly progressing to more complex material makes you look like a intelligent learner, and it really is necessary.

:graduated:

You make it sound as if I haven't went over the 8ish relevant IE functions that could somehow relate to this task, because I have!

I have spent about 5 hours now testing them over and over and over again. I have provided you with scripts of my 'experimentations', what else can I do?

Putting it in real life example, let's take a Kindergarten teacher. Let's say a student doesn't know how to write their last name (I didn't in Kindergarten because I have a long last name!). It's like that teacher repeating my last name to me over and over again... I won't learn until she grasps my hand and moves the pencil for me!

That's what I'm asking for you here. I'm the poor little student who has tried writing their last name 50 times, but cannot get it right. I am now asking the teacher, you (or anyone else who knows), how to do it.

I've always seen in threads on this forum of 'noobs' asking for questions and they don't supply any kind of scripts, examples, tests... yet sometimes they are answered. I've went over and beyond with aiding in providing you with the most of my knowledge in tests.

I guess... /rant

EDIT: I'm pretty sure I know the list, but how to incorporate the ID parameters with 'name' and with collections and with... well yeah... a big cycle of confusion for me :/.

Edited by UnknownWarrior

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

The Get*ByName and Get*ById functions both return an single object by default. Get*ById can only return a single object because Id's are required to be unique in HTML. The Get*ByName functions return a single object by default only becase the function returns the first instance of a named element for convenience. If you set the Index parameter on Get*ByName functions to -1, it will return a collection object of all elements with that name, even if there is only one of them (or you can set it to an integer >= 0 to get a specific element of that collection).

Collections should not be confused with arrays, although there are some similarities. The most common way to use a collection is to loop through its elements (each a unique object) with a FOR... IN... NEXT loop. There are many examples in the helpfile. Typically, you loop through the elements looking for characteristics (properties) of each individual object and either acting on each or finding a match you are looking for and exiting the loop with the specific object reference you wanted so that you can act upon it.

If you try to perform functions on a collection that are meant for a unique object, IE.au3 will send a message to the console telling you InvalidObjectType. If you try to perform functions on a variable that expects an object that instead contains, for example, an integer 0, IE.au3 will send a message to the console telling you InvalidDataType. Please learn what these messages mean and pay attention to them in the SciTe console. This is not a default behaviour of AutoIt, but instead I put a lot of effort into displaying them for you because there was so much confusion in the areas you are struggling with.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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