Close specific 'Windows Security' dialog window

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Rirre
Posts: 6
Joined: 29 Dec 2016, 04:28

Close specific 'Windows Security' dialog window

29 Dec 2016, 04:43

Hi,

I'm getting a frustrating windows security popup every ~15 min asking for my credentials 3 times in Outlook (Office 2010).
Couldn't find any solution by googling so I ended up installing AutoHotkey to find a solution to close it whenever it popup.

The script I have works exactly as I want it to, but it interact with all Windows Security windows I open (same WinText message).
I using Active Directory very often to run as different user so the script react to this window.

How can I close this specific Windows Security from Outlook?

Code: Select all

#NoEnv
#SingleInstance force

Loop
{
	If WinExist("Windows Security ahk_class #32770", "Remember my credentials")
	{
		ControlClick, Button2, Windows Security ahk_class #32770, Remember my credentials,, NA
	}
}
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: Close specific 'Windows Security' dialog window

29 Dec 2016, 05:57

Try using this

Code: Select all

#NoEnv
#SingleInstance force
HookProcAdr := RegisterCallback( "HookProc", "F" ), hWinEventHook := SetWinEventHook( 0x3, 0x3, 0, HookProcAdr, 0, 0, 0 )
HookProc( hWinEventHook, Event, hWnd, idObject, idChild, dwEventThread, dwmsEventTime ){
	If Event
	{
		WinGetClass, Class , A
		WinGetTitle, Title, A
		WinGetText, Text, A
		If (Class="#32770" && Title="Windows Security" && Text="Remember my credentials")
			WinClose, Windows Security ahk_class #32770, Remember my credentials
			;Or
			;PostMessage, 0x112, 0xF060,,,  Windows Security ahk_class #32770, Remember my credentials
	}
}
SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags){
	DllCall("CoInitialize", Uint, 0)
	Return DllCall("SetWinEventHook", Uint,eventMin, Uint,eventMax,Uint,hmodWinEventProc, Uint,lpfnWinEventProc, Uint,idProcess, Uint,idThread, Uint,dwFlags)
}
Rirre
Posts: 6
Joined: 29 Dec 2016, 04:28

Re: Close specific 'Windows Security' dialog window

29 Dec 2016, 06:03

kanat wrote:Try using this

Code: Select all

#NoEnv
#SingleInstance force
HookProcAdr := RegisterCallback( "HookProc", "F" ), hWinEventHook := SetWinEventHook( 0x3, 0x3, 0, HookProcAdr, 0, 0, 0 )
HookProc( hWinEventHook, Event, hWnd, idObject, idChild, dwEventThread, dwmsEventTime ){
	If Event
	{
		WinGetClass, Class , A
		WinGetTitle, Title, A
		WinGetText, Text, A
		If (Class="#32770" && Title="Windows Security" && Text="Remember my credentials")
			WinClose, Windows Security ahk_class #32770, Remember my credentials
			;Or
			;PostMessage, 0x112, 0xF060,,,  Windows Security ahk_class #32770, Remember my credentials
	}
}
SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags){
	DllCall("CoInitialize", Uint, 0)
	Return DllCall("SetWinEventHook", Uint,eventMin, Uint,eventMax,Uint,hmodWinEventProc, Uint,lpfnWinEventProc, Uint,idProcess, Uint,idThread, Uint,dwFlags)
}
Thanks, but it this script doesn't even run, not sure what's even going on here.
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: Close specific 'Windows Security' dialog window

29 Dec 2016, 06:22

Specify #Persistent in the script for permanently running.
Rirre
Posts: 6
Joined: 29 Dec 2016, 04:28

Re: Close specific 'Windows Security' dialog window

29 Dec 2016, 06:50

Alright, now I can see the AHK icon in taskbar. But the window persist.
Image
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: Close specific 'Windows Security' dialog window

29 Dec 2016, 07:12

Instead of WinClose try to close the window with WinKill or PostMessage (uncomment the line in the script).
kanat
Posts: 26
Joined: 22 Oct 2013, 01:35

Re: Close specific 'Windows Security' dialog window

30 Dec 2016, 04:52

I assume wintitle, wintext do not match exactly. Check them again.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 176 guests