jlorenz1 Posted December 31, 2006 Posted December 31, 2006 (edited) Hallo,I got the object by name of the webpage http://de.wikipedia.org/wiki/Spezial:Hochladen , but I've difficulties to change the fields. Only description works correctly. The Webpage has a SUBMIT-Button.If you want to see the website, you must log in as autoit with the password autoit.In the attachement I send you the source code of this webpage. For findingthe elements faster, which I wants to change, go on search and look for 'autoit'. I've tagged a commentary there.Thanks Jo #include <IE.au3> $oIE = _IECreate ('http://de.wikipedia.org/wiki/Spezial:Hochladen') $oForm = _IEFormGetObjByName ($oIE, 'Upload') ;Resultats document:7;wpupload:7,Upload:0 MsgBox(4096,'successful?',@error, 2) $oQuery1 = _IEFormElementGetObjByName ($oForm, 'wpDestFile') _IEFormElementSetValue ($oQuery1, 'another-named-a.gif') $oQuery2 = _IEFormElementGetObjByName ($oForm, 'wpUploadFile') _IEFormElementSetValue ($oQuery2, 'd:\a.gif') $oQuery3 = _IEFormElementGetObjByName ($oForm, 'wpUploadDescription') _IEFormElementSetValue ($oQuery3, 'my file description') ; attention: wpLicense is a combobox , Wanted: Value ='Bild-PD-alt' $oQuery4 = _IEFormElementGetObjByName ($oForm, 'wpLicense') _IEFormElementSetValue ($oQuery4, 'Bild-PD-alt') ; attention: this is a checkbox, which should be activated $oQuery5 = _IEFormElementGetObjByName ($oForm, 'wpWatchthis') _IEFormElementSetValue ($oQuery5, 'false') _IEFormSubmit ($oForm)Spezial_Hochladen.txt Edited December 31, 2006 by jlorenz1 Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
DaleHohm Posted December 31, 2006 Posted December 31, 2006 I don't see where you use _IEGetObjByName anywhere in that code. What line causes the error? Where is it you say you need to login? I went to that site and saw no username or password fields. Please show the output in the SciTe console. 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
jlorenz1 Posted December 31, 2006 Author Posted December 31, 2006 I don't see where you use _IEGetObjByName anywhere in that code. What line causes the error? Where is it you say you need to login? I went to that site and saw no username or password fields.Please show the output in the SciTe console.DaleHi Dale,thanks for your intention to help me. In the attachment you find a screenshot and source code with Scite.Go on http:\\de.wikipedia.org on the top on the right side you'll see ANMELDENclick this and you 'll log in with 'autoit' and the password 'autoit'. Don't forget to activate the checkbox. Submit and go onHOCHLADEN at the the left side in the center or type http://de.wikipedia.org/wiki/Spezial:Hochladen and you will be there.I'll try to help the others ... Thankswikipedia.zip Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
jlorenz1 Posted December 31, 2006 Author Posted December 31, 2006 (edited) I don't see where you use _IEGetObjByName anywhere in that code. What line causes the error? Where is it you say you need to login? I went to that site and saw no username or password fields.Please show the output in the SciTe console.DaleSorry Dale I meant _IEFormGetObjByName Line 4 in the script Johannes Edited December 31, 2006 by jlorenz1 Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
DaleHohm Posted December 31, 2006 Posted December 31, 2006 There is some sort of page redirect occuring here. After logging in, the page load completes on de.wikipedia.org/w/index.php?title=Spezial:Anmelden&action=submitlogin&type=login&returnto=Spezial:Hochladen -- this page does not include a form named "upload". After a few seconds it redirects to de.wikipedia.org/wiki/Spezial:Hochladen -- which DOES have a form named "upload" (note it is lower case). So, you need to check to insure that the redirect has occurred and completed before checking the page. You also should make the case match on the form ID as noted above. 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
jlorenz1 Posted December 31, 2006 Author Posted December 31, 2006 Hi Dale, use 'Upload' like written. This is the newest try of me. I can change only the field wpUploadDescription. In some cases I get the return value of 0, but nothing happens. Strange... Johannes #include <IE.au3> $oIE = _IECreate ('http://de.wikipedia.org/wiki/Spezial:Hochladen') $oForm = _IEFormGetObjByName ($oIE, 'Upload'), T H I S W O R K S W E L L ;Resultats document:7;wpupload:7 MsgBox(4096,'successful?',@error, 2) ;$oQuery1 = _IEFormElementGetObjByName ($oForm, 'wpDestFile') ;_IEFormElementSetValue ($oQuery1, 'another-named-a.gif') $oQuery2 = _IEFormElementGetObjByName ($oForm, 'wpUploadFile') _IEFormElementSetValue ($oQuery2, 'd:\a.gif') MsgBox(4160,'gif',@error) $oQuery3 = _IEFormElementGetObjByName ($oForm, 'wpUploadDescription') _IEFormElementSetValue ($oQuery3, 'my file description'); T H I S W O R K S W E L L ; attention: wpLicense is a combobox , Wanted: Value ='Bild-PD-alt' $oSelect = _IEFormElementGetObjByName ($oForm, "wpLicense") _IEFormElementOptionselect ($oSelect, "midipage.html", 3, "byValue") MsgBox(4160,'Combo',@error); Return Value 0 but nothing happened ; attention: this is a checkbox, which should be activated _IEFormElementCheckboxSelect ($oForm, 'wpWatchthis', '',1, 'byValue') MsgBox(4160,'Check',@error); Return Value 7 Sleep(4000) _IEFormSubmit ($oForm) Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
jlorenz1 Posted December 31, 2006 Author Posted December 31, 2006 Hi Dale & all the others,only O N E F I E L D don't work. It is this one.The source code of the problem in HTML is:<!-- I tried to change these following elements - keyword: autoit //--> <td align='right' valign='top'><label for='wpUploadFile'>Quelldatei:</label></td> <td align='left'> <input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onchange='fillDestFilename("wpUploadFile")' size='40' /><input type='hidden' name='wpSourceType' value='file' /> </td>This is the last version of my script:expandcollapse popup#include <IE.au3> $oIE = _IECreate ('http://de.wikipedia.org/wiki/Spezial:Hochladen') $oForm = _IEFormGetObjByName ($oIE, 'Upload') ;Resultats document:7;wpupload:7 MsgBox(4096,'successful?',@error, 2) ;********************************************************************* ; Only 1 field as problem - three tries without sucess $oQuery2 = _IEFormElementGetObjByName ($oForm, 'wpUploadFile') _IEFormElementSetValue ($oQuery2, 'd:\a.gif') MsgBox(4160,'gif',@error); Return Value 0 , but nothing happens $oQuery8 = _IEFormElementGetObjByName ($oForm, 'wpUploadFile') _IEFormElementSetValue ($oQuery8, 'd:\a.gif',0) MsgBox(4160,'gif1',@error); Return Value 0 , but nothing happens $oQuery9 = _IEFormElementGetObjByName ($oForm, 'wpSourceType') _IEFormElementSetValue ($oQuery9, 'abc') MsgBox(4160,'gif2',@error); Return Value 0 , but nothing happens ;************************************************************************ $oQuery1 = _IEFormElementGetObjByName ($oForm, 'wpDestFile') _IEFormElementSetValue ($oQuery1, 'another-named-a.gif') MsgBox(4160,'dest',@error); T H I S W O R K S W E L L $oQuery3 = _IEFormElementGetObjByName ($oForm, 'wpUploadDescription') _IEFormElementSetValue ($oQuery3, 'my file description'); T H I S W O R K S W E L L ; attention: wpLicense is a combobox , Wanted: Value ='Bild-PD-alt' $oSelect = _IEFormElementGetObjByName ($oForm, 'wpLicense') _IEFormElementOptionselect ($oSelect, 'gemeinfrei (public domain), da Schutzdauer abgelaufen', 1, 'byText') MsgBox(4160,'Combo1',@error); Return Value 0 T H I S W O R K S W E L L ; attention: this is a checkbox, which should be activated _IEFormElementCheckboxSelect ($oForm, 'wpWatchthis', '',1, 'byIndex') MsgBox(4160,'Check1',@error); T H I S W O R K S W E L L Sleep(4000) ;_IEFormSubmit ($oForm) Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
DaleHohm Posted December 31, 2006 Posted December 31, 2006 Hi Dale & all the others, only O N E F I E L D don't work. It is this one. The source code of the problem in HTML is: <!-- I tried to change these following elements - keyword: autoit //--> <td align='right' valign='top'><label for='wpUploadFile'>Quelldatei:</label></td> <td align='left'> <input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onchange='fillDestFilename("wpUploadFile")' size='40' /><input type='hidden' name='wpSourceType' value='file' /> </td> This is the last version of my script:The field is an INPUT TYPE=FILE element. Using the latest IE.au3 you should be getting the following diagnostic to the SciTe console: --> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType (Browser securuty prevents SetValue of TYPE=FILE) You cannot set this field value directly with script. Please see the remarks for _IEFormElementSetValue for comments and a workaround. 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
jlorenz1 Posted January 1, 2007 Author Posted January 1, 2007 The field is an INPUT TYPE=FILE element. Using the latest IE.au3 you should be getting the following diagnostic to the SciTe console:You cannot set this field value directly with script. Please see the remarks for _IEFormElementSetValue for comments and a workaround.DaleHi Dale,thanks for your patience - it was my first script in this way. Johannes Johannes LorenzBensheim, Germanyjlorenz1@web.de[post="12602"]Highlightning AutoIt Syntax in Notepad++ - Just copy in your Profile/application data/notepad++[/post]
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