Sign in to follow this  
Followers 0
jacob_1998_1999

Erm? Simple Yet not so Simple for me?

11 posts in this topic

Func Game() 
    $oForm2 = _IEFormGetCollection ($oIE, 0)
    $oQuery = _IEFormElementGetCollection ($oForm2, 0)
    $oGuess = 100
    _IEFormElementSetValue ($oQuery, 100)
    _IEFormSubmit($oForm2)
    _IELoadWait($oIE)
    If String("& won 0") Then
        $oGuess = $oGuess * 2
        _IEFormElementSetValue ($oQuery,$oGuess)
        _IEFormSubmit($oForm2)
        _IELoadWait($oIE)
                Game()
    Else
        Game()
    EndIf
EndFunc

As far as I can tell.. This is not submitting at all.. and the Check for "& won 0" is giving false positive.. because it continues through the If Statement.

All this does is infinitly cycle "100" and "200" in the field of the form that I want.. It is never submitting..

Below is the entire Form I am trying to get submitted .. :D I'm sorry that I cannot seem to do this myself.

<table style="width:200px">
<FORM method="post" action="/cna.php">
<tr>
<td width="33" align="middle">
<img src="/images/g_Crown.jpg">
<br>
<input type="text" name="Crown" size="5" value="100">
</td>
<td width="33" align="middle">
<img src="/images/g_Anchor.jpg">
<br>
<input type="text" name="Anchor" size="5" value="0">
</td>
<tr>
<td colspan="3" align="middle">
<input type="hidden" name="tkid" value="ea2a7e11872b81fc1a8db4f1f3ecca8f">
<INPUT TYPE="submit" VALUE="roll the dice" name="submit" class="submit">
</td>
</tr>
</FORM>

Ty for any and all help.

Share this post


Link to post
Share on other sites



:D

Share this post


Link to post
Share on other sites

all string does is typecast it into a string.

also you are gonna hit a recursion limit.

Am I going to have to parse the entire page to find out if " & won 0" occures? In theory, is the rest of my coding correct? I'm just a little lost..

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Func Game()
    $oGuess = 100
    $oForm2 = _IEFormGetCollection ($oIE, 0)
    $oQuery = _IEFormElementGetCollection ($oForm2, 0)
    _IEFormElementSetValue ($oQuery, $oGuess)
    $oButton = _IEFormElementGetObjByName($oForm2, "submit")
    $oButton.click()
    _IELoadWait($oIE)
    sleep(2000)
    If WinExists("blahblah - Microsoft Internet Explorer") Then
        $Text1=WinGetText("blahblah - Microsoft Internet Explorer")
        If Stringinstr($Text1, "& won 0") Then
            $oGuess = $oGuess * 2
            $oForm2 = _IEFormGetCollection ($oIE, 0)
            $oQuery = _IEFormElementGetCollection ($oForm2, 0)
            _IEFormElementSetValue ($oQuery, $oGuess)
            $oButton = _IEFormElementGetObjByName($oForm2, "submit")
            $oButton.click()
            _IELoadWait($oIE)
            sleep(2000)
            Game()
        Else
            Game()

        EndIf
    EndIf
EndFunc

I tried going about this another way... From what I can tell.. It still is not reading, or ignoring when/if "& won 0" is present. And/Or the Doubling of $oGuess is not working.

P.S. The author wrote these page weird, so the $oButton is about the only way to make the form actually submit.

Edited by jacob_1998_1999

Share this post


Link to post
Share on other sites

Func Game()
-snip

            Game()
        Else
            Game()

        EndIf
    EndIf
EndFunc
What is the purpose of these 2 calls to Game() ?

This means to me that the Game() func will never properly end and keeps on calling itself ending in a recursion level error ......


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

What is the purpose of these 2 calls to Game() ?

This means to me that the Game() func will never properly end and keeps on calling itself ending in a recursion level error ......

Well, I would like it to be endlessly run until I stop it. via HotKey or Force. So, I assumed that calling it to the beginning would accomplish this. Perhaps if I just type out what I want to accomplish it will be easier to understand?

From the Start.

Type Guess(100 for the first time)

Submit

If "& won 0" exists Then

Double Guess

Else

Type TheFirstGuess(100 again.. So, I assumed loop to beginning.)

EndIf

repeat endlessly.

Edited by jacob_1998_1999

Share this post


Link to post
Share on other sites

Well, I would like it to be endlessly run until I stop it. via HotKey or Force. So, I assumed that calling it to the beginning would accomplish this. Perhaps if I just type out what I want to accomplish it will be easier to understand?

From the Start.

Type Guess(100 for the first time)

Submit

If "& won 0" exists Then

Double Guess

Else

Type TheFirstGuess(100 again.. So, I assumed loop to beginning.)

EndIf

repeat endlessly.

There is a big difference between the below 2 scripts ... first one is the correct approach:

While 1
   Game()
Wend

Func Game()
    ; your stuff and NO callls to game()
EndFunc
oÝ÷ Ù«­¢+Ø)µ ¤()Õ¹µ ¤(ìå½ÕÈÍÑÕ¹9

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

While 1
    Game()
WEnd
    
Func Game()
    If WinExists("adfhadf - Microsoft Internet Explorer") Then
        $oGuess = 100
        $oForm2 = _IEFormGetCollection ($oIE, 0)
        $oQuery = _IEFormElementGetCollection ($oForm2, 0)
        _IEFormElementSetValue ($oQuery, $oGuess)
        $oButton = _IEFormElementGetObjByName($oForm2, "submit")
        $oButton.click()
        _IELoadWait($oIE)
        sleep(2000)
        If WinExists("adfhadfh - Microsoft Internet Explorer") Then
            $Text1=WinGetText("adfhadh - Microsoft Internet Explorer")
            MsgBox(0,"",$Text1)
            If Stringinstr($Text1, "& won 0") Then
                $oGuess = $oGuess * 2
                $oForm2 = _IEFormGetCollection ($oIE, 0)
                $oQuery = _IEFormElementGetCollection ($oForm2, 0)
                _IEFormElementSetValue ($oQuery, $oGuess)
                $oButton = _IEFormElementGetObjByName($oForm2, "submit")
                $oButton.click()
                _IELoadWait($oIE)
                sleep(2000)
            EndIf
        Else
            
        EndIf
    Else
        MsgBox(0,"D'oh!","Something is wrong.;(")
    EndIf
EndFunc

The WinGetText Is returning:

Links

http://baldfhnlajdh

http://absndlfjhnadlh

Done

I just cannot seem to be able to get the Text that I want found. :D

Edit:

I tried adding work arounds using:

_INetGetSource('http://linkage.wooo.yea')

However the site doesn't allow this and it resets to the main..

Is there a way to just gather the source (to parse it) from the present IE page you are on?

Edited by jacob_1998_1999

Share this post


Link to post
Share on other sites

Its not able to be read like that. :/ So I need a way to get the source from the page and then search that source, and As I said previously InetGetSource doesn't work.

Share this post


Link to post
Share on other sites

_IEBodyReadText ($oIE)

Ty for the revisitation in structure JdeB.

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