IfWinExist with Special characters

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
medellinrob
Posts: 7
Joined: 08 Jan 2019, 21:53

IfWinExist with Special characters

08 Jan 2019, 22:10

Hi Guys.

If you open https://scryfall.com/search?q=%21zur+the+enchanter in Chrome,
You'll see that the title is "!zur the enchanter · Scryfall Magic Card Search - Google Chrome" (I also got it from F12 console and just adding the last part)
I'm afraid that the character · is messing up my code.

Code: Select all

	IfWinExist, !zur the enchanter · Scryfall Magic Card Search - Google Chrome
		
			{
				msgbox,	YES
			} Else
				{
					msgbox,	NO
				}
(It goes to the NO)

Do you guys know a workaround?
Btw, Several years ago I worked something similar including only the first part of the window name:

Code: Select all

	IfWinExist, !
		
			{
				msgbox,	YES
			} Else
				{
					msgbox,	NO
				}
It would get it reading only the first character and matching it, I swear I had it working like that a few years ago with another site, but now it's not working.

Any pointers?

Thanks
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: IfWinExist with Special characters

09 Jan 2019, 10:02

I can't confirm, both work for me. Opening the url on chrome and executing the script it goes to yes.
medellinrob
Posts: 7
Joined: 08 Jan 2019, 21:53

Re: IfWinExist with Special characters

09 Jan 2019, 10:21

safetycar wrote:
09 Jan 2019, 10:02
I can't confirm, both work for me. Opening the url on chrome and executing the script it goes to yes.
What AHK version are you on? and what OS?
(I would think Chrome version is irrelevant)
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: IfWinExist with Special characters

09 Jan 2019, 10:23

Win 10 x64, Ahk 1.1.30.01 x64
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: IfWinExist with Special characters

09 Jan 2019, 10:33

is it the active tab? IfWinExist will not work to detect a non active chrome tab
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: IfWinExist with Special characters

09 Jan 2019, 10:33

Could you check that your script is being saved as UTF-8 with BOM?
medellinrob
Posts: 7
Joined: 08 Jan 2019, 21:53

Re: IfWinExist with Special characters

09 Jan 2019, 11:06

Thanks SafetyCar.
Same Windows 10 x64. AHK es 1.1.28.01 so I may try updating it.

@Student:
The page it's the tab active in Chrome and Chrome is the active Window (although I know it works if Chrome is not the one active).

@SafetyCar's most recent post
I'll check that as well and report back.
medellinrob
Posts: 7
Joined: 08 Jan 2019, 21:53

Re: IfWinExist with Special characters

09 Jan 2019, 11:16

safetycar wrote:
09 Jan 2019, 10:33
Could you check that your script is being saved as UTF-8 with BOM?
I do not know how to check BOM, but it is UTF-8
Is BOM important? If you save it as non BOM then you cannot get to yes?
Sorry for the questions, it's not urgent, you can take your time :D
hymal7
Posts: 66
Joined: 14 Sep 2016, 05:37

Re: IfWinExist with Special characters

09 Jan 2019, 11:34

Try

Code: Select all

IfWinExist, !zur the enchanter
You dont need the complete title
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: IfWinExist with Special characters

09 Jan 2019, 12:00

@medellinrob Depends on the text editor that you're using, unless it's default notepad, you can't know it with that. On other editors like Notepad++ you can know by reading the status bar at the bottom right. And if you needed to change it then you'd go to Encoding > Encode in UTF-8-BOM. Other editors are different and you have to find the encoding menu wherever it might be.
medellinrob
Posts: 7
Joined: 08 Jan 2019, 21:53

Re: IfWinExist with Special characters

09 Jan 2019, 15:07

BOM WORKS!!! OMG THANKS Safetycar!!
And yes hymal7, now it works with only the beginning also.
I guess I had my notepad++ configured better in my old computer.
Thank you everyone!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], just me and 197 guests