Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Need Help with _IEFormElementSetValue or Input type=file.

$
0
0
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,

[ autoit ]         
#include #include #include #include #include #include #include #include $path = 'E:\HotUpload\1.jpg' $ie = _IECreate( 'http://www.imgchili.com/') _IEErrorNotify(False) _IEErrorHandlerRegister() $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) Next 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) $oElement.fireEvent("onmouseover") $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) ExitLoop EndIf $IndexElement += 1 Next EndIf $Index += 1 Next


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?

Thanks.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>