Starko Posted March 3, 2020 Share Posted March 3, 2020 Hi Autoit Forum! I'm a Citrix / MDT / PowerShell Admin, who installs Windows Servers aka Citrix Master Images with Microsoft Deployment Toolkit. Normally I write small PowerShell Scripts for each application, which I embed into MDT to install Citrix Master Images, which are then cloned to become a Citrix Site. In 99% of the cases I succeed by using native MSI features, an EXE silent switch, file copy tricks, registry imports, App-V packages etc. But this time I encountered a setup.exe that is so strange, that I wasn't able to find any solution. But as the setup could be potentially finished by just a few keyboard strokes (UP, TAB, TAB, ENTER, ENTER, PAUSE, ENTER), after the initial launch, I thought I give AutoIt a try. I took a look at the Notepad tutorial and tried some simple example setups myself (which have working silent switches, but just to train), which worked quite OK, at least the Keyboard commands were working. But with this setup, I haven't been able to send any keyboard command to the window. This is the program (it's german, but shouldn't matter as we are purely talking about sending the right keyboard commands.) -> https://files.meinekleinefarm.net/f/3e914541d30b4ba8b498/ Please try this only on a test machine, as it installs drivers, fonts etc. This are the steps as screenshots, if I'm not mistaken they are: UP, TAB, TAB, ENTER, ENTER, (PAUSE or maybe PAUSE for EXIT screen to be seen), ENTER And this is the code I tried so far. Please notice that this is in no way meant to work, but to show which ways I have already tried, and non of them moved anything in the dialogue. Although manual keyboard input works all the time. run("client_setup.exe") ;Sleep(5000) WinWaitActive("Cargo Online Client Setup - [Installation Datenbanktreiber]") WinActivate("Cargo Online Client Setup - [Installation Datenbanktreiber]") Send("{DOWN}" & "{TAB 2}") ControlSend("Installation Datenbanktreiber", "Datenbankversion", "", "{TAB 2}") ControlSend("Datenbanktreiber", "", "", "{DOWN}") ControlSend("Installation Datenbanktreiber", "", "[CLASS:pbdw125; INSTANCE:1]", "{DOWN 5}") ControlClick("Cargo Online Client Setup","Bitte wählen Sie Ihre Datenbankversion",6,"left") ControlClick("Installation Datenbanktreiber", "Datenbankversion", "", "left", "" , 114, 32) WinClose("[CLASS:FNWND3125]", "") And a second try: expandcollapse popup#include <MsgBoxConstants.au3> ;Function for getting HWND from PID Func _GetHwndFromPID($PID) $hWnd = 0 $winlist = WinList() Do For $i = 1 To $winlist[0][0] If $winlist[$i][0] <> "" Then $iPID2 = WinGetProcess($winlist[$i][1]) If $iPID2 = $PID Then $hWnd = $winlist[$i][1] ExitLoop EndIf EndIf Next Until $hWnd <> 0 Return $hWnd EndFunc;==>_GetHwndFromPID ; Script Start - Add your code below here ;Run process $iPID = Run("client_setup.exe") ;Allow window to initialize... Sleep (10000) ;Get HWND. $hWnd = _GetHwndFromPID($iPID) WinWaitActive($hWnd) WinActivate($hWnd) ;Send("{DOWN}" & "{TAB 2}") ControlSend($hWnd, "", "", "{DOWN}") If @error Then ; check if _FileListToArray() function return any error MsgBox($MB_ICONERROR, '_FileListToArray', '@error = ' & @error & @CRLF & '@extended = ' & @extended) ; show error message EndIf ;Close WinClose($hWnd) Do you have any idea how I can send keyboard commands to this exe? As long as I get the cursor moving, I should hopefully be able to finish the rest myself. Link to comment Share on other sites More sharing options...
Nine Posted March 3, 2020 Share Posted March 3, 2020 Seems to me there is one silent installer : http://dcx.sap.com/sqla170/en/html/8168a3fa6ce21014a346e584d7ae12a7.html “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Starko Posted March 3, 2020 Author Share Posted March 3, 2020 Thank you very much for your reply. It might be, that there is a valid and working setup for the SQL Anywhere Database driver, but I have to use the vendor provided setup file shown in the screenshots. As you can see in the 2nd picture, there are other things installed alongside, like Ghostscript, some kind of mail solution, a PDF Printer and a Font. I could separate this stuff, but then I still wouldn't have the configuration this setup might apply to the OS and second it would be unsupported, as I didn't use the vendor provided installer. We already had contact with the vendor. They refuse to provide a silent setup of their installer, nor do they allow to use anything beside the provided installer. Which brings me back to my initial thought, I hope to use the original setup and automate its Keyboard control, to use it during my setup. To further clarify things. I don't need it silent. It's ok if the Windows is visible during the MDT process. It has to be unattended. I would start it via a PowerShell process, let AutoIt do its Magic and when the Processes are finished, the PowerShell process would finish too. I will clarify this in the initial post. Link to comment Share on other sites More sharing options...
Nine Posted March 3, 2020 Share Posted March 3, 2020 If you cannot use Send, I doubt you will find a way to automate this install. But here what I would attempt to do : 1- use #RequireAdmin 2- run the script x64 3- try sending VK instead of actual chars (see _WinAPI_Keybd_Event) Starko 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Starko Posted March 3, 2020 Author Share Posted March 3, 2020 I feel so stupid, but that might be, because I'm a first time user. If I want to control an EXE that runs with admin permissions, I should also run SciTE with admin permissions otherwise the Send commands can't traverse the evaluation I guess. This code runs just fine. I think it would require some tuning, but that's not something I'm capable of yet. Next step would be to find out, how to start this from a MDT/PowerShell command line. But I guess I find this in the FAQ or Wiki. Thank you very much! Here is the PoC Code: #RequireAdmin run("client_setup.exe") WinWaitActive("Cargo Online Client Setup - [Installation Datenbanktreiber]") WinActivate("Cargo Online Client Setup - [Installation Datenbanktreiber]") ControlSend("Cargo Online Client Setup - [Installation Datenbanktreiber]", "", 1007, "{UP}") ControlClick("Cargo Online Client Setup - [Installation Datenbanktreiber]", "", 1005, "left") WinWaitActive("Cargo Online Client Setup - [Installation Drucker/E-Mail]") WinActivate("Cargo Online Client Setup - [Installation Drucker/E-Mail]") ControlClick("Cargo Online Client Setup - [Installation Drucker/E-Mail]", "", 1006, "left") WinWaitActive("Cargo Online Client Setup - [Installation abgeschlossen]") WinActivate("Cargo Online Client Setup - [Installation abgeschlossen]") ControlClick("Cargo Online Client Setup - [Installation abgeschlossen]", "", 1003, "left") Link to comment Share on other sites More sharing options...
Earthshine Posted March 3, 2020 Share Posted March 3, 2020 I would use the AutoIt Information tool to identify the controls, then paste that information here so we can possibly do this more reliably My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Nine Posted March 3, 2020 Share Posted March 3, 2020 Glad you found a solution ! “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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