anky Posted April 12, 2011 Share Posted April 12, 2011 hi 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 _IEAction($oForm,"focus") WinActivate("Digital Media") Send("{Enter}") 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 12, 2011 Share Posted April 12, 2011 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") WinActivate("$hIE") $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") Else MsgBox(16, "Error", "Choose File window did not occur before timeout.") EndIf 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now