FHeithausen Posted February 26, 2019 Posted February 26, 2019 Hello everyone, i'm pretty new to Autoit and i just tried to write my first script for integrating it into opsi. The problem i want to solve with the script is that windows pops up a security warning every time opsi starts the citrix receiver cleanup utility. This only happens on Devices that are not connected to our Domain. The Scripts i wrote recognize the opened window, set it in focus, but don't click the "Ausführen" Button. Script No.1: NWSicherheitswarnung() Func NWSicherheitswarnung() ; Wait 10 seconds for the Window to appear. WinWait("Datei öffnen - Sicherheitswarnung") ;Activate Window WinActivate ( "Datei öffnen - Sicherheitswarnung" ) ;Wait 2 Seconds sleep (2000) ; Send Mouseclick to Windows Button Ausführen. ;ControlClick ("Datei öffnen - Sicherheitswarnung", "", "[ID:4426]" ) <-- This was my first try ControlClick("Datei öffnen - Sicherheitswarnung", "", "[CLASS:Button; TEXT:A&usführen; INSTANCE:1]") EndFunc ;==>NWSicherheitswarnung Script No. 2: NWSicherheitswarnung() Func NWSicherheitswarnung() ; Wait 10 seconds for the Window to appear. WinWait("Datei öffnen - Sicherheitswarnung") ;Activate Window WinActivate ( "Datei öffnen - Sicherheitswarnung" ) ; Wait for 2 seconds. Sleep(2000) ; Send Left Arrow, Enter to Window. Send ("{Left}{Enter}") EndFunc ;==>NWSicherheitswarnung The Instance as well as the Control ID for the Button have been optained with the Au3Info tool. I would appreciate if anyone could help out a newb. Thanks in advance. ;)
FrancescoDiMuro Posted February 26, 2019 Posted February 26, 2019 (edited) Hi @FHeithausen, and welcome to the AutoIt forums Try with ControlClick("Datei öffnen - Sicherheitswarnung", "", 4426) or ControlClick("Datei öffnen - Sicherheitswarnung", "", "[CLASS:Button; TEXT:&Ausführen; INSTANCE:1) Edited February 26, 2019 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
FHeithausen Posted February 27, 2019 Author Posted February 27, 2019 @FrancescoDiMuro Thanks for your reply. :) I tried the code you wrote, but the script still does not click the button. :/ Any more ideas? This is the summary that AuInfo gives me when i target the "Ausführen" button in the window: >>>> Window <<<< Title: Datei öffnen - Sicherheitswarnung Class: #32770 Position: 448, 204 Size: 470, 319 Style: 0x94C80AC4 ExStyle: 0x00010101 Handle: 0x00040200 >>>> Control <<<< Class: Button Instance: 1 ClassnameNN: Button1 Name: Advanced (Class): [CLASS:Button; INSTANCE:1] ID: 4426 Text: A&usführen Position: 252, 140 Size: 91, 26 ControlClick Coords: 43, 14 Style: 0x50010000 ExStyle: 0x00000004 Handle: 0x0003023A >>>> Mouse <<<< Position: 298, 180 Cursor ID: 0 Color: 0x5A0033 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Es kann nicht überprüft werden, von wem diese Datei erstellt wurde. Möchten Sie die Datei wirklich ausführen? Name: P:\citrix-receiver\ReceiverCleanupUtility.msi Typ: Windows Installer-Paket Von: P:\citrix-receiver\ReceiverCleanupUtility.msi A&usführen Abbrechen Diese Datei befindet sich an einem Speicherort außerhalb des lokalen Netzwerks. Dateien von Ihnen unbekannten Speicherorten können den PC beschädigen. Führen Sie die Datei nur aus, wenn der Speicherort vertrauenswürdig ist. <A>Welches Risiko besteht?</A> >>>> Hidden Text <<<< Herausgeber: &Speichern Vor dem Öff&nen dieser Datei immer bestätigen @faustf Will do in the future. ;)
FrancescoDiMuro Posted February 27, 2019 Posted February 27, 2019 @FHeithausen You should debug a little more your code. You could try to get the handle of the Window with WinGetHandle() and try to see if a valid handle is returned Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
faustf Posted February 27, 2019 Posted February 27, 2019 (edited) if you use a one script . scenario: the script Run(........ your exe ) , probably when arrive to pop up your (datei ofnen .......image up ) the script , stop , because wait your input . try to do in this mode one script run your exe and other script compiled in exe , run before your citrix , the second script in while 1 control if exist a Datei öffnen - Sicherheitswarnung if yes push a button and close itself Edited February 27, 2019 by faustf
FHeithausen Posted February 27, 2019 Author Posted February 27, 2019 @faustf I use the opsi script to call the file wich contains the Citrixreceivercleanuputility (.msi file) wich i build the flags for the Receivercleanuputility into. To test i manually open the .exe wich i compiled from my autoit script. @FrancescoDiMuro NWSicherheitswarnung() Func NWSicherheitswarnung() Local $hWnd = WinGetHandle("[CLASS:#32770]") ; Wait 10 seconds for the Window to appear. WinWait($hWnd) ;Activate Window WinActivate ($hWnd) ;Wait 2 Seconds sleep (2000) ; Send Mouseclick to Windows Button Ausführen. ControlClick ($hWnd, "", 4426) ;ControlClick("$hWnd", "", "[CLASS:Button; TEXT:&Ausführen; INSTANCE:1") EndFunc ;==>NWSicherheitswarnung Thats the way i did it now. The handle that WinGetHandle reads out seems to be correct, because the Script recognizes the window and sets it active again, but i still have no luck with getting it to click that "Ausführen" button....
Nine Posted February 27, 2019 Posted February 27, 2019 If nothing works, try send ("{TAB x}") to get the the right button (where x equals the number of tab required) and Send ("{SPACE}") to actually push the button “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
FHeithausen Posted February 28, 2019 Author Posted February 28, 2019 @Nine Thanks for your idea but it still does not work. What wonders me the most is, that if i run the script (wich detects the windows and switches to it) and then manually tab 2 times i get the selection to go to the "Ausführen" button so in theory the script should work??
Juvigy Posted February 28, 2019 Posted February 28, 2019 Do you have #RequireAdmin in the beginning of the script?
Nine Posted February 28, 2019 Posted February 28, 2019 5 hours ago, FHeithausen said: @Nine Thanks for your idea but it still does not work. What wonders me the most is, that if i run the script (wich detects the windows and switches to it) and then manually tab 2 times i get the selection to go to the "Ausführen" button so in theory the script should work?? So you mean that the focus does not even budge when the script is sending TAB ? Like @Juvigy said have you tried to run it with #RequireAdmin ? If using admin works you could do a shot script and use RunAsWait () with "administrator" specifically to close that window. Another suggestion, try a MouseClick to the button. “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Suzanneholman Posted February 28, 2019 Posted February 28, 2019 On 2/27/2019 at 4:42 AM, Nine said: If nothing works, try send ("{TAB x}") to get the the right button (where x equals the number of tab required) and Send ("{SPACE}") to actually push the button What are you saying I didn't understand a single word. http://conversationstarters.wiki/
Dwalfware Posted February 28, 2019 Posted February 28, 2019 9 hours ago, Suzanneholman said: What are you saying I didn't understand a single word. He is referring to sending keyboard - keys to the window Send ( "keys" [, flag = 0] )
FHeithausen Posted February 28, 2019 Author Posted February 28, 2019 @Nine Yup. The windows gets selected, but the focus does not move from "Abbrechen" to "Ausführen. Even if i use #RequireAdmin. I already tried using mouse clicks by using ControlClick and the Control ID found with AuInfo 🤔
Nine Posted February 28, 2019 Posted February 28, 2019 5 minutes ago, FHeithausen said: ControlClick and the Control ID I mean MouseClick ("left",$x,$y,1), just so you have tried all possible solutions... “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
FHeithausen Posted March 4, 2019 Author Posted March 4, 2019 @nine Good morning. Hope you had a nice weekend. I have not yet tried it that way. But would that solution work with monitors with different resolutions?
Nine Posted March 4, 2019 Posted March 4, 2019 6 hours ago, FHeithausen said: @nine Good morning. Hope you had a nice weekend. I have not yet tried it that way. But would that solution work with monitors with different resolutions? Good morning to you too. Yes, it would be possible with some minor calculations. But the main thing is to test if this works or not... “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
FHeithausen Posted March 5, 2019 Author Posted March 5, 2019 Just tried it using the MouseClick command. Doesn't seem to work either. Honestly have no idea whats going on....
Nine Posted March 5, 2019 Posted March 5, 2019 32 minutes ago, FHeithausen said: Just tried it using the MouseClick command. Doesn't seem to work either. Honestly have no idea whats going on.... Sorry me neither, never seen such a thing...Maybe someone else will have 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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Juvigy Posted March 5, 2019 Posted March 5, 2019 Use the taskmanager and compare the usernames of the MSI window and the Scite. Are they the same? Try moving the MSI to your C:\ and test again.
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