danpaul23 Posted January 10, 2007 Share Posted January 10, 2007 I'm just learning to writing script so my apologies if this is obvious or should be somewhere in the help file or in past comments. I'm still new to most of the terminology and everything else.Basically, I'm trying to create some script which will auto complete a query on amazon's advanced book search page but am having trouble since the form does not appear to be named. I can edit the code so that it will open the page and I can get it to execute a search from the top (named) form but the I don't understand how to "point" the program to the unnamed frame with the advanced search options.thanks#include <IE.au3>$oIE = _IECreate()_IENavigate($oIE, "http://www.google.com")$oForm = _IEFormGetObjByName($oIE, "f")$oQuery = _IEFormElementGetObjByName($oForm, "q")_IEFormElementSetValue($oQuery, "place your search string here")_IEFormSubmit($oForm)_IELoadWait($oIE)Exit Link to comment Share on other sites More sharing options...
someone Posted January 10, 2007 Share Posted January 10, 2007 With IE objects that are not named check out the get collection functions... #include <IE.au3> $url = "http://www.amazon.com/b/ref=sv_b_0/102-5993488-0177751?ie=UTF8&node=241582011" $oIE = _IECreate($url) $oForm = _IEFormGetCollection($oIE, 2) ;returns form based on 0 index (see help file) $author = _IEFormElementGetObjByName($oForm, "author") _IEFormElementSetValue($author, "place your search string here") $title = _IEFormElementGetObjByName($oForm, "title") _IEFormElementSetValue($title, "place your search string here") $subject = _IEFormElementGetObjByName($oForm, "subject") _IEFormElementSetValue($subject, "place your search string here") ;_IEFormSubmit ($oForm);submits the form, comment out so you can see the results of the script This will fill a few fields on the page so you can see whats going on. Hope this helps! Also in case you haven't already search for IE builder... its a script written to help out with making IE scripts.. very helpful. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted January 10, 2007 Moderators Share Posted January 10, 2007 This should get you started. #include <IE.au3> $sURL = "http://www.amazon.com/b/ref=sv_b_0/102-5993488-0177751?ie=UTF8&node=241582011" $oIE = _IECreate($sURL) $oForm = _IEFormGetCollection($oIE, 2) $oAuthor = _IEFormElementGetObjByName($oForm, "author") $oTitle = _IEFormElementGetObjByName($oForm, "title") $oSubject = _IEFormElementGetObjByName($oForm, "subject") _IEFormElementSetValue($oAuthor, "Arthur Conan Doyle") _IEFormElementSetValue($oTitle, "The Complete Adventures") _IEFormElementSetValue($oSubject, "Sherlock Holmes") _IEFormSubmit($oForm) Link to comment Share on other sites More sharing options...
danpaul23 Posted January 15, 2007 Author Share Posted January 15, 2007 This should get you started. #include <IE.au3> $sURL = "http://www.amazon.com/b/ref=sv_b_0/102-5993488-0177751?ie=UTF8&node=241582011" $oIE = _IECreate($sURL) $oForm = _IEFormGetCollection($oIE, 2) $oAuthor = _IEFormElementGetObjByName($oForm, "author") $oTitle = _IEFormElementGetObjByName($oForm, "title") $oSubject = _IEFormElementGetObjByName($oForm, "subject") _IEFormElementSetValue($oAuthor, "Arthur Conan Doyle") _IEFormElementSetValue($oTitle, "The Complete Adventures") _IEFormElementSetValue($oSubject, "Sherlock Holmes") _IEFormSubmit($oForm) I'm trying to work with a page simmilar the Amazon search page targeted in the script above. I was trying to use this script as a reference. I couldn't get it to work (to set the values) so finally I retried this script and for some reason it doesn't seem to be able to set the values on the Amazon search page now either. Any ideas about what might be causing the problem or what else to try would be appreciated. Link to comment Share on other sites More sharing options...
DaleHohm Posted January 16, 2007 Share Posted January 16, 2007 Messages output to the SciTe console can be very helpful -- please include them. 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...
Scriptonize Posted February 27, 2007 Share Posted February 27, 2007 I'm trying to work with a page simmilar the Amazon search page targeted in the script above. I was trying to use this script as a reference. I couldn't get it to work (to set the values) so finally I retried this script and for some reason it doesn't seem to be able to set the values on the Amazon search page now either.Any ideas about what might be causing the problem or what else to try would be appreciated.You need to change one value to get that sample to work:Change CODE$oForm = _IEFormGetCollection($oIE, 2) into CODE$oForm = _IEFormGetCollection($oIE, 3)Success If you learn from It, it's not a mistake 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