Sign in to follow this  
Followers 0
cassetti

IE T2.0-4 - Setting Filename elements

3 posts in this topic

Here is the code i'm trying to do - it won't work - and i'm trying to figure out a workaround that doesn't involve using the mouse

#include <IE.au3>

$oIE = _IE_Example("form")
$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oFile = _IEFormElementGetObjByName($oForm, 'fileExample')
_IEFormElementSetValue($oFile, "c:\test.txt")

any suggestions on how to actually get it to work?

Share this post


Link to post
Share on other sites



Try this:

#include <IE.au3>

$sFilePath = "C:\test.txt"

$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oFile = _IEFormElementGetObjByName ($oForm, 'fileExample')
$oFile.focus ()
Send("{Tab}")
Send("{Space}")
WinWait("Choose file")
; This just keeps it from making a hidden error
If FileExists($sFilePath) Then
    WinSetState("Choose file", "", @SW_HIDE)
EndIf
ControlSetText("Choose file", "", "Edit1", $sFilePath)
ControlClick("Choose file", "", "Button2")

Share this post


Link to post
Share on other sites

Yup - after doing more searching - i found the answer about the inability to modify it directly - so i used .focus

thanks!

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  
Followers 0