Jump to content

_IEFormElementRadioSelect ( ) question


frontmill
 Share

Recommended Posts

_IEFormElementRadioSelect ( $o_object, $s_string, $s_name [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]] )

im having trouble with this function, i dont understand how to use it, i user the ie.au3 userfunctions a lot and i always get it to work.. but really dont understand this.

this is the code of the form:

<form method="post"><table align="center">
<input type="text" name="amount" maxlength=8>
<input type="radio" name="sel"  value="out" checked>
<input type="radio" name="sel" value="in">

<input type="submit" name="submit" value="Ok"  style="width: 100;">
</form>

Btw, i know what i have to do with object, i only dont understand the string and the name part..

Edited by frontmill
Link to comment
Share on other sites

This will toggle beteen the two radio buttons:

_IEFormElementRadioSelect($oForm, "in", "sel")
sleep(500)
_IEFormElementRadioSelect($oForm, "out", "sel")
sleep(500)
_IEFormElementRadioSelect($oForm, "in", "sel")
sleep(500)
_IEFormElementRadioSelect($oForm, "out", "sel")
sleep(500)
_IEFormElementRadioSelect($oForm, "in", "sel")

Dale

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

Link to comment
Share on other sites

  • 1 month later...

But what about $oForm its not declared & i get error :">

<tr><td align="center" valign="top" class="horMenuLink" width="13%" oclick="">
                    <input type=radio name=rating value=0 onclick="destroy_ten_div(); if(pressed.value==0){pressed.value=1;this.form.submit()}"><b>-</b><br>oÝ÷ Ù*¸­zØ^r^+%G­+ºØ¢{n׫²Ö§wZ¶ÈhºWbv"¶7êh®h^ey«"¯y¬n {^­â0j{m¢Þ²Ëaz-ìaz{azÇ+l¥vÇ¥yËmêÚv*£¦¥ÉbrH­jëh×6HotkeySet("{space}", "Go") 
    
Func Go()

_IEFormElementRadioSelect ($oForm, "0", "rating", 1, "byValue")
EndFunc

; Need to keep the program running until you press the hotkey
While 1
    Sleep(100)
WEnd
Edited by chie
Link to comment
Share on other sites

Hopefully there is a <form tag in the source as well. that is the object you need to get assigned to $oForm.

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

Link to comment
Share on other sites

Hopefully there is a <form tag in the source as well. that is the object you need to get assigned to $oForm.

Umm i dont understand what u mean, Can u bring up an example ?

& i see there only 2 form words </form> & look in the code its RED

<tr><td align="center" valign="top" class="horMenuLink" width="13%" oclick="">
                    <input type=radio name=rating value=0 onclick="destroy_ten_div(); if(pressed.value==0){pressed.value=1;this.[b][color=#FF0000]form[/b][/color].submit()}"><b>-</b><br>

Does this mean it is impossible to use autoilt to click the radio buttons on that(http://www.rate.ee/show.php) site?

Edited by chie
Link to comment
Share on other sites

Umm i dont understand what u mean, Can u bring up an example ?

& i see there only 2 form words </form> & look in the code its RED

<tr><td align="center" valign="top" class="horMenuLink" width="13%" oclick="">
                    <input type=radio name=rating value=0 onclick="destroy_ten_div(); if(pressed.value==0){pressed.value=1;this.[b][color=#FF0000]form[/b][/color].submit()}"><b>-</b><br>

Does this mean it is impossible to use autoilt to click the radio buttons on that(http://www.rate.ee/show.php) site?

No, it means you have not shown the important HTML source. If there is a </form> there also needs to be a <form> or the HTML is broken.

Dale

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

Link to comment
Share on other sites

No, it means you have not shown the important HTML source. If there is a </form> there also needs to be a <form> or the HTML is broken.

In this case the HTMl is broken as you say because as u see there in the whold site source there are ZERO <form. this makes it impossibe is that so ? :whistle:

PS: What should i do with $oIE in this case? because i dont want to open new IE window, I have 1 already open one in OPERA.

$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
_IEFormElementRadioSelect ($oForm, "5", "rating", 1, "byValue")
Edited by chie
Link to comment
Share on other sites

I really don't understand what you are asking. One suggestion however is to check the HTML source by examining the string returned by _IEBodyReadHTML($oIE) because it is possible that there is code being generated by Javascript that you do not see with View Source.

_IEFormElementRadioSelect was designed to work inside a FORM context - it is possible to manipulate the radio buttons without it, but unless you can tell me a really convincing story about why it is critical for you to to this on a broken page, you're on your own.

Dale

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

Link to comment
Share on other sites

_IEFormElementRadioSelect was designed to work inside a FORM context - it is possible to manipulate the radio buttons without it, but unless you can tell me a really convincing story about why it is critical for you to to this on a broken page, you're on your own.

The reason is:

http://www.rate.ee/show.php

Its rating portal & is insanely popular (Dont ask me why...prolly the teenagers dont have nothing better to do than rate each other....)

I saw this site & since im learning how to use autoilt & im taking 1 step at the time.(However the help file is not so helpful as I expected it to be....), eather way I desided to write a small code that logs in & starts automatically rate other peole. 1-st. step was sucessful & it managed to rate bit less than 10 000 people a day. But as u see it works with mouse movement. My next step was to learn how to use radiobuttons but when I started to re-Writing my little code I got stuckked. So i asked for help. Aa & the main problem why i decided to rewrit the program was that sometimes the page got messed up Dunno why , maybe some pictures were too big... & then the mouse was not clicking the right spot & if radio button thind would be used this problem would dissapear, But it seems, that if i cant use the way the help file was teaching I thought thats it.....But u saud u know another way.

If u think its waist of time to deal with me then please give me atleast some keywords so I can search for the solution.:

This is my code so far.

#include <IE.au3>

;Checks if prog is already running & if is then Exits without notification
;~ ------------------------------------------------------------------------
$g_szVersion = "My Script 1.1"
If WinExists($g_szVersion) Then Exit 
AutoItWinSetTitle($g_szVersion)
;~ ------------------------------------------------------------------------

HotKeySet("{space}", "Begin")   
HotKeySet("!{numpadadd}", "HK_STOP")    
HotKeySet("!{numpadmult}", "MyExit")

Func Begin()
;Opens New IE page
$oIE = _IECreate ("http://www.rate.ee/show.php", 1) 

$o_Form = _IEFormGetObjByName ($oIE, "loginform")               ;login form NAME
$o_login = _IEFormElementGetObjByName($o_Form, "username")      ;Input username form name 
$o_password = _IEFormElementGetObjByName($o_Form, "password")   ;Input pass form name  
$o_signin = _IEFormElementGetObjByName ($o_form, "login")       ;This is log-IN input button value

; Set field values
$username = "My_REAL_username_Hire"
$password = "my_REAL_pass_Hire"
_IEFormElementSetValue ($o_login, $username)    ;declasing username
_IEFormElementSetValue ($o_password, $password) ;declasing password


;~ submit the form
_IEFormSubmit($o_Form, 0) 
sleep(2000)
send("{BROWSER_BACK}")

while(1)
;~ -----------------------------------
;~  5 Click on Radio Button 5
;~ -----------------------------------
If Random() < 0.6 Then      ;5
    sleep(1000) 
    Opt("MouseCoordMode", 0)       
    MouseMove(406, 260, 0)
    sleep(1000) 
    send("{home}")
    sleep(1000)
    MouseMove(492, 305, 0)
    MouseClick("right")
    sleep(1000)
;~ -----------------------------------
;~ -----------------------------------
;~  4 Click on Radio Button 4
;~ -----------------------------------
ElseIf Random() < 0.6 Then ;4
    sleep(1000) 
    Opt("MouseCoordMode", 0)       
    MouseMove(406, 260, 0)
    sleep(1000) 
    send("{home}")
    sleep(1000)
    MouseMove(426, 305, 0)
    MouseClick("right")
    sleep(1000)
;~ -----------------------------------
;~ -----------------------------------
;~  5 Click on Radio Button 3
;~ -----------------------------------
ElseIf Random() < 0.5 Then ;4
    sleep(1000) 
    Opt("MouseCoordMode", 0)       
    MouseMove(406, 260, 0)
    sleep(1000) 
    send("{home}")
    sleep(1000)
    MouseMove(359, 305, 0)
    MouseClick("right")
    sleep(1000)
;~ -----------------------------------
;~ -----------------------------------
;~  F5 Refreshing page
;~ -----------------------------------
else        
    send("{F5}")
    send("{enter}")
    sleep(2000)
Endif
WEnd
EndFunc

; Stops the program
Func HK_STOP()
while 1 = 1
  Sleep(10)
wend
EndFunc
    
; Need to keep the program running until you press the hotkey
While 1
    Sleep(100)
WEnd
;;;;;;;;;
Func MyExit() ; Function to exot prog
    Exit 
EndFunc
Edited by chie
Link to comment
Share on other sites

One suggestion however is to check the HTML source by examining the string returned by _IEBodyReadHTML($oIE) because it is possible that there is code being generated by Javascript that you do not see with View Source.

There's nothing in the help file that will help you any further with this if in fact the form definition is broken. There are some examples in the forum of controlling radio boxes that were written before I wrote that function that may be of assistance to you.

Other than that, you'll need to go to MSDN and look for the properties and methods of radio buttons to figure out how to manipulate them.

Dale

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...