diikee Posted May 24, 2013 Share Posted May 24, 2013 (edited) this code works as expected, except the page reloads and current OPTIONs are lost. How can I keep them persistent? _IELoadWait($oIE) Sleep(2000) $oForm = _IEFormGetObjByName ($oIE, "myform") $tz = _IEFormElementGetObjByName ($oForm, "OidSB1.17.2.19.1.1") If @error = "0" Then For $t in $tz $tzop = _IETagNameGetCollection($tz, "OPTION") For $tzo in $tzop $o = $tzo.innerText ---->> problem is here Sleep(4000) _IEFormElementOptionSelect($tz, $o, 1, "bytext") ;ConsoleWrite($tz.name & " Codec: " & $tzo.innerText & @CRLF) ConsoleWrite("Codec: " & $tzo.innerText & @CRLF) FileWrite($file, " Codec: " & $o & @CRLF) Sleep(8000) Next ExitLoop Next ElseIf @error = "3" Or @error = "4" Or @error = "7" Then ConsoleWrite("Can't find the Codec selection option" & @CRLF) EndIf Sleep(2000) below is the error that I get, C:autoitFTSuite.au3 (399) : ==> The requested action with this object has failed.: $o = $tzo.innerText $o = $tzo.innerText^ ERROR Edited May 24, 2013 by diikee Link to comment Share on other sites More sharing options...
BrewManNH Posted May 24, 2013 Share Posted May 24, 2013 You've been here 5 years but you don't know this isn't the place to ask for this type of help? This should have been posted in General Help & Support. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
diikee Posted May 24, 2013 Author Share Posted May 24, 2013 this code works as expected, except the page reloads and current OPTIONs are lost. How can I keep them persistent? _IELoadWait($oIE) Sleep(2000) $oForm = _IEFormGetObjByName ($oIE, "myform") $tz = _IEFormElementGetObjByName ($oForm, "OidSB1.17.2.19.1.1") If @error = "0" Then For $t in $tz $tzop = _IETagNameGetCollection($tz, "OPTION") For $tzo in $tzop $o = $tzo.innerText ---->> problem is here Sleep(4000) _IEFormElementOptionSelect($tz, $o, 1, "bytext") ;ConsoleWrite($tz.name & " Codec: " & $tzo.innerText & @CRLF) ConsoleWrite("Codec: " & $tzo.innerText & @CRLF) FileWrite($file, " Codec: " & $o & @CRLF) Sleep(8000) Next ExitLoop Next ElseIf @error = "3" Or @error = "4" Or @error = "7" Then ConsoleWrite("Can't find the Codec selection option" & @CRLF) EndIf Sleep(2000) below is the error that I get, C:autoitFTSuite.au3 (399) : ==> The requested action with this object has failed.: $o = $tzo.innerText $o = $tzo.innerText^ ERROR Link to comment Share on other sites More sharing options...
diikee Posted May 24, 2013 Author Share Posted May 24, 2013 I have been using AutoIt without issues for 5 years, forgot how to post. I changed it already Link to comment Share on other sites More sharing options...
Danp2 Posted May 24, 2013 Share Posted May 24, 2013 Reading your code, the outer FOR...IN statement will only get processed once due to the ExitLoop. Also, you use the statement For $t in $tz but your next statement uses the original variable (the collection) rather than the object. I would change the line to this: $tzop = _IETagNameGetCollection($t, "OPTION") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
diikee Posted May 24, 2013 Author Share Posted May 24, 2013 DanP2, I tried your suggestion but it exits without setting any value since $tz references a form on the main GUI. Code to be automated is <TD class=input codec <SELECT id=OidSB1.17.2.19.1.1 onchange=setEcam(this) name=OidSB1.17.2.19.1.1> <OPTION value=h264>h264 <OPTION selected value=jpeg>jpeg </OPTION> </SELECT> </TD> After it sets the parameter to h264 or jpeg, then it should exit but failies with C:autoitFTSuite.au3 (399) : ==> Variable must be of type "Object".: For $tzo in $tzop For $tzo in $tzop^ ERROR Link to comment Share on other sites More sharing options...
Danp2 Posted May 24, 2013 Share Posted May 24, 2013 You need to add some error checking to your script. Based on your description, it sounds like the call to _IETagNameGetCollection is erroring out (not finding the desired elements). Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
diikee Posted May 24, 2013 Author Share Posted May 24, 2013 (edited) the problem I believe is that the anchor _IELoadWait($oIE) Sleep(2000)$oForm = _IEFormGetObjByName ($oIE, "myform") is loosing its objects when the GUI refreshes for changes to take effect and need to re-anchor. Which means I might be in the same loop forever. Edited May 24, 2013 by diikee Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now