Page 1 of 1

Chrome update, now winkill not working

Posted: 02 May 2017, 23:30
by 4birds
I had a loop script that killed a pop-up window on chrome every time it popped up.

Code: Select all


loop, {

WinWait, www.website.com says: ahk_class Chrome_WidgetWin_1
sleep,100
winkill, www.website.com says: ahk_class Chrome_WidgetWin_1

}
!x::pause
exit app


Now after the update I can't figure out why the script won't work.
Any ideas why?

thanks

Re: Chrome update, now winkill not working

Posted: 03 May 2017, 10:24
by Almost_there
Have had similar issues with one program, cannot remember its title.

I sollved mine by activate program window and closed the program by mouse click at exit-button at upper right corner. It's rude, but it works.

Re: Chrome update, now winkill not working

Posted: 03 May 2017, 17:33
by 4birds
Yes that's a too crude for now. there has got to be another way. Does anyone know of a Chrome Spy that can find more info on this pop-up?

Re: Chrome update, now winkill not working

Posted: 04 May 2017, 18:23
by 4birds
bump

Re: Chrome update, now winkill not working

Posted: 04 May 2017, 18:49
by Xtra
Have you tried running your script as admin?

Re: Chrome update, now winkill not working

Posted: 04 May 2017, 23:07
by 4birds
Tried that. Didn't work

Re: Chrome update, now winkill not working

Posted: 04 May 2017, 23:49
by 4birds
Just ran across this article,

http://www.pcworld.com/article/3194417/ ... le-it.html

Google started automatically updating Chrome on 5-4-2017 to automatically switch from a 32 bit to a 64 bit.
Why would this affect my script? Any ideas on a work around?

Re: Chrome update, now winkill not working

Posted: 05 May 2017, 00:25
by 4birds
well that is indeed the problem, I installed the 32 bit dev version and the script worked for it. Wonder what it will take to get the script under the Chrome 64 bit version?

Re: Chrome update, now winkill not working

Posted: 08 May 2017, 16:19
by 4birds
bump

Re: Chrome update, now winkill not working

Posted: 08 May 2017, 16:33
by jeeswg
I sollved mine by activate program window and closed the program by mouse click at exit-button at upper right corner. It's rude, but it works.
Does anyone know of a Chrome Spy that can find more info on this pop-up?
AccViewer could help find out more info on the window, including the info needed for a script to click the Close button, which can be written using the Acc library functions.

Does WinClose work? Has the window title/window class changed?

Re: Chrome update, now winkill not working

Posted: 08 May 2017, 18:15
by 4birds
WinClose does not work. Using the ACCviewer, I haven't been able to find a separate window title, so the script just ends up closing the chrome browser as the Window Title and text appear to be the same. Here's what I got on the ACCviewer

Image

https://ibb.co/nh7rt5

https://ibb.co/nh7rt5

Re: Chrome update, now winkill not working

Posted: 08 May 2017, 18:57
by jeeswg
The AccViewer window shows the 'site.com says:' text in the 'Name' field, suggesting you should be able to retrieve the text from the window using Acc or possibly other means, to confirm it's the right window.

So something like this might work:

Code: Select all

q::
WinGet, hWnd, ID, A
oAcc := Acc_ObjectFromWindow(hWnd)
MsgBox, % oAcc.accName(0)
oAcc := ""

WinGetText, vText, % "ahk_id " hWnd
MsgBox, % vText
return
If you can identify the window, then to finish you need to close the window. Perhaps by working out the 'path' to the Close button, e.g. see the numbers at the bottom of the AccViewer window, and using the path with:
oAcc := Acc_Get("Object", vAccPath, 0, "ahk_id " hWnd)
or:
oAcc := Acc_Get("Object", vAccPath, 0, "ahk_id " hCtl)
and doing oAcc.accDoDefaultAction(0) on the button.

You can specify a 'path' for Acc_Get, relative either to the main window's hWnd, or to a control's hWnd.

[EDIT:] Btw the question states that WinKill isn't working, does nothing happen, does it close the wrong window? What method did you use to identify the window to close in the past, what happens this time?

[EDIT:] Is the issue that the website url has changed? From 'www.' to 'www15.'?

Re: Chrome update, now winkill not working

Posted: 08 May 2017, 20:50
by iseahound
Just use

Code: Select all

PostMessage, 0x112, 0xF060,,, ahk_id %active_id%  ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE

Re: Chrome update, now winkill not working

Posted: 08 May 2017, 21:22
by 4birds
Jeeswg,
[EDIT:] Btw the question states that WinKill isn't working, does nothing happen, does it close the wrong window? What method did you use to identify the window to close in the past, what happens this time?

my original post at the top was the script I used to kill a pop-up from this internal company website while using a Chrome Browser. After Chrome automatically updated, the script no longer worked and the pop up does not close unless I manually click it off. Now, after the update, the main browser page and the pop-up have the same title so when I start the ahk script to kill the window it kills the whole browser.
[EDIT:] Is the issue that the website url has changed? From 'www.' to 'www15.'?

no, the www15. is still the same,

Using the AccViewer, the path to the "close" button on the pop-up is 4.2.1.1.3 . Using this path now, what would my kill script be for this pop-up?

Re: Chrome update, now winkill not working  Topic is solved

Posted: 09 May 2017, 03:14
by jeeswg
So I would double-check that the popup and the main window do have the same window title and class, and if they do, you would need to loop through windows with that particular window title and class, and find a way to identify the hWnd of the popup.

[Some code that might help you distinguish between the main window and the popup:][Otherwise you could use Acc or maybe WinGetText to check for a certain text string.]
Maximize only main window, not its scalable submenus. - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=19251

I would imagine that WinKill applied to the popup's hWnd would still work to close it, but I will post some details here re. using Acc to invoke the Close button.

This code invokes Notepad's Close button (although normally I would use WinClose):

Code: Select all

q:: ;close Notepad via Acc
WinGet, hWnd, ID, ahk_class Notepad
oAcc := Acc_ObjectFromWindow(hWnd)
;AccViewer says 'Child ID: 5' and 'Path: 2' so:
oAcc := Acc_Get("Object", "2", 0, "ahk_id " hWnd)
oAcc.accDoDefaultAction(5)
oAcc := ""
return
So perhaps in your case you would change the Acc_Get line to:
oAcc := Acc_Get("Object", "4.2.1.1.3", 0, "ahk_id " hWnd)
and change the accDoDefaultAction line to:
oAcc.accDoDefaultAction(0)
or put a different number instead of 0, if AccViewer mentioned a Child ID number.

Re: Chrome update, now winkill not working

Posted: 09 May 2017, 08:28
by 4birds
This line of the example of closing the Notedpad

Code: Select all

oAcc := Acc_ObjectFromWindow(hWnd)
I get a "call to a non-existent function" error when I try this out.
any suggestions?

Re: Chrome update, now winkill not working

Posted: 09 May 2017, 08:57
by jeeswg
You need to #Include Acc.ahk or put it in a Lib folder:

Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201

Re: Chrome update, now winkill not working

Posted: 09 May 2017, 11:09
by 4birds
yes! that closed it. Now how would I set that this as a running loop to close it each time?

Re: Chrome update, now winkill not working

Posted: 09 May 2017, 11:12
by 4birds
nevermind, got it. thanks for all of your help jeeswg.

Code: Select all

loop, {

WinGet, hWnd, ID, ahk_class Chrome_WidgetWin_1
oAcc := Acc_ObjectFromWindow(hWnd)
;AccViewer says 'Child ID: 5' and 'Path: 2' so:
oAcc := Acc_Get("Object", "4.2.1.1.3", 0, "ahk_id " hWnd)
oAcc.accDoDefaultAction(0)
oAcc := ""
;return
}
x::pause
exit app