Jump to content
Sign in to follow this  

Need Help with _IEFormElementSetValue or Input type=file.

Recommended Posts

Hi Mates

I am new here, new to AutoIT & Automation.

This is my first try at AutoIT

I have created a script to upload some image files to my account

Here is the code,


$path = 'E:\HotUpload\1.jpg'
$ie = _IECreate( 'http://www.imgchili.com/')
$oForms = _IEFormGetCollection($ie)

;Debug Code to get fom info
ConsoleWrite( "Forms Info There are " & @extended & " forms on this page" & @CRLF)
For $oForm In $oForms
ConsoleWrite( "Form Info " & $oForm.name & @CRLF)
ConsoleWrite("End loop of IE Forms" & @CRLF)
;There ae total of 1 form and its name is 0

$Index = 0
For $oForm In $oForms
$oFormElements = _IEFormElementGetCollection($oForm)
If IsObj($oFormElements) Then
$IndexElement = 0
For $oElement In $oFormElements
If $oElement.Type = 'file' Then
$oPath = _IEFormElementGetObjByName($oElement, $oElement.Name, $indexElement+1)

$iBrowserX = _IEPropertyGet($oElement, "browserx")
$iBrowserY = _IEPropertyGet($oElement, "browsery")
$iWidth = _IEPropertyGet($oElement, "width")
$iHeight = _IEPropertyGet($oElement, "height")

ControlClick(_IEPropertyGet($IE, "hwnd"), "", "", "left", 1, $iBrowserX + $iWidth/2, $iBrowserY + $iHeight/2)
;ControlSetText(_IEPropertyGet($IE, "hwnd"), "", "",$path)

_IEFormElementSetValue($oPath, $path)
$IndexElement += 1
$Index += 1

The problem is after executing the script, I get my cursor at the input fiels but my text specified in $path is not set.

I have tried ControlSetText & _IEFormElementSetValue.

But I can't set the Text.

Is there any way to do this? Any othe function or method?


Share this post

Link to post
Share on other sites

See my sig for suggestions.


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...