Jump to content

Choose File to Upload - Unable to Select File

Recommended Posts


Hi guys,

I'm trying to create a script where I navigate to a web app, click a browse button to open a "Choose File to Upload" screen, then select a file to upload, and click Open. 

Here's my code: 

; Click Browse Button (Step 1 attachment)
$oIE = _IECreate ("https://InternalWebsite.net/import.aspx", 1, 1, 1, 1)
$o_submit = _IEGetObjByName ($oIE, "FILE1")
_IEAction ($o_submit, "click")
; Navigate to file (Step 2 attachment)
$oIE = _IECreate ("https://InternalWebsite.net/import.aspx", 1, 1, 1, 1)
$oT = _IEGetObjById($oIE, 'fileExample')
WinWait("Choose File to Upload")
$hChoose = WinGetHandle("Choose File to Upload")
ControlSetText($hChoose, "", "Edit1", "C:\filepath\1.csv")
ControlClick($hChoose, "", "Button1")

My script gets stuck on selecting a file. I tried even using a SEND command to type in the file path, but that doesn't work either. I'm using IE and AutoIt v3.3.14.2. Funny thing is that if I intervene and select the file manually and click open, my script continues successfully..  Any suggestions would be appreciated. Thanks!


Step 1 - Click Browse.png

Step 2 - Select File.png

Share this post

Link to post
Share on other sites

With fileopendialog or whatever it is called, the script waits for the window to close, waits for the return value, here it's probably the same.

Maybe you could have a adlib function checking for that window every second or so, and once it's up, the function does its thing and the script continues.

In said function you can have a check so that once it runs, it never runs again. or maybe unregister the adlib.



Paster - Main function is to paste text, but has more functions. (No longer mantained, switched to String Trigger)

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples


Share this post

Link to post
Share on other sites

Any solution for this problem?

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

  • Similar Content

    • ruslanas402
      By ruslanas402
      Greeting, so I've been trying to come up with solution, but no luck. Despite I tried to automate upload function, I released that it freezes after "Choose File to Upload" window appears..
      #include <IE.au3> ;#include <_Dbug.au3> Global $oIE = _IECreate("http://tinypic.com/", 1) Global $upload2 = _IEGetObjById($oIE, "the_file") _IEAction($upload2, "click") ;Sleep(1000) $hWnd = WinGetHandle("Choose File to Upload") MsgBox(0, "", $hWnd) Have anybody faced this situation?
      btw: srry for the advertise Besides it's no matter which site I'm trying to do this it's all the same.