danginkgo Posted November 23, 2016 Posted November 23, 2016 I am trying to handle a Windows dialog on a Windows 10 x64 virtual machine (vcloud). The dialog is opened by a web site to upload files. Here is the script: expandcollapse popup#include <FileConstants.au3> #include <MsgBoxConstants.au3> $files = "" For $i = 1 To UBound($CmdLine) - 1 $files &= '"' & $CmdLine[$i] & '" ' Next $handler = WinWait("[REGEXPTITLE:(Open|Upload)]","",10) If $handler Then writeToFile("window found " & $handler) If WinActive($handler) Then writeToFile("window is active " & $handler) Send($files) Send("{ENTER}") Else writeToFile("window is not active " & $handler) writeToFile("activate window " & $handler) If activateWindow($handler) Then writeToFile("activate window succeeded") Send($files) Send("{ENTER}") Else writeToFile("failed to activate ") EndIf EndIf Else writeToFile("window not found after 10s") EndIf Func activateWindow($h) writeToFile("Set state SHOW: " & WinSetState($h,"",@SW_SHOW)) writeToFile("WinActivate: " & WinActivate($h) return WinWaitActive($h,"",10) EndFunc Func writeToFile($text) Local Const $sFilePath = "C:\test\autoIT\x.out" Local $hFileOpen = FileOpen($sFilePath, $FO_READ + $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading/writing the file.") Return False EndIf FileWriteLine($hFileOpen, $text) FileClose($hFileOpen) Return True EndFunc ;==>Example If I open a remote desktop connection to that virtual machine the script works fine and the upload window is activated ad I can send text to it. If I minimize the remote desktop connection window the autoit script can't activate the upload window. Here is the output I get for both cases: ___________________________________________ window found 0x00040576 window is not active 0x00040576 activate window 0x00040576 Set state ENABLE: 1 Set state SHOW: 1 WinActivate: 0x00040576 activate window succeeded ___________________________________________ ___________________________________________ window found 0x000C058C window is not active 0x000C058C activate window 0x000C058C Set state ENABLE: 1 Set state SHOW: 1 WinActivate: 0 failed to activate ___________________________________________ Any clues on this? Is there other way that ? I can send text to that window?
genius257 Posted November 24, 2016 Posted November 24, 2016 Have you tried ControlSend? danginkgo 1 To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
danginkgo Posted November 25, 2016 Author Posted November 25, 2016 (edited) Yes, you are right , this works . Thanks for help. I finally figured this out. http://stackoverflow.com/questions/40759398/autoit3-could-not-send-text-to-windows-browse-dialog-on-virtual-machine Edited November 25, 2016 by danginkgo
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