AcidCorps Posted November 7, 2007 Share Posted November 7, 2007 Ok I'm making a script that logs into an online notepad and saves data but when I get to the form that allows you to write the note it has two forms with the same name. well actually neither have a name which I've learned means to use '0' $oIE = _IECreate('http://www.jotthisdown.com/index.php') If StringInStr(StringTrimRight(_IEBodyReadText($oIE), StringInStr(_IEBodyReadText($oIE), @CRLF, 0, -1)), 'Welcome Back') = 0 Then ; checks to see if you are already logged in $oForm = _IEFormGetObjByName($oIE, 'loginform') $oUser = _IEFormElementGetObjByName($oForm, 'username') $oPassword = _IEFormElementGetObjByName($oForm, 'password') $oSubmit = _IEFormElementGetObjByName($oForm, 'Submit') _IEFormElementSetValue($oUser, $iUser) _IEFormElementSetValue($oPassword, $iPassword) _IEAction($oSubmit, 'click') EndIf $oForm = _IEFormGetObjByName($oIE, '0') $oNotes = _IEFormElementGetObjByName($oForm, 'notes') $oSubmit = _IEFormElementGetObjByName($oForm, 'Submit1') _IEFormElementSetValue($oNotes, 'Test') Link to comment Share on other sites More sharing options...
DaleHohm Posted November 7, 2007 Share Posted November 7, 2007 No name doesn't mean use 0... This is what you want: _IEFormGetCollection -------------------------------------------------------------------------------- Returns a collection object variable representing the Forms in the document or a single form by index. 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...
AcidCorps Posted November 7, 2007 Author Share Posted November 7, 2007 right when I do that I get two forms named 0 Link to comment Share on other sites More sharing options...
DaleHohm Posted November 7, 2007 Share Posted November 7, 2007 When you do what? 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...
AcidCorps Posted November 7, 2007 Author Share Posted November 7, 2007 (edited) $oForms = _IEFormGetCollection ($oIE) MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page") For $oForm In $oForms MsgBox(0, "Form Info", $oForm.name) Next Taken from _IEFormGetCollection help file Edit: I just made a Username: Demo, Password: Demo account in case it would help to see the form I'm using Edited November 7, 2007 by AcidCorps Link to comment Share on other sites More sharing options...
DaleHohm Posted November 7, 2007 Share Posted November 7, 2007 Pass an index parameter to _IEFormGetCollection to reference a specific form. 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...
Brickoneer Posted November 7, 2007 Share Posted November 7, 2007 (edited) Snip from help file: #include <IE.au3> _IEFormGetCollection ( ByRef $o_object [, $i_index = -1] ) ... $i_index Optional: specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection So if you want form number two, then use: _IEFormGetColection ($oIE, 1) Edited November 7, 2007 by Brickoneer Link to comment Share on other sites More sharing options...
AcidCorps Posted November 7, 2007 Author Share Posted November 7, 2007 give me an example of that? seen it down but can't remember where. Link to comment Share on other sites More sharing options...
Brickoneer Posted November 7, 2007 Share Posted November 7, 2007 Also from the help file... ; ******************************************************* ; Example 1 - Get a reference to a specific form by 0-based index, ; in this case the first form on the page ; ******************************************************* ; #include <IE.au3> $oIE = _IECreate ("http://www.google.com") $oForm = _IEFormGetCollection ($oIE, 0) $oQuery = _IEFormElementGetCollection ($oForm, 1) _IEFormElementSetValue ($oQuery, "AutoIt IE.au3") _IEFormSubmit ($oForm) Link to comment Share on other sites More sharing options...
AcidCorps Posted November 7, 2007 Author Share Posted November 7, 2007 heh, ok sorry didn't realize thats what you were talking about, Appreciate the help Link to comment Share on other sites More sharing options...
Klexen Posted November 7, 2007 Share Posted November 7, 2007 (edited) give me an example of that? seen it down but can't remember where. Try... $oForm = _IEFormGetCollection ($oIE) $oForm2 = _IEFormGetCollection ($oIE,1) Edited November 7, 2007 by Klexen 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