PantZ4 Posted November 5, 2006 Share Posted November 5, 2006 I have this fuction there is automaticly logs on... but I have a problem:Func Log_On() $x = $x + 1 $window[$x] = _IECreate("www.arto.dk",0,1,0) $form = _IEFormGetObjByName ($window[$x], "") $login = _IEFormElementGetObjByName ($form, "brugernavn") $password = _IEFormElementGetObjByName ($form, "kodeord") $signin = _IEFormElementGetObjByName ($form, "action") $username = "your username here" $password2 = "your password here" _IEFormElementSetValue ($login, $username) _IEFormElementSetValue ($password, $password2) _IEAction ($signin, "click") EndFuncoÝ÷ Ù8^¦ºé¢±«¢+ØÀÌØí½É´ô}%½ÉµÑ=© å9µ ÀÌØíÝ¥¹½ÝlÀÌØíát°ÅÕ½ÐìÅÕ½Ðì¤The form does not have a name, so it cash everytime and does not fill any of them...Error: X\AutoIt3\Include\IE.au3 (1245) : ==> The requested action with this object has failed.: $o_col = $o_object.document.forms.item ($s_Name) $o_col = $o_object.document^ ERRORThe Sides formulas:Name: Methode: postFormula: http://www.arto.dk/r2/frames/navigation.aspName: Methode: getFormula: http://www.arto.dk/css/changeTheme.aspThank you Link to comment Share on other sites More sharing options...
DaleHohm Posted November 5, 2006 Share Posted November 5, 2006 To get a reference to a form without a name, please see the function _IEFormGetCollection 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 More sharing options...
mikehunt114 Posted November 6, 2006 Share Posted November 6, 2006 Looks like the form is in a frame on that page, so it should help to grab the frame in an object variable, then use indexing and _IEFormGetCollection() on the frame object to put the form in an object variable. Then you have the rest already. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
chie Posted November 19, 2006 Share Posted November 19, 2006 I have a question When i used helpfile script to scan for forms I got as a result 4 forms & all names were 0 with other words the forms dont have a name, this how the html code looks like: So does this mean it is impossible to submit the info? 1.html <FORM ACTION=show.php METHOD=post> <TEXTAREA CLASS=in1 NAME=text ROWS=3 COLS=50></TEXTAREA><BR><BR> <INPUT CLASS=in1 TYPE=submit NAME=post VALUE="OK" ><BR><BR> <FORM ACTION=show.php METHOD=post> <TEXTAREA CLASS=in1 NAME=text ROWS=3 COLS=50></TEXTAREA><BR><BR> <INPUT CLASS=in1 TYPE=submit NAME=post VALUE="OK" ><BR><BR> & this is the code I tried to use but...it only works for the first form, any ideas why its not working if I change the 0 ? #include <IE.au3> $oIE = _IECreate ("C:\1.html") $oForm = _IEFormGetCollection ($oIE, 0) $oQuery = _IEFormElementGetCollection ($oForm, 0) _IEFormElementSetValue ($oQuery, "AutoIt IE.au3") ;~ _IEFormSubmit ($oForm) Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 19, 2006 Share Posted November 19, 2006 #include <IE.au3> $oIE = _IECreate ("C:\1.html") $oForm = _IEFormGetCollection ($oIE,0) For $i = 0 to 4 $oQuery = _IEFormElementGetCollection ($oForm, $i) _IEFormElementSetValue ($oQuery, "AutoIt IE.au3") Next ;~ _IEFormSubmit ($oForm) Link to comment Share on other sites More sharing options...
chie Posted November 19, 2006 Share Posted November 19, 2006 (edited) maybe I should have posted this in the first place, was my bad, did not notice: well, hire are (Helpfile scan showed 2 forms), loginform & 0 but the wierd thing is, that the code only works for the loginform, this is wierd, because if I delete the loginform, then the code works perfect for the 0 form. if i use _IEFormGetCollection then the form names should not mather.Now the question Shouldnt the code be working? <FORM NAME=loginform action=login.php method=post> <TR><TD><B CLASS=menu>user</B></TD> <TD><INPUT class=in1 maxLength=20 size=10 name=username></TD> <TD><B CLASS=menu>pass</B></TD> <TD><INPUT class=in1 type=password maxLength=20 size=10 name=password></TD> </TR></FORM> <FORM ACTION=login.php METHOD=POST> <TR><TD WIDTH=50>user</TD> <TD><INPUT CLASS=in1 SIZE=7 MAXLENGTH=20 TYPE=text NAME=username></TD> </TR> <TR> <TD WIDTH=50>pass</TD> <TD><INPUT CLASS=in1 SIZE=7 MAXLENGTH=20 TYPE=password NAME=password></TD> </TR> </TABLE> </FORM>1.html Edited November 19, 2006 by chie Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 19, 2006 Share Posted November 19, 2006 (edited) _IEFormGetCollection only grabs the form you specify, as you see there are 2 <Form> tags that means the first 2 forms are for 0 and the second 2 forms are for 1 using @extended you can grab how many forms, and elements are in the form as ive shown here #include <IE.au3> $oIE = _IECreate (@DesktopDir & "\1.html",0,1) _IELoadWait($oIE) _IEFormGetCollection($oIE) For $j = 0 to @extended - 1 $oForm = _IEFormGetCollection ($oIE,$j) For $i = 0 to @extended - 1 $oQuery = _IEFormElementGetCollection ($oForm, $i) _IEFormElementSetValue ($oQuery, "Form" & $j & " Value" & $i) Next Next Edited November 19, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
chie Posted November 19, 2006 Share Posted November 19, 2006 this was really helpful info, i think i understand, so if i change it to For $j = 1 to 1 & For $i = 0 to 0 it will input the info into the third box, otherwise it will input all boxes on the site. But can i ask you 1 more question? on the page im trying to use this, there is insane amount of code, but finally(after hours of experimenting) i think i managed to find the peace of code that wont let me input the info into the box: its because of the <INPUT...things even with 1 <INPUT....it stops working... if i delete them it works....but i cant delete them from original site, so i was wondering if you can give a hand 1 more time? <FORM ACTION=show.php METHOD=post onsubmit="post.disabled=true;"> <INPUT TYPE=hidden NAME=act VALUE=confirm> <INPUT TYPE=hidden name=group value=F> <INPUT TYPE=hidden name=age1 value=""> <INPUT TYPE=hidden name=age2 value=""> <INPUT TYPE=hidden NAME=itemid VALUE=9674458> <INPUT TYPE=hidden NAME=a1af8adafaa19ca6dce58206a3820d064 VALUE=cb4928b615eac3bc9362> <TEXTAREA CLASS=in1 NAME=text ROWS=7 COLS=50></TEXTAREA><BR><BR> </FORM> Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 20, 2006 Share Posted November 20, 2006 what is the link to the website Link to comment Share on other sites More sharing options...
chie Posted November 20, 2006 Share Posted November 20, 2006 what is the link to the websitehttp://www.rate.ee/show.phpusername: testuser2pass:123456you must log in or you wont see the form( there is only 1 visible texarea on the page & after you have logged in page will thow you back to http://www.rate.ee ) so simply klick this link again after u have logged in http://www.rate.ee/show.php Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 20, 2006 Share Posted November 20, 2006 so u want it to fill in text to the Kommenteeri? #include <IE.au3> $oIE = _IECreate("http://www.rate.ee/") $oForm = _IEFormGetCollection($oIE,0) $Username = _IEFormElementGetObjByName($oForm,"username") $Password = _IEFormElementGetObjByName($oForm,"password") _IEFormElementSetValue($Username,"testuser2") _IEFormElementSetValue($Password,"123456") _IEFormSubmit($oForm) _IENavigate($oIE,"http://www.rate.ee/show.php") $oForm = _IEFormGetCollection($oIE,0) $Kommenteeri = _IEFormGetObjByName($oForm,"text") _IEFormElementSetValue($Kommenteeri,"Text to say") _IEFormSubmit($oForm) not tested it should put Text to say in the komenteeri box Link to comment Share on other sites More sharing options...
chie Posted November 20, 2006 Share Posted November 20, 2006 so u want it to fill in text to the Kommenteeri?Yes. I tried this code you poosted already actyally &, nop it was not working with the site nor the 1.html file, The error message I always got with this was, (it submitted last, radio box 8),(as you see there are 8 Radio Boxes on the top). I also tried that @extended... thing & also no progress(even though it should fill all text areas.....theoretically )1.html Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 20, 2006 Share Posted November 20, 2006 (edited) You obviously don't understand how to use IE.au3 UDF because your just doing random stuff hoping for it to work try this accidently didnt put 1 cuz the komenteeri is on the second form EDIT: nope its actualy on the 3rd one, nope not that either #include <IE.au3> $oIE = _IECreate("http://www.rate.ee/") $oForm = _IEFormGetCollection($oIE,0) $Username = _IEFormElementGetObjByName($oForm,"username") $Password = _IEFormElementGetObjByName($oForm,"password") _IEFormElementSetValue($Username,"testuser2") _IEFormElementSetValue($Password,"123456") _IEFormSubmit($oForm) _IENavigate($oIE,"http://www.rate.ee/show.php") $oForm = _IEFormGetCollection($oIE,3) $Kommenteeri = _IEFormGetObjByName($oForm,"text") _IEFormElementSetValue($Kommenteeri,"Text to say") _IEFormSubmit($oForm) Edited November 20, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
chie Posted November 20, 2006 Share Posted November 20, 2006 try this accidently didnt put 1 cuz the komenteeri is on the second formEDIT: nope its actualy on the 3rd one, nope not that eitherActyally I have tryed this already also, even up to _IEFormGetCollection($oIE,30) & as far as I understand, ONLY the form submit works when _IEFormGetCollection($oIE,0) is used(but then it only submits the radio box labeled 10), for any other number it wont even submit the form, & it wont input the "Text to say" neather way. well first I used the 1.html to see if it works at all, & it wasnt, then just in case I also tried it with the site & it was not working neather. Side Note!: this makes me want to submit the "Text to say" into this textarea even more than before Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 21, 2006 Share Posted November 21, 2006 DOHHHHH i was using IEFormGetObjByName instead of IEFormElementGetObjByName my bad Link to comment Share on other sites More sharing options...
chie Posted November 21, 2006 Share Posted November 21, 2006 DOHHHHH i was using IEFormGetObjByName instead of IEFormElementGetObjByName my badYEs it works now. Thank you wery mutch, I need to experiment(learn) more now to be able to use it on any site now, Oh forgot this can even input into the hidden form & submit it ( example click a link & form will appear ) without waisting time on opening it. (Just discovered that ) 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