Jump to content

IE T2.0-4 - Setting Filename elements


Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

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")
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...