how to check #IfWinActive, if window name starts with space?

Get help with using AutoHotkey and its commands and hotkeys
wytas3
Posts: 1
Joined: 12 Feb 2018, 01:56

how to check #IfWinActive, if window name starts with space?

12 Feb 2018, 02:11

how to check #IfWinActive, if window name starts with space? i have really backward CAD program and i need some way for AHK to detect window " Text line tfont1.vft". So i basically need: {space} or {wildcard}Text line{wildcard}
User avatar
noname
Posts: 509
Joined: 19 Nov 2013, 09:15

Re: how to check #IfWinActive, if window name starts with space?

12 Feb 2018, 02:47

You can use regex in settitlematchmode

example:

Code: Select all

SetTitleMatchMode, regex

title:="  two_space_in_title"
gui ,+alwaysontop
gui ,show, w200 h200 ,%title%
return

#ifwinactive ^\s\stwo_space  
numpad0::
msgbox ok
return

guiclose:
exitapp
soundcloud.com/user-32706894
lexikos
Posts: 6725
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: how to check #IfWinActive, if window name starts with space?

12 Feb 2018, 04:19

Alternatively, you can escape the first space or use #If.

Code: Select all

#IfWinActive ` Text line tfont1.vft
#If WinActive(" Text line tfont1.vft")
Guest

Re: how to check #IfWinActive, if window name starts with space?

12 Feb 2018, 08:13

Perhaps obvious, but have you looked at SetTitleMatchMode, 2 for a partial match so you omit the space? (or are there other windows that would then inadvertently match?)

Return to “Ask For Help”

Who is online

Users browsing this forum: Babazule, boiler, Google [Bot], HarryClash, JackMa, prakashG and 134 guests