Jump to content

Upload file via IE browser


Recommended Posts

I am not sure if this is the right place to post this so please forgive me if it is not.

I have been battling with trying to get file upload going but have not been successful. Using information found on this forum, I have gotten as far as manipulating the "Choose File to Upload" pop up window. I find, though, that once I close the pop up window, with the Open button, the command to click the upload button doesn't always work. In fact, it only works occasionally. When I use the Cancel button in the pop up, I can click the upload button every time (but, of course, there is nothing to upload). Other commands in my script seem to work after the pop up is closed (however it is closed) though.

Can someone explain and help me fix this?

Code to manipulate the "Choose File to Upload" pop up window (I copied this from the forum and modified it):

Local $sCommand = _
            'Local ' & _
            '$Dummy1 = WinActivate("Choose File to Upload", ""), ' & _
            '$Dummy1a = WinWaitActive("Choose File to Upload", ""), ' & _
            '$Dummy2 = Sleep(1000), ' & _
            '$Dummy3 = ControlSetText("Choose File to Upload", "", "[CLASS:Edit; INSTANCE:1]","c:\filename.ext"), ' & _
            '$Dummy4 = ControlClick("Choose File to Upload", "", "[CLASS:Button; INSTANCE:1]") ' & _
            ''

$sCommand = '"' & StringReplace($sCommand, '"', '""') & '"'

Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand)

 

Command to Click upload button:

$oRetCode = _IEAction ($oUpload, "click")

This returns a value of 1 each time, but the button is not activated if the "Choose File to Upload" pop up window was closed by clicking the Open button.

Let me know if additional information is required and I will supply it. Thanks in advance.

 

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...