About WinExist Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Marcosa1020
Posts: 160
Joined: 23 Sep 2015, 19:15

About WinExist

Post by Marcosa1020 » 01 Dec 2019, 06:47

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
Last edited by Marcosa1020 on 01 Dec 2019, 06:57, edited 1 time in total.

pneumatic
Posts: 299
Joined: 05 Dec 2016, 01:51

Re: About WinExist  Topic is solved

Post by pneumatic » 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.

swagfag
Posts: 4080
Joined: 11 Jan 2017, 17:59

Re: About WinExist

Post by swagfag » 01 Dec 2019, 08:02

Code: Select all

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

Marcosa1020
Posts: 160
Joined: 23 Sep 2015, 19:15

Re: About WinExist

Post by Marcosa1020 » 01 Dec 2019, 08:03

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.

Marcosa1020
Posts: 160
Joined: 23 Sep 2015, 19:15

Re: About WinExist

Post by Marcosa1020 » 01 Dec 2019, 08:05

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.

Post Reply

Return to “Ask For Help”