autolyl Posted November 29, 2017 Share Posted November 29, 2017 After upgrading to Windows 10, I found that even if I run the compiled autoit exe as administrator (sometimes required in win10), I cannot send anything to the Windows Security Dialog box at all. No response to controlclick(), controlsend() , send() to active windows. But ControlGetText () can retrieve the button text. The relevant lines of the code i used are extracted here : Local Const $winDrvWinTitle="Windows Security" Local Const $windrvVisibleText="You should only install driver software from publishers you trust" WinActivate($winDrvWinTitle, $windrvVisibleText) WinWaitActive($winDrvWinTitle, $windrvVisibleText) ControlFocus( $winDrvWinTitle, $windrvVisibleText, "[CLASS:Button; INSTANCE:1]") ControlSend ( $winDrvWinTitle, $windrvVisibleText, "[CLASS:Button; INSTANCE:1]", "+{TAB}" ) ControlSend ( $winDrvWinTitle, $windrvVisibleText, "[CLASS:Button; INSTANCE:1]", "!a" ) ControlClick( $winDrvWinTitle, $windrvVisibleText, "[CLASS:Button; INSTANCE:1]", "left" ) send("!a") (button instance 1 is the "install" button, button instance2 is the 'Don't Install') Any idea? The Windows Security dialog is displayed by the system thru calling a function in pnpui.dll using rundll32.exe. The command line extracted by process explorer is this: rundll32.exe C:\Windows\system32\pnpui.dll,InstallSecurityPromptRunDllW 20 Global\{0fd3782d-7da3-ad49-87ba-33dfce9a61e3} Global\{a6994297-ff95-ba46-96b3-c95416403e52} C:\Windows\System32\DriverStore\Temp\{36a70f88-fff2-6b42-ab2f-3800e730fffa}\VBoxUSB.inf C:\Windows\System32\DriverStore\Temp\{36a70f88-fff2-6b42-ab2f-3800e730fffa}\VBoxUSB.cat I was installing virtual box but that should be irrelevant. Link to comment Share on other sites More sharing options...
Earthshine Posted November 29, 2017 Share Posted November 29, 2017 (edited) if it's a XAML based form, you will need special tools. Search for IUIAutomation in this forum. Anyway, can you use the AutoIt Info Tool and focus it on the button you want to click and post the information the tool finds? Post a screenshot of that tool on the Control tab please. Screeshot a capture of that form too, the Windows Security form Edited November 29, 2017 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
junkew Posted November 29, 2017 Share Posted November 29, 2017 Can you make a generic script to reproduce issue so i can test on my w10 system? Earthshine 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
autolyl Posted November 30, 2017 Author Share Posted November 30, 2017 More information. The Dialog Box was the one displayed by Windows 10 for confirmation when someone installs a device driver. So to test it, one need to install a device driver. But, once a driver is installed, windows may not prompt the dialog box again. So, it is best to test it in a windows 10 running under a virtual machine where we can restore the image back to before the driver was installed. The information returned by Autoit Info Tool are included below. Note the check box next to the "always trust ...." is something created by the DirectUIHWND control. It is not a standard checkbox. The 2 buttons are ordinary button control (Class:Button). Here my test script that shows that the ControlGetText() works while ControlClick()/ ControlFocus()/send() doesn't. The script was compiled in a exe and run as administrator. expandcollapse popupAutoItSetOption("WinTitleMatchMode",2) ;substring AutoItSetOption ("TrayIconHide",0) ; show icon AutoItSetOption("MustDeclareVars",1) ; must declare Local Const $winDrvWinTitle="Windows Security" Local Const $windrvVisibleText="You should only install driver software from publishers you trust" Local Const $InstallButton = "[CLASS:Button; INSTANCE:1]" Local Const $DontInstallButton = "[CLASS:Button; INSTANCE:2]" Local Const $AlwaysTrustCheckBox="[CLASS:DirectUIHWND; INSTANCE:1]" Local Const $NamePublisherText="[CLASS:DirectUIHWND; INSTANCE:2]" Local Const $WarningText="[CLASS:SysLink; INSTANCE:3]" Local $Hwnd=WinActivate($winDrvWinTitle, $windrvVisibleText) Local $text WinWaitActive($Hwnd,"") ;=== test 1 get the text string of buttons, this should work $text=ControlGetText ($Hwnd, "", $InstallButton) MsgBox(0,"", $text) $text=ControlGetText ($Hwnd, "", $DontInstallButton) MsgBox(0,"", $text) $text=ControlGetText ($Hwnd, "", $WarningText) MsgBox(0,"", $text) ;=== test 2 set focus, this doesnt work ControlFocus( $Hwnd,"", $InstallButton) Sleep(100) ;=== test 3 click some controls, this doesnt work ControlClick( $Hwnd, "", $AlwaysTrustCheckBox, "left" ) Sleep(200) ControlClick( $Hwnd, "", $DontInstallButton, "left" ) ;=== test 4 press tab/ alt A in the active window, doesn't work send("{TAB}") Sleep(200) send("{TAB}") Sleep(200) send("{TAB}") Sleep(200) send("!a") Link to comment Share on other sites More sharing options...
Earthshine Posted November 30, 2017 Share Posted November 30, 2017 Thanks. I’ll look at it in a bit My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Danyfirex Posted November 30, 2017 Share Posted November 30, 2017 Hello This works for me in Windows 10x64 #RequireAdmin WinActivate("Windows Security") ControlClick("Windows Security","","Button1") Saludos Earthshine 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
autolyl Posted December 1, 2017 Author Share Posted December 1, 2017 (edited) 20 hours ago, Danyfirex said: Hello This works for me in Windows 10x64 #RequireAdmin WinActivate("Windows Security") ControlClick("Windows Security","","Button1") Saludos nope......doesn't work for my Windows 10 Enterprise x64. Just the same thing, it responds to the 2nd line and activates the dialog box. but no response to ControlClick. What else could affect the result in different win 10 systems? I am using AutoIt v3.3.14.2 Edited December 1, 2017 by autolyl more info Link to comment Share on other sites More sharing options...
autolyl Posted December 4, 2017 Author Share Posted December 4, 2017 Is it possible that some settings in windows 10 could affect the result? Link to comment Share on other sites More sharing options...
Bowmore Posted December 4, 2017 Share Posted December 4, 2017 It is not possible to automate any of Windows 10 security dialog boxes. If you think about it you will see that it would be a very bad idea to allow a script to bypass any security warnings. "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
autolyl Posted December 5, 2017 Author Share Posted December 5, 2017 (edited) 10 hours ago, Bowmore said: It is not possible to automate any of Windows 10 security dialog boxes. If you think about it you will see that it would be a very bad idea to allow a script to bypass any security warnings. But one member indicated he/she did able to automate the dialog box. Could it be related to security settings in Windows 10? Also any ideas what mechanisms were used by win10 to prevent automation in security related dialog boxes? Afterall, it is about sending custom messages to the target windows Edited December 5, 2017 by autolyl Link to comment Share on other sites More sharing options...
Earthshine Posted December 5, 2017 Share Posted December 5, 2017 Like he said it would be an extremely bad idea if they let that happen My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
SlackerAl Posted December 5, 2017 Share Posted December 5, 2017 I guess, worse case, if it is just one button you could look into image search, position and move the mouse to it and click? Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
Earthshine Posted December 5, 2017 Share Posted December 5, 2017 (edited) how about installing virtual box silently? https://www.virtualbox.org/manual/ch02.html#idm743 VirtualBox-<version>-<revision>-Win.exe -extract msiexec /i VirtualBox-<version>-<revision>-MultiArch_<x86|amd64>.msi /qn could use the RunAs command engineers get creative. lol I am not testing this one and poisoning my system with oracle anything. ugh. you reminded me. I have to install VMware Workstation 14 Edited December 5, 2017 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
junkew Posted December 7, 2017 Share Posted December 7, 2017 As far as I am aware you can allways move your mouse and click with either https://www.autoitscript.com/autoit3/docs/functions/MouseMove.htm https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_Keybd_Event.htm most likely you have to click position image based as controls in itself not recognizable Below you could also base on the size of your dialog mousemove_perc("50%","50%") func mousemove_perc($x,$y) if stringinstr($x,"%") Then $realX=stringreplace($x,"%","") * (@DesktopWidth / 100) $realy=stringreplace($y,"%","") * (@DesktopHeight / 100) mousemove($realX ,$realy) EndIf EndFunc Earthshine 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
autolyl Posted December 20, 2017 Author Share Posted December 20, 2017 (edited) On 12/7/2017 at 4:14 PM, junkew said: As far as I am aware you can allways move your mouse and click with either https://www.autoitscript.com/autoit3/docs/functions/MouseMove.htm https://www.autoitscript.com/autoit3/docs/functions/MouseClick.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_Keybd_Event.htm most likely you have to click position image based as controls in itself not recognizable Below you could also base on the size of your dialog mousemove_perc("50%","50%") func mousemove_perc($x,$y) if stringinstr($x,"%") Then $realX=stringreplace($x,"%","") * (@DesktopWidth / 100) $realy=stringreplace($y,"%","") * (@DesktopHeight / 100) mousemove($realX ,$realy) EndIf EndFunc Some quick test. When the Windows Security Dialog box is the active window, MouseMove() has no effect, even if you use absolute coordinates not related to the active Windows Security Dialog. You may test the following with and without the dialog being the active window: AutoItSetOption("MouseCoordMode",1) mouseMove(16,129,5) Edited December 20, 2017 by autolyl Link to comment Share on other sites More sharing options...
junkew Posted December 21, 2017 Share Posted December 21, 2017 As I do not know how to reproduce easily that popup I cannot help you fully but these are all commands I learned over the years from win32 api that can do things with mouse and keyboard postmessage sendmessage mouse_event keybd_event sendinput Alternatives never used The one I never used or further investigated (not worth the effort) to write a specific keyboard/mouse input driver https://docs.microsoft.com/en-us/windows-hardware/drivers/samples/input-driver-samples. Maybe start an RDP session to the windows machine (not sure if you can do that to your own machine) and then send the mouseclick based on position. As you can highlight the elements (try also with simplespy, see faq 31) I would be surprised if you cannot click, invoke the elements. There definitely should be a way as people with dissabilities allways have alternatives in windows however in a base install it could be that Microsoft has protected this.https://msdn.microsoft.com/en-us/library/windows/desktop/ee671610(v=vs.85).aspxTo use UIAccess, an assistive technology application needs to: Be signed with a certificate to interact with applications running at a higher privilege level. Be trusted by the system. The application must be installed in a secure location that requires a user account control (UAC) prompt for access. For example, the Program Files folder. Be built with a manifest file that includes the uiAccess flag. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
RajivKrishna Posted October 5, 2018 Share Posted October 5, 2018 The security popup has upgraded recently in Win10 X64 outlook 2016. Able to get the handle of Security popup window but not the elements inside it. I tried ControlSend and ControlClick but that too dint help. Please help me if you have a solution. 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