Page 1 of 1

IfWinExist with Special characters

Posted: 08 Jan 2019, 22:10
by medellinrob
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

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 10:02
by safetycar
I can't confirm, both work for me. Opening the url on chrome and executing the script it goes to yes.

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 10:21
by medellinrob
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)

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 10:23
by safetycar
Win 10 x64, Ahk 1.1.30.01 x64

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 10:33
by AHKStudent
is it the active tab? IfWinExist will not work to detect a non active chrome tab

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 10:33
by safetycar
Could you check that your script is being saved as UTF-8 with BOM?

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 11:06
by medellinrob
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.

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 11:16
by medellinrob
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

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 11:34
by hymal7
Try

Code: Select all

IfWinExist, !zur the enchanter
You dont need the complete title

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 12:00
by safetycar
@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.

Re: IfWinExist with Special characters

Posted: 09 Jan 2019, 15:07
by medellinrob
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!