Chrome update, now winkill not working Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Chrome update, now winkill not working

02 May 2017, 23:30

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
User avatar
Almost_there
Posts: 404
Joined: 30 Sep 2014, 10:32

Re: Chrome update, now winkill not working

03 May 2017, 10:24

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.
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

03 May 2017, 17:33

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?
User avatar
Xtra
Posts: 1302
Joined: 02 Oct 2015, 12:15

Re: Chrome update, now winkill not working

04 May 2017, 18:49

Have you tried running your script as admin?
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

04 May 2017, 23:07

Tried that. Didn't work
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

04 May 2017, 23:49

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?
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

05 May 2017, 00:25

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?
User avatar
jeeswg
Posts: 5942
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Chrome update, now winkill not working

08 May 2017, 16:33

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?
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

08 May 2017, 18:15

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
User avatar
jeeswg
Posts: 5942
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Chrome update, now winkill not working

08 May 2017, 18:57

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.'?
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
iseahound
Posts: 379
Joined: 13 Aug 2016, 21:04
GitHub: iseahound

Re: Chrome update, now winkill not working

08 May 2017, 20:50

Just use

Code: Select all

PostMessage, 0x112, 0xF060,,, ahk_id %active_id%  ; 0x112 = WM_SYSCOMMAND, 0xF060 = SC_CLOSE
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

08 May 2017, 21:22

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?
User avatar
jeeswg
Posts: 5942
Joined: 19 Dec 2016, 01:58
Location: UK

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

09 May 2017, 03:14

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.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

09 May 2017, 08:28

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?
User avatar
jeeswg
Posts: 5942
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Chrome update, now winkill not working

09 May 2017, 08:57

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
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

09 May 2017, 11:09

yes! that closed it. Now how would I set that this as a running loop to close it each time?
4birds
Posts: 18
Joined: 08 Jan 2016, 15:19

Re: Chrome update, now winkill not working

09 May 2017, 11:12

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

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], electrone77, Google [Bot], MannyKSoSo, scriptor2016, sinkfaze, SOTE and 186 guests