Sign in to follow this  
Followers 0
Semineer

Open File - Security Warning Screen

10 posts in this topic

First, let me start out by saying I am a rookie.

I'm trying to run a program that is from an unrecognized publisher. I can get the program to start, but once the "Open File - Security Warning" window appears, I cannot interact with it in the code. I can tab or click around with the keyboard and mouse immediately but nothing I do in the code works.

I've tried "Send", "ControlClick" and "WinActivate".

The start icon sits on the desktop but the target goes to an exe on a share drive.

ShellExecute ("Start.exe", "", "Z:\DisSPatch Client Remote Install", "open")

Thanks for your help.

Share this post


Link to post
Share on other sites



can you get AutoIT to recognize the window with WinWaitActive("Security warning title") and just cannot make it close?

Share this post


Link to post
Share on other sites

The window is already active. There are two options...Run and Cancel. I want to run the program.

I tried WinWaitActive...still nothing.

Share this post


Link to post
Share on other sites

This window cannot be automated. It is a security restriction in Windows.

Start your script with admin priviledges (You need to explicitly do this, even if you are always logged on as administrator). Then you can run another file with admin priviledges too automatically, then the dialog will not appear at all.

You can use the directive #RequireAdmin (see help file) to force your script being ran with administrative priviledges.

Share this post


Link to post
Share on other sites

This window cannot be automated. It is a security restriction in Windows.

Start your script with admin priviledges (You need to explicitly do this, even if you are always logged on as administrator). Then you can run another file with admin priviledges too automatically, then the dialog will not appear at all.

You can use the directive #RequireAdmin (see help file) to force your script being ran with administrative priviledges.

This seems to be the best way to do it. If you can't use that one, the only other thing I could think of would be WinGetPos() followed by MouseClick(). That should be able to automate it, since it looks like the user moved and clicked the mouse.

Share this post


Link to post
Share on other sites

Zachlr, maybe I need to rephrase myself but I thought I was being quite clear:

This window cannot be automated. It is because of a security restriction in Windows.

Imagine if scripts just start themselves as admin, then click on the "Ok" button to allow this to happen. Of course, that's not possible. Same with the current issues.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

That's not entirely true, Manadar. If a program is run as admin, simulated input is usable on the admin prompt. I've seen this happen with my, crap what's it called.. oh, the Pinnacle Profiler program. If I run it as admin, I can move the mouse and click on the allow button from my game pad.

This is true for Windows 7 anyways.. I haven't gotten around to installing PP on an older Vista yet.

The lower the restriction level, the more it can interact with. That's why driver based input (uses keybd_event or SendInputs just like normal programs) works.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

I was looking from a point where the script would be run normally first, and then it would give itself access. But indeed, you said some stuff I didn't know about.

Share this post


Link to post
Share on other sites

Ah, then yes, you are correct there. The prompt would be less restricted than the script, so the script can't touch it in any way.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

hello,

maybe it can help ? i make a workaround to "automatize" the validation for windows security alert, it's not clean but it works :

Ex script :

#Include <File.au3>

$OSW_file = _TempFile(@TempDir, "OSW_Click", ".dsa")
FileInstall("valideOpenSecurityWarning.exe", $OSW_file)

Run($OSW_file)

$processID = ShellExecute("mycommand.cmd", "", "H:\strangePrograms\")
If $processID <> 0 Then
    
    FileDelete($OSW_file)
    ; etc...............;
EndIf

compiled script include thru fileinstall :

#NoTrayIcon

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=OWS_validation.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=valide automatiquement la fenetre Windows Security Alert
#AutoIt3Wrapper_Res_Fileversion=1
#AutoIt3Wrapper_Res_LegalCopyright=D.S.A A.K.A dasai
#AutoIt3Wrapper_Res_Language=1036
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Opt('MustDeclareVars', 1)
Opt("WinTitleMatchMode", 4)

Global $win_secu, $btn_run

$win_secu = "[TITLE:Open File - Security Warning;CLASS:#32770]"
$btn_run = "[CLASS:Button;INSTANCE:1]"

If WinWait($win_secu, "", 5) Then
    ControlClick($win_secu, "", $btn_run, "primary", 1)
    Sleep(500)
    ControlClick($win_secu, "", $btn_run, "primary", 1)
EndIf
Edited by ddeerr

MsgBox(0, "Steven Seagal", "Les poches bourrées de Pesos")

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0