Sign in to follow this  
Followers 0
powerpoison

not a logistic help, i need a code help...

22 posts in this topic

i need to do a bot for a game called unification wars, i saw an exemple of code made for this i will quote it

Heres a solution .... BUT only works in top document of a IE window, not tabs.

#include <IE.au3>
    _IEErrorHandlerRegister ("MyErrFunc1")
    $oIE = _IEAttach ("[SFU] Unification Wars", "Title")
    $oDoc = _IEDocGetObj ($oIE)
    $forms = _IEFormGetCollection ($oDoc)
        For $form in $forms
            $frmobjs = _IEFormElementGetCollection ($form)
                For $frmobj in $frmobjs
                    $value = $frmobj.value
                    if $value = "Start Research !" Then
                        $butname = $frmobj.name 
                        $oButton = _IEFormElementGetObjByName($form,$butname)
                        _IEAction($oButton, "click")            
                        endif
                    
                    next

next
func MyErrFunc1()
 ConsoleWrite($frmobj.value)
 EndFunc

can some1 explain what it do? add comments that help me understands each line of code? i want to make 1 by my self but i don't have enough bases to understand it, and actually i do need only this thing so it will be great if u can help me...

it will be even more apreciated if u also say me how to find the forms names on IE :D thx for all ur helps

Share this post


Link to post
Share on other sites



Open up Autoit's helpfile

"C:\Program Files\AutoIt3\AutoIt.chm"

and go to UDF/IE section.

All is described very well also with examples.

ok i will, thx, if i have some understanding problems i can pm u?

Share this post


Link to post
Share on other sites

can not find that udf/IE section on the help file... pls be more specific

Share this post


Link to post
Share on other sites

User Defined Function / IE Management

doh! i had to download the beta to have that section... now i figured it out, ok i am going to study this code tomorrow :D thx for the help

Share this post


Link to post
Share on other sites

doh! i had to download the beta to have that section... now i figured it out, ok i am going to study this code tomorrow :D thx for the help

You don't need latest beta. It's included also in latest release versions:

3.2.12.1

3.3.0.0

Share this post


Link to post
Share on other sites

how can i find a object name or a form name in a not standard page? it is let's say cripted... what i mean is that in the source of the page it appears i can not find forms and objects names....

Share this post


Link to post
Share on other sites

i seriusly need help, even reading the help file i can not get how this IE menagment autoit3 works... i need it to do this:

check if there is a button, if there is this button it have to click it, then check a text area variable, check another text variable, do a lup until the first variable - the second 1 = 0 then press the button i said above, can some1 make me a generic code that make this and tell me how to find text areas and button names? it would be really appreciated

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Looking at your typing, it looks like you don't pay much attention to anything.

Please don't bump your own topic with 24 hours, if you want to add on to the problem:

- Do it in the previous post

- Don't start with "i seriusly need help", everyone that posts here need help. And most of them are professionals who have a boss breathing down their neck, and don't have the luxury of so much time available to write a bot for "Unification Wars".

Edited by Manadar

Share this post


Link to post
Share on other sites

Looking at your typing, it looks like you don't pay much attention to anything.

Please don't bump your own topic with 24 hours, if you want to add on to the problem:

- Do it in the previous post

- Don't start with "i seriusly need help", everyone that posts here need help. And most of them are professionals who have a boss breathing down their neck, and don't have the luxury of so much time available to write a bot for "Unification Wars".

ok you are right, and btw with "i seriusly need help" i meaned to say just that i can not figure this out my self, i tried it hard as hard as i can, and i did not figured out this IE menagment thing...if some1 can help me good, if no 1 can then i will not do it... obviusly i want to do it and i don't think i am asking to much, still i don't know those function so i dunno if it is so time consuming and hard for a expert too...

Share this post


Link to post
Share on other sites

You tried "as hard as you can" for 50 minutes. Some people try as hard as they can for 3 days and then decide to go ahead and ask.

i tried it as much as i can, u told 50 mins, i saw the code i was asking thing for like 1 day before asking for help, then u are making me pissing off my self rly, i just want to learn how to do IE based bots and all what i am getting is flame and rage... u know what? if u have nothing to say to help me just shut up

Share this post


Link to post
Share on other sites

I know you're frustrated, but there's no need to take that out on me. I may be putting you on the spot, but I'm also here to help you resolve your issue, we just needed to get some things out of the way. Now that that's done, we can continue.

how can i find a object name or a form name in a not standard page? it is let's say cripted... what i mean is that in the source of the page it appears i can not find forms and objects names....

HTML can't be cripted, nor can it be crypted. If you can't find a form on the page, then it's not there (unless it's being added after page load).

_IEDocReadHTML returns the document source after any client-side modifications (e.g. by AutoIt or by client-side Javascript). It may therefore be different than what is shown by the browser View Source or by _INetGetSource.

The code you posted in the first topic is pretty sound, how are you debugging it? For example, this line:

if $value = "Start Research !" Then

How do you know it's not:

if $value = "Start Research ! " Then

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I know you're frustrated, but there's no need to take that out on me. I may be putting you on the spot, but I'm also here to help you resolve your issue, we just needed to get some things out of the way. Now that that's done, we can continue.

HTML can't be cripted, nor can it be crypted. If you can't find a form on the page, then it's not there (unless it's being added after page load).

_IEDocReadHTML returns the document source after any client-side modifications (e.g. by AutoIt or by client-side Javascript). It may therefore be different than what is shown by the browser View Source or by _INetGetSource.

The code you posted in the first topic is pretty sound, how are you debugging it? For example, this line:

if $value = "Start Research !" Then

How do you know it's not:

if $value = "Start Research ! " Then

as said above i haven't any clue even after reading all the ie functions listed, i also said that i copied that code from a search i made, so definitively i dunno what it does...

that script i posted actually don't do nothing compiled (at least i don't see it doing anything) and for the form i am going to use _IEDocReadHTML and check the source, maybe after i see the source i could understand that Ie menagment UDF better... thx for the infos hold on if u wish to help ^^

Great! i did

#include <IE.au3>

_IEAttach ("[sFU] Unification Wars", "Title")

_IEDocReadHTML to try to read that source and i get a error....missing separator or what...

Edited by powerpoison

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Well, you need some way to know what each line of your script is doing if you want to debug it.

#include <IE.au3>
    ;_IEErrorHandlerRegister ("MyErrFunc1") ; not necesary, just check SciTE output
    $oIE = _IEAttach ("[SFU] Unification Wars", "Title")
    $oDoc = _IEDocGetObj ($oIE)
    If @error Then MsgBox(0,@AutoItScriptLine, @error) ; <== stuff like this!!
    $forms = _IEFormGetCollection ($oDoc)
        For $form in $forms
            $frmobjs = _IEFormElementGetCollection ($form)
                For $frmobj in $frmobjs
                    $value = $frmobj.value
                    if $value = "Start Research !" Then
                        $butname = $frmobj.name 
                        $oButton = _IEFormElementGetObjByName($form,$butname)
                        _IEAction($oButton, "click")            
                        endif
                    
                    next

next
;func MyErrFunc1()
; ConsoleWrite($frmobj.value)
; EndFunc
Edited by Manadar

Share this post


Link to post
Share on other sites

Well, you need some way to know what each line of your script is doing if you want to debug it.

#include <IE.au3>
    ;_IEErrorHandlerRegister ("MyErrFunc1") ; not necesary, just check SciTE output
    $oIE = _IEAttach ("[SFU] Unification Wars", "Title")
    $oDoc = _IEDocGetObj ($oIE)
    If @error Then MsgBox(0,@AutoItScriptLine, @error) ; <== stuff like this!!
    $forms = _IEFormGetCollection ($oDoc)
        For $form in $forms
            $frmobjs = _IEFormElementGetCollection ($form)
                For $frmobj in $frmobjs
                    $value = $frmobj.value
                    if $value = "Start Research !" Then
                        $butname = $frmobj.name 
                        $oButton = _IEFormElementGetObjByName($form,$butname)
                        _IEAction($oButton, "click")            
                        endif
                    
                    next

next
;func MyErrFunc1()
; ConsoleWrite($frmobj.value)
; EndFunc

oh ok i got this ^^ now i dunno how to use this:

#include <IE.au3>

_IEAttach ("[sFU] Unification Wars", "Title")

_IEDocReadHTML

it don't give me the source of the page cuz it says i have and error missing separator, withouth reading the actuall source i can not figure what to use nor what to do... maybe u can tell me how to solve this?

Share this post


Link to post
Share on other sites

ok i understood why i was not able to recognizes the buttons... them are declared in javascript and i dunno how javascript works so it is actual impossible for me to make this bot, am i right? there are some other ways, non mouse based ?( there is a anti bot feature that add a lil space and if u click that then u have to input a captcha, and the button u should press change position so it is impossible to do withouth at least a recognizing method if that both features is on or not...)

yet maybe i can be able to make a mause based 1 with pixel get colour but that will be pretty unstable...

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