jueki Posted March 2, 2008 Share Posted March 2, 2008 (edited) hi all,first of all, heres my code right now.#include <IE.au3> $oIE = _IECreate("http://www.captchakiller.com/upload_captcha"); Creates IE window $oForms = _IEFormGetCollection($oIE, 0); Finds the "Form" to upload the captcha $oNum1 = _IEFormElementGetCollection($oForms, 1); Finds the "CAPTCHA URL" Field $intNumber = "none"; Sets the "CAPTCHA URL" to none _IEFormElementSetValue($oNum1, $intNumber); Sets the "CAPTCHA URL" field $oMessage = _IEFormElementGetCollection($oForms, 2); Finds the "Upload File" field $sMessage = @ScriptDir & "\" & "captcha.jpg"; Sets the "Upload File" to @ScriptDir\captcha.jpg _IEFormElementSetValue($oMessage, $sMessage); Sets the "Upload File" fieldthis is the website: http://www.captchakiller.com/upload_captcha (sorry you have to register to see the page...)now to the problem..it successfully enters the "none" into the CAPTCHA URL field but it doesnt enter anything into the Upload File field.. why ? i used IE-Builder 2.0.0 to get the Form Object Index #'s. (0 = API Key, 1 = CAPTCHA URL, 2 = Upload File one).here are some lines of the websites sourcecode, if u dont want to log in (hope its enough code):<!-- start main content --> <span style="width: 100%;"><a name="content"></a></span> This page is for uploading files.<form action="/upload_captcha" method="post" id="uploadfiles-uploadform" enctype="multipart/form-data"> <div><div class="form-item"> <label for="edit-api-key">API Key: <span class="form-required" title="This field is required.">*</span></label> <input type="text" maxlength="128" name="api_key" id="edit-api-key" size="60" value="1A2EF0BC-7CEB-E159-8DE0-926DE5B6DB83" class="form-text required" /> <div class="description">Please enter an API Key.</div> </div> <div class="form-item"> <label for="edit-captcha-url">CAPTCHA URL: <span class="form-required" title="This field is required.">*</span></label> <input type="text" maxlength="128" name="captcha_url" id="edit-captcha-url" size="60" value="" class="form-text required" /> <div class="description">Please enter the URL this CAPTCHA came from.</div> </div> <div class="form-item"> <label for="edit-file-upload">Upload file: </label> <input type="file" name="files[file_upload]" class="form-file" id="edit-file-upload" size="48" /> <div class="description">Select the file to upload.</div> </div> <input type="submit" name="op" id="edit-submit" value="Submit" class="form-submit" /> <input type="hidden" name="form_token" id="edit-uploadfiles-uploadform-form-token" value="43fd6c314344b972c6f296f54db6e23f" /> <input type="hidden" name="form_id" id="edit-uploadfiles-uploadform" value="uploadfiles_uploadform" /> </div></form> <!-- end main content -->heres a pic of the website: Edited March 2, 2008 by jueki Link to comment Share on other sites More sharing options...
jueki Posted March 2, 2008 Author Share Posted March 2, 2008 hmm no one? =/ cant find help anywhere Link to comment Share on other sites More sharing options...
DaleHohm Posted March 3, 2008 Share Posted March 3, 2008 Please run in SciTe and look at the message generated when you run your script. Also look at the Remarks for _IEFormElementSetValue. You may not like the answers, but they are all right in front of you. 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...
jueki Posted March 4, 2008 Author Share Posted March 4, 2008 nevermind i found it out with a little more looking around.INPUT TYPE=FILE is write-protected, IE forces you to use the "Browse" button to input the file.but thanks for your answer! Link to comment Share on other sites More sharing options...
DaleHohm Posted March 4, 2008 Share Posted March 4, 2008 Glad you found the answer all by yourself.Too bad you didn't read the helpfule where it says:Note: You cannot use _IEFormElementSetValue to set the value of an INPUT TYPE=FILE element. Browser security restrictions prevent this element from being scripted. See the example below for a workaround.or look at the SciTe console that tells you Browser securuty prevents SetValue of TYPE=FILEDale 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...
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