Jump to content

help with _IEFormElementRadioSelect


Dalex
 Share

Recommended Posts

Hi all, I have been stuck on this one for a few hours, I can't find anything that makes my light go on in the forum, and I can't wrap my mind around the examples in the help file. I have written many autoit scripts but very few <IE.au3>

In a nutshell I am writing 2 scripts, one will enable the "Do Not Disturb" function on my Vonage account, and the other will disable it. I will kick these off using task scheduler at the correct times. (it's a shame this isn't already a Vonage function for the do not disturb) So far my tiny little mind has about 9 hours invested in the script below.

Who knows, maybe someone else would like to use this script for their vonage account, of course at their own risk.

I will post the entire finished code if I ever finish it. There will be one to enable it, then one to disable it. (or maybe the same one if I can have it decide what to do by checking the current time)

My Problem: I cant select the radio button on the page, I am not sure of the syntax and I cannot find the "form" name so I am using the "TABLE id =dndsettings" (will that work)

I will paste some "Debug Bar" information below the code snippet that may help.

include <IE.au3>
;Go to the page
$0IE =_IECreate ("<a href='http://www.vonage.com/?login' class='bbc_url' title='External link' rel='external'>www.vonage.com/?login</a>", 1, 1, 1,1)


$o_form = _IEFormGetObjByName ($0IE, "logonForm")
$o_login = _IEFormElementGetObjByName ($o_form, "username")
$o_password = _IEFormElementGetObjByName ($o_form, "password")
$o_feature = _IEFormElementGetObjByName ($o_form, "goToSelection")

;Confidential data so I removed the username and password
$username = "MyUsername"
$password = "Mypassword"
$feature = "features"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEFormElementSetValue ($o_feature, $feature)

;This will sign in to your Vonage account.
;Beacause there was not a name for this button I tried several different ways to hit this button, this one worked may also be able to use the 'alt'
_IEFormImageClick($0IE, "<a href='http://www.vonage.com/images/homepage/btn_signin.gif' class='bbc_url' title='External link' rel='external'>http://www.vonage.com/images/homepage/btn_signin.gif</a>", "src")

;Find the correct featurewhich is the Do Not Disturb function and click on the "Configure" button
_IELoadWait ($0IE)
sleep(5000)
$0IE = _IEAttach ("911 Dialing is NOT automatic" , "text")
$o_dnd = _IEGetObjByName($0IE, "dndButton")
_IEAction ($o_dnd, "click")


;select the "On" radio button and thwe the "Submit" button
_IELoadWait ($0IE)
$0IE = _IEAttach ("Do not Disturb" , "text")

;Here is where the problem begins
$o_on = _IEGetObjByName($0IE, "dndsettings")

Here is a screen shot of the actual page that I am stuck on.

Posted Image

Edited by Dalex

[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Link to comment
Share on other sites

Hi Dalex,

I had a similiar issue going on, and I about beat my head against the way trying to figure out the IEGetelementbyName, and _IEFormelemtsubmit, and go help from another user suggesting:

$oDoc = _IEDocGetObj($oIE) 
        $oArray = $oDoc.getElementsByTagName ("input")
        for $element in $oArray
            if $element.value="on" Then $element.checked=true              
        next    
        for $element in $oArray
            If $element.Value = "Submit"  Then _IEAction($element, "click")  
        next

and similiar to disable you could use:

$oDoc = _IEDocGetObj($oIE) 
        $oArray = $oDoc.getElementsByTagName ("input")
        for $element in $oArray
            if $element.value="off" Then $element.checked=true              
        next    
        for $element in $oArray
            If $element.Value = "Submit"  Then _IEAction($element, "click")  
        next
Link to comment
Share on other sites

Thank you Iceburg, I had actually looked at your post on that matter a couple times, I think that maybe I was trying way to hard to use the "_IEFormElementRadioSelect" that I didn't look at it close enough .

I like to know how these things work so that I may figure it out myself next time, so I am studying the code you posted. (and at this point I will take any other advice you have)

It seems the "Submit" function is working perfectly, however something is not jiving on the radio buttons, I am thinking it has something to do with the line below.

$oArray = $oDoc.getElementsByTagName ("input")

Thank you again for your reply, I think it may be just what I needed.

I will post a reply when I get it working.

[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Link to comment
Share on other sites

Thank you Iceburg, I had actually looked at your post on that matter a couple times, I think that maybe I was trying way to hard to use the "_IEFormElementRadioSelect" that I didn't look at it close enough .

I like to know how these things work so that I may figure it out myself next time, so I am studying the code you posted. (and at this point I will take any other advice you have)

It seems the "Submit" function is working perfectly, however something is not jiving on the radio buttons, I am thinking it has something to do with the line below.

$oArray = $oDoc.getElementsByTagName ("input")

Thank you again for your reply, I think it may be just what I needed.

I will post a reply when I get it working.

Not a problem, Send me the source of that page and I can try and help more if you need it.
Link to comment
Share on other sites

Ha, funny thing I had just figured it out ran the test and everything worked when "click" the power went out!

Hopefully everything was saved when I     

"F5" tested it. I mean it was like 3 seconds after the script exited....

It ended up being a weird value name, the "on" tagname is "true" and the "off" name is "false" , I will post the code tomorrow morning , or after work. Right now I am laying my bed typing on my phone thinking how am I going to go to  sleep this early. 

[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

Link to comment
Share on other sites

OK, sorry it took me so long to get back to this, but if anybody wants these scripts here they are. I use the tasks scheduler to run them, one will enable the vonage "Do Not Disturb" the other will disable.

I also created a script for it to trigger after it runs to send me a text and an email to let me know that it ran.

Vonage_dnd_ON.au3

Vonage_dnd_OFF.au3

Edited by Dalex

[size="2"][u]Beer is living proof that God loves us and wants us to be happy.-- Ben Franklin[/u][/size]

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...