Orgins Posted May 27, 2008 Share Posted May 27, 2008 (edited) Exp in help file:#include <IE.au3>$oIE = _IECreate ("http://www.google.com")$oForm = _IEFormGetObjByName ($oIE, "f")$oQuery = _IEFormElementGetObjByName ($oForm, "q")_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")_IEFormSubmit ($oForm)I've looked at goggles source code and I still don't understand.Google has:<form action="/search" name=fSite I'm playing with has:<form name="a" action="usercp.php"So I tried "a" for IEFormElementGetObjByName. (also tried usercp.php but don't think that would be it)Google has:<input maxlength=2048 name=q size=55 title="Google Search" <--that being the input search boxSite I'm playing with has:<div class="e3" id="nE"><Text thats already in the input box</div> <--that being the input box I want to put some text inSo I tried both e3 and nE for the IEFormElementGetObjByName.It didn't work.Any pointers? Edited May 27, 2008 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
Bert Posted May 27, 2008 Share Posted May 27, 2008 what is the website? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2008 Share Posted May 28, 2008 I've looked at goggles source code and I still don't understand. Google has: <form action="/search" name=f Site I'm playing with has: <form name="a" action="usercp.php" So I tried "a" for IEFormElementGetObjByName. (also tried usercp.php but don't think that would be it) There is a difference between the form, and a form element. Don't mix them up. If you want the form, use _IEFormGetObjByName(), not _IEFormElementGetObjByName(). Google has: <input maxlength=2048 name=q size=55 title="Google Search" <--that being the input search box Site I'm playing with has: <div class="e3" id="nE"><Text thats already in the input box</div> <--that being the input box I want to put some text in So I tried both e3 and nE for the IEFormElementGetObjByName. You want to find an element in the form, so you need the correct reference to the form first, from _IEFormGetObjByName(), then you can use that in getting the element with _IEFormElementGetObjByName(). The second won't work until you get the first right: ; Get object reference to form $oForm = _IEFormGetObjByName($oIE, "a") ; Get object reference to form element $oInput = _IEFormElementGetObjByName($oForm, "nE") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Orgins Posted May 28, 2008 Author Share Posted May 28, 2008 (edited) I'm still confused. (sorry) I tried (and ever other ="word/letter" I can find in the source code) $oForm = _IEFormGetObjByName($oIE, "a") $oInput = _IEFormElementGetObjByName($oForm, "nE") and $oForm = _IEFormGetObjByName($oIE, "a") $oInput = _IEFrameGetObjByName($oForm, "nE") I ran this (from the help): #include <IE.au3> $oIE = _IECreate("THE URL") $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 and only one form was found (a) so I know thats rite. Is there a script like that for Objects? Here part of the source code: <fieldset> <img src="images/icon.gif" onclick="de('nE',11);eS(this,3)"></legend> <div class="e3" id="nE"><Text thats already in the input box</div> </fieldset> I don't really understand it but I think it says if icon.gif is clicked then show object nE which is what I want to replace. I've tried doing _IEImgClick ($oIE, "icon.gif", "src", 2) (its the rite icon.gif) before _IEFormElementSetValue still no go. /e last thing I tried. #include <IE.au3> $oIE = _IECreate ("the url") $oForm = _IEFormGetObjByName ($oIE, "a") $oInput = _IEFormElementGetObjByName($oForm, "nE") _IELoadWait ($oIE) Sleep(1000) _IEImgClick ($oIE, "icon.gif", "src", 2) Sleep(1000) _IEFormElementSetValue ($oInput , "WORK DAMN IT") ;_IEFormSubmit ($oForm) and with _IEFrameGetObjByName (everything else is the same) #include <IE.au3> $oIE = _IECreate ("the url") $oForm = _IEFormGetObjByName ($oIE, "a") $oInput = _IEFrameGetObjByName($oForm, "nE") _IELoadWait ($oIE) Sleep(1000) _IEImgClick ($oIE, "icon.gif", "src", 2) Sleep(1000) _IEFormElementSetValue ($oInput , "WORK DAMN IT") ;_IEFormSubmit ($oForm) Edited May 28, 2008 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2008 Share Posted May 28, 2008 If you are seeing the form without referencing a frame, then don't drag frame stuff into this. Try this enumeration (run from SciTE): #include <IE.au3> $sURL = "http://THE.URL" $oIE = _IECreate($sURL) $oForms = _IEFormGetCollection($oIE) ConsoleWrite("Forms Info: There are " & @extended & " forms on this page" & @LF) For $oForm In $oForms ConsoleWrite(@TAB & "Form Info: .name = " & $oForm.name & @LF) $oElements = _IEFormElementGetCollection($oForm) ConsoleWrite(@TAB & "Elements Info: There are " & @extended & " elements in this form" & @LF) For $oElement In $oElements ConsoleWrite(@TAB & @TAB & "Element Info: .name = " & $oElement.name & " .id = " & $oElement.id & @LF) Next Next Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Orgins Posted May 28, 2008 Author Share Posted May 28, 2008 I'm still stumped. I ran the script you posted and it said there where 1 form 14 elements. Consolewrite never works for me (Idk why) so I used msgbox's. #include <IE.au3> $sURL = "The url" $oIE = _IECreate($sURL) $oForms = _IEFormGetCollection($oIE) Msgbox(1,"", "Forms Info: There are " & @extended & " forms on this page") ;ConsoleWrite("Forms Info: There are " & @extended & " forms on this page" & @LF) For $oForm In $oForms ConsoleWrite(@TAB & "Form Info: .name = " & $oForm.name & @LF) $oElements = _IEFormElementGetCollection($oForm) Msgbox(1,"", "Elements Info: There are " & @extended & " elements in this form") ;ConsoleWrite(@TAB & "Elements Info: There are " & @extended & " elements in this form" & @LF) For $oElement In $oElements Msgbox(1,"", "Element Info: .name = " & $oElement.name & " .id = " & $oElement.id) ;ConsoleWrite(@TAB & @TAB & "Element Info: .name = " & $oElement.name & " .id = " & $oElement.id & @LF) Next next On the 4th element I got an error "Error: The requested action with this object has failed." So I did Msgbox(1,"", "Element Info: .id = " & $oElement.id ) (leavening out $oElement.name) all 14 Id's where 0. Form a Elements name Id c 0 i 0 v 0 0 0 0 0 0 0 0 0 0 0 0 I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 28, 2008 Share Posted May 28, 2008 I think we are getting on the proverbial wild goose chase. Without seeing the page you are working with, I don't think I am going to figure out what you are doing. This HTML is invalid: <fieldset> <img src="images/icon.gif" onclick="de('nE',11);eS(this,3)"></legend> <div class="e3" id="nE"><Text thats already in the input box</div> </fieldset> ...so it only makes things worse. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
DaleHohm Posted May 28, 2008 Share Posted May 28, 2008 If this is really what you are tryin got change: <div class="e3" id="nE"><Text thats already in the input box</div> it is not a form field, so your current approach will be fruitless. Please run your code using F5 in SciTe to get use of ConsoleWrite and see other helpful meeages from IE.au3. If you want to change the ""<Text thats already in the input box" string, you need to work with the DIV element... $oDiv = _IEGetObjById($oIE, "nE") _IEPropertySet($oDiv, "innertext", "here is the new message") 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...
Orgins Posted May 29, 2008 Author Share Posted May 29, 2008 (edited) K thinks the $oDiv = _IEGetObjById thing is working. Only thing left to figure out is how to submit it/click the button to do it. I think I'll be able to figure it out. (maybe) If I click the submit button my self it submits the new text. so I should be able to get it working. Edited May 29, 2008 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. 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