Complicated Wintitle not recognized Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kawaki
Posts: 25
Joined: 29 Jun 2021, 21:33

Complicated Wintitle not recognized

01 Dec 2021, 15:01

Hi,

I want to open a picture with a program called Honeyview, once the picture is opened, this is the window name in Window spy : "accessories 
> picture1.jpg [1/3] - Honeyview 5.40"
I don't know how to use that name for WinTitle. It doesn't work as it is (it says there are characters it doesn't recognize, whether i correct them or ignore, it doesn't work), putting the name between ''' doesn't work either.

I can't use ahk_class or _exe either since there can be other windows opened with the same program at the same time.

What do i do in this case?

Thank you.
RussF
Posts: 1264
Joined: 05 Aug 2021, 06:36

Re: Complicated Wintitle not recognized  Topic is solved

01 Dec 2021, 15:26

Haven't tried this, but according to the docs, if you put

Code: Select all

SetTitleMatchMode, 2
before your use of a Wintitle, it will match a string anywhere within the title, so you could just match against "Honeyview"

Russ
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: Complicated Wintitle not recognized

01 Dec 2021, 15:29

You don’t have to use the entire title. You can use the start of the title (or another part using the approach RussF mentioned) and you can combine it with the ahk_class and/or ahk_exe to distinguish it from similarly named windows from other programs.

When you said “it says there are characters it doesn’t recognize,” what do you mean? An error message says that? Can you show the exact message?

Which command or function are you trying to use that WinTitle with? Please show what you tried. It seems like at least the attempt where it showed an error message would have been when it was used unquoted in a function parameter, which would have had it try to evaluate it as a variable name or expression, leading to the error. Putting quotes around it in that case should at least eliminate the error message.
Last edited by boiler on 01 Dec 2021, 15:33, edited 1 time in total.
RussF
Posts: 1264
Joined: 05 Aug 2021, 06:36

Re: Complicated Wintitle not recognized

01 Dec 2021, 15:32

I suggested SetTitleMatchMode since it looked like the beginning of the title could change with each picture whereas the "Honeyview" would probably be in every instance.

Russ
mcl
Posts: 357
Joined: 04 May 2018, 16:35

Re: Complicated Wintitle not recognized

01 Dec 2021, 15:42

Kawaki wrote: I want to open a picture with a program called Honeyview, once the picture is opened, this is the window name in Window spy : "accessories 
> picture1.jpg [1/3] - Honeyview 5.40"
I don't know how to use that name for WinTitle. It doesn't work as it is (it says there are characters it doesn't recognize, whether i correct them or ignore, it doesn't work), putting the name between ''' doesn't work either.
I can't use ahk_class or _exe either since there can be other windows opened with the same program at the same time.
You can use ahk_-rules, see WinTitle::Multiple criteria

There is an invisible special character (U+2029, paragraph separator) before > in Honeyview's title.
You can try one of the following methods, each will work for Honeyview with open image:

Code: Select all

SetTitleMatchMode, 2  ; Match substring anywhere inside the title
#IfWinActive - Honeyview ahk_class HoneyviewClassX  ; Note that it looks for minus-space-Honeyview

SetTitleMatchMode, Regex  ; Match using regular exressions
#IfWinActive ^(.+) .> (.+) (\[\d+\/\d+\]) - Honeyview ahk_class HoneyviewClassX  ; Note dot before '>'. You still can use ahk_-rules with regex
github://oGDIp - GDI+ wrapper for AHK v1.1
Kawaki
Posts: 25
Joined: 29 Jun 2021, 21:33

Re: Complicated Wintitle not recognized

01 Dec 2021, 16:03

RussF wrote:
01 Dec 2021, 15:26
Haven't tried this, but according to the docs, if you put

Code: Select all

SetTitleMatchMode, 2
before your use of a Wintitle, it will match a string anywhere within the title, so you could just match against "Honeyview"

Russ
Seems to work. I just have to place it at the beginning of the code and it will work for any wintitle? Very convenient.
Kawaki
Posts: 25
Joined: 29 Jun 2021, 21:33

Re: Complicated Wintitle not recognized

01 Dec 2021, 16:16

mcl wrote: ...
boiler wrote: ...
Yeah, it's an error message. Apparently it comes from the language of my PC. I have PC in English but directories in French.
I tried to encode with UTF-8 with BOM which resolved the issue of that specific error message but i still have those kind of issues.

Like if i try to open a file from Download (téléchargement in French) i have this :

Image

Directory of file :
Image

But what i see in directory bar in Explorer windows :
Image
Image

I'll open a new thread if i can't fix this.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jameswrightesq, wpulford and 414 guests