Jump to content
Sign in to follow this  

upload script failing in window server 2003

Recommended Posts


i am using auto it script to upload a file. It is working fine in windowXP but when i try to execute the script in window server 2003 it fails.

here is script

#include <IE.au3>

$oWindow = _IEAttach("Digital Media");sub-text title of window

$oForm = _IEGetObjByName ($oWindow, "Uploader1__Insert");id of browse-button to click


WinActivate("Digital Media")


WinWaitActive("Choose File","",5)

$otitle = WinGetTitle("Choose File")

Local $file = "C:\Cesi-selenium\image\bloom.jpg"

ControlSetText($otitle, "", "Edit1", $file)

ControlClick($otitle, "", "Button2")

In window server 2003 it is clicking the browse button successfully but after that it stops on choose file window without giving any error

Please help !!!!!!!! Its urgent

Share this post

Link to post
Share on other sites

What does "it stops on choose file" mean? Is your problem at the WinWaitActive()? Does it just hang there for 5 seconds, or does the script finish quickly without appearing to do anything. Your "Choose File" might not adequately identify the window.

Something more like this might be more reliable:

#include <IE.au3>

$oIE = _IEAttach("Digital Media") ; assumes IE window is already open
$hIE = _IEPropertyGet($oIE, "hwnd")
$oButton = _IEGetObjByName($oIE, "Uploader1__Insert") ; id of browse-button to click
_IEAction($oButton, "focus")
ControlSend($hIE, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
$hChooseFile = WinWait("Choose File", "", 5)
If $hChooseFile Then
    $sFile = "C:\Cesi-selenium\image\bloom.jpg"
    ControlSetText($hChooseFile, "", "Edit1", $sFile)
    ControlClick($hChooseFile, "", "Button2")
    MsgBox(16, "Error", "Choose File window did not occur before timeout.")

File management dialogs get some special security associated with them depending on the version of IE you are running. It might that ControlSetFocus() followed by ControlSend() instead of ControlSetText(), for example. Play with it.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...