Page 1 of 1

literal Window Title?

Posted: 08 Mar 2018, 14:13
by chef423
Window Title, Class and Process
#1
Cash Register Express
ahk_class WindowsForms10.Window.8.app.0.30495d1_r14_ad1
ahk_exe CRE2004.exe

VS

#2
Window Title, Class and Process
Cash Register Express -- Station: 01 -- Cashier: 100199 -- 3/8/2018 11:10 AM
ahk_class WindowsForms10.Window.8.app.0.30495d1_r14_ad1
ahk_exe CRE2004.exe

My code:

Code: Select all

; Login Button
+F12::
IfWinExist, Cash Register Express
{
WinActivate, Cash Register Expres
Send, 77{Enter}
Send, 77{ENTER}
}
Else
{
; do nothing
}
Return
BUT, this +F12 key is still working on the Cash Register Express -- Station: 01 -- Cashier: 100199 -- 3/8/2018 11:10 AM, window

How can I only make this code execute with #1, not #2 (or any other window)

Re: literal Window Title?

Posted: 08 Mar 2018, 14:16
by Odlanir

Code: Select all

SetTitleMatchMode, 3
From the docs
MatchMode

One of the following digits or the word RegEx:

1: A window's title must start with the specified WinTitle to be a match.
2: A window's title can contain WinTitle anywhere inside it to be a match.
3: A window's title must exactly match WinTitle to be a match.

Re: literal Window Title?

Posted: 08 Mar 2018, 14:27
by chef423
You rock! Thanks!