OK! So, there is a partial answer for the Synthetic Private Agent at least. It is possible to interact with System.FileOpen.Dialog using ctypes.windll.user32.keybd_event this simulates a keystroke and we can paste the clipboard into the dialog control and press enter. There is a natty little command called 'clip' in Windows to pass text to the clip board (Kudos Christian https://stackoverflow.com/users/2670792/christian for this gem https://stackoverflow.com/questions/20821815/copying-the-contents-of-a-variable-to-the-clipboard). #Copy to the system clipboard def addToClipBoard(text): command = 'echo | set /p nul=' + text.strip() + '| clip' os.system(command) Next, we need to paste that into the File name: control in the dialog - Ctrl-V should do the trick! Python's ctypes module gives us access to user32.dll which enables keystrokes #Use ctypes to send keyboard events for Ctrl-v (paste) time.sleep(1) ctypes.windll.user32.keybd_event(0x11, 0, 0, 0) #CTRL is down ctypes.windll.user32.keybd_event(0x56, 0, 0, 0) #v is down ctypes.windll.user32.keybd_event(0x11, 0, 0x0002, 0) #CTRL is up logging.info("Ctrl-v pressed.") time.sleep(1) ctypes.windll.user32.keybd_event(0x0D, 0, 0, 0) #Enter Key Down ctypes.windll.user32.keybd_event(0x0D, 0, 0x0002, 0) #Enter Key Up logging.info("Enter key pressed.") Voila, for Synthetic Private Agents running on Windows OS this works fine (for me, anyways!) Now the next problem how does that work on the Synthetic Hosted Agents running Windows in a Docker container on Linux? The problem is windll is not available on Linux but rather cdll but switching in ctypes.cdll.LoadLibrary("C:\Windows\\System32\\user32.dll") throws the error: Exception: OSError Message: C:\Windows\System32\user32.dll: cannot open shared object file: No such file or directory Stack Trace: Line 28, in <synthetic script> lib = cdll.LoadLibrary("C:\Windows\\System32\\user32.dll") Line 444, in LoadLibrary return self._dlltype(name) Line 366, in __init__ self._handle = _dlopen(self._name, mode) Maybe I'm doing this bit wrong or the dll has been removed or some other combination of reasons...?
... View more