Page 1 of 1

About WinExist

Posted: 01 Dec 2019, 06:47
by Marcosa1020
Hello,

How can I replace code A with code B ? Thank you.

Code A:

Code: Select all

if WinExist("Paper level_[10.24.2019]")
Code B:

Code: Select all

if WinExist("Paper level_*")


Because there are many duplicate names.
Paper level_[09.24.2019]
Paper level_[10.24.2019]
Paper level_[11.07.2019]
Paper level_[11.13.2019]
Paper level_[11.25.2019]

This code is work:

Code: Select all

if WinExist("Paper level_[10.24.2019]")
{
WinActivate
WinWaitActive
Sleep, 100
Send, ^a
Sleep, 100
Clipboard := ""
Send, ^c
ClipWait
FileAppend, %Clipboard%, G:\Download\Backup.txt

Re: About WinExist  Topic is solved

Posted: 01 Dec 2019, 06:53
by pneumatic
Just do If WinExist("Paper level_")

Because SetTitleMatchMode is 1 by default

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: About WinExist

Posted: 01 Dec 2019, 08:02
by swagfag

Code: Select all

SetTitleMatchMode RegEx
if WinExist("^Paper level_\[\d\d\.\d\d\.\d\d\d\d\]$")

Re: About WinExist

Posted: 01 Dec 2019, 08:03
by Marcosa1020
pneumatic wrote:
01 Dec 2019, 06:53
Just do If WinExist("Paper level_")

Because SetTitleMatchMode is 1 by default

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.
Thanks for your reply.

Re: About WinExist

Posted: 01 Dec 2019, 08:05
by Marcosa1020
swagfag wrote:
01 Dec 2019, 08:02

Code: Select all

SetTitleMatchMode RegEx
if WinExist("^Paper level_\[\d\d\.\d\d\.\d\d\d\d\]$")
Thanks for your reply.