Jump to content

Recommended Posts

Posted

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.

686150193_SecurityWarning.png.ab05e771da114c37518d574815705ff1.png

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. ;)

Posted

@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. ;)

Posted (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 by faustf
Posted

@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....

Posted

@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?? :huh2:

Posted
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?? :huh2:

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.

 

Posted
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] )

Posted

@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 🤔

Posted
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...

Posted
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. 

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...