Using IfWinNotExist with Google Chrome

Ask gaming related questions (AHK v1.1 and older)
codude
Posts: 128
Joined: 12 Nov 2015, 05:33

Using IfWinNotExist with Google Chrome

14 Jan 2018, 14:01

The actual name of a Google Chrome window is “CNN - Breaking News, Latest News and Videos – Google Chrome”. This script works fine…

SetTitleMatchMode, 2
IfWinNotExist, - Google Chrome
Run, https://cnn.com/

The problem is if any named Google Chrome window is open it no longer functions correctly so I tried this but it’s not working...

SetTitleMatchMode, 2
IfWinNotExist, Videos - Google Chrome
Run, https://cnn.com/

I tried…
#IfWinNotExistForce, Videos - Google Chrome
with no success.
gregster
Posts: 9014
Joined: 30 Sep 2013, 06:48

Re: Using IfWinNotExist with Google Chrome

14 Jan 2018, 18:52

The problem is if any named Google Chrome window is open it no longer functions correctly
Of course, it does still function correctly. It does exactly what you programmed it to do.

Your second code seems to do what you want. It only opens CNN if there is no window with " Videos - Google Chrome" in its title. That it does.

More precisely, it works for me if I use the US edition explicitly, which you will probably get if you are in the US. I am not.

The international edition (default for me) has a different win title. Hence, it does not work for me there - which is understandable.
Are you in the US? Which wintitle has the actual window you get, if you use Run, https://cnn.com/? The international edition's start page is called "CNN - Breaking News, U.S., World, Weather, Entertainment & Video News - Google Chrome". Obviously, that wouldn't meet the condition stated in your code.

Btw, #IfWinNotExistForce, Videos - Google Chrome cannot work here, because it is only used for context-sensitive hotkeys. Without a hotkey placed beneath it, it will do nothing.
codude
Posts: 128
Joined: 12 Nov 2015, 05:33

Re: Using IfWinNotExist with Google Chrome

14 Jan 2018, 19:25

Thanks for the response here. Yes I am in the U.S. I’m only using CNN as an example here. It seems the true window name for any Google Chrome window ends with “ - Google Chrome” . To differentiate the different Google Chrome Windows I tried adding the last word just before the “- Google Chrome“, in this case, Videos - Google Chrome. With this CNN Google window opened or closed the script seems to pass over it is like it does not exist. I even tried it with IFWinExist and when the window is opened it still fails see it exist.
gregster
Posts: 9014
Joined: 30 Sep 2013, 06:48

Re: Using IfWinNotExist with Google Chrome

14 Jan 2018, 23:49

That's odd. Perhaps someone else from the US can check, since it seems to work for me. But I am not sure if I really end up on the same page like you.

What happens if you take the whole window title? Try to copy the exact title from 'window spy' tool (Right-click the system tray icon of your script to start it), if you haven't tried that before.

Edit: Perhaps an admin can move this topic to the main 'Ask for help' forum. Seems more appropiate and there is usually more traffic, I would assume.
codude
Posts: 128
Joined: 12 Nov 2015, 05:33

Re: Using IfWinNotExist with Google Chrome

16 Jan 2018, 09:40

Perhaps the problem is I’m using an older version of AHK. Recently when I updated to the latest version I had problems with some of my other scripts and being that I did not have time to correct this I just reverted back to the older version. I can’t use the whole window title because in my case each one is different but they do all have the same common word just before “ – Google Chrome”. I did use Window Spy. Could the issue possibly involve “window class”?

Gregster mentioned using the “Ask for Help” form to perhaps get more traffic. I have never been able to figure out how to post there. It seems “Gaming” is the only place I can create a new post. If I click the “Ask for help” link it brings me to the Gaming section. If I go to “New post” and see the different forms the post are coming from and if I click on one of the “Ask for help” links it again it brings me to the gaming forums. What am I doing wrong here? Thanks again for the help

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: RussF and 79 guests