Jump to content
Sign in to follow this  

_IEFormGetName\Collection really starting to piss me off

Recommended Posts


Why dosent the input type file html tag work with _IE functions? really really

this is the page its 1 form the name of my inputfile is.

<form action="index.php" method="post" enctype="multipart/form-data"/>

<input type="file" name="userfile"/><br/>

<input type="submit" value="Uppload"/>


This is auto-it with _IEFORMGETNAME

#include <IE.au3>

$oIE = _IECreate ("http://mydamnpage.com/")

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 1)

_IEFormElementSetValue ($oQuery, "This is text")

_IEFormSubmit ($oForm);hit submit now.

result: Nothing is written nothing is submited.

ive tried 2000 ways to do this still nothing with is written but it works with the Original AutoIt helpfile code

#include <IE.au3>

$oIE = _IECreate ("http://www.google.com")

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 1)

_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")

_IEFormSubmit ($oForm)

and here its working.

Share this post

Link to post
Share on other sites

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.

; *******************************************************
; Example 5 - Set the value of an INPUT TYPE=FILE element
;               Same as previous example, but with invisible window
;               (security restrictions prevent using _IEFormElementSetValue)
; *******************************************************
#include <IE.au3>

$oIE = _IE_Example("form")

; Hide the browser window to demonstrate sending text to invisible window
_IEAction($oIE, "invisible")

$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oInputFile = _IEFormElementGetObjByName($oForm, "fileExample")

; Assign input focus to the field and then send the text string
_IEAction($oInputFile, "focus")
$hIE = _IEPropertyGet($oIE, "hwnd")
ControlSend($hIE, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "C:\myfile.txt")

MsgBox(0, "Success", "Value set to C:\myfile.txt")
_IEAction($oIE, "visible")

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post

Link to post
Share on other sites

As ProgAndy points out, it is documented in the helpfile, there is an example of how to work around it and you even get a message "Browser securuty prevents SetValue of TYPE=FILE" in the SciTe console when you try to do it.

I don't know what else I could have done.


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

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.