winexist(string include variable)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
smbs
Posts: 98
Joined: 27 Feb 2014, 11:07

winexist(string include variable)

26 Nov 2021, 07:44

This works as desired

Code: Select all

 ifwinnotexist, win-name-%1%
however

Code: Select all

if !WinExist("win-name-" %1%)
does not give correct output

have tried

Code: Select all

if !WinExist("win-name-" .  %1%)
without success

Pls give me the correct syntax
Many thanx
User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: winexist(string include variable)

26 Nov 2021, 08:11

Code: Select all

if !WinExist("win-name-" 1)
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: winexist(string include variable)

26 Nov 2021, 08:13

Hallo,
I tried:

Code: Select all

q::Run, "new 8.ahk" 1
with

Code: Select all

; new 8.ahk
ifwinnotexist, win-name-%1%
	MsgBox,A not
Else
	MsgBox,A yes
if !WinExist("win-name-" %1%)
	MsgBox,B not
Else
	MsgBox,B yes
Both versions detect whether win-name-1.txt
exists or not
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: winexist(string include variable)

26 Nov 2021, 10:36

Code: Select all

if !WinExist("win-name-" .  A_Args[1])
?
smbs
Posts: 98
Joined: 27 Feb 2014, 11:07

Re: winexist(string include variable)

26 Nov 2021, 10:51

Code: Select all

; notworking.ahk
SetTitleMatchMode, 3
run,notepad.exe
sleep,3000
;WinActivate,Untitled - Notepad
;sleep,3000
winsettitle,Untitled - Notepad,,Untitled - Notepad-%1% 
ifwinnotexist, Untitled - Notepad-%1%
	MsgBox,A not
Else
	MsgBox,A yes
if !WinExist("Untitled - Notepad-" %1%)
	MsgBox,B not
Else
	MsgBox,B yes
run, notworking.ahk test
the output of file above is not consistent
I get A yes B not
Pls note that I use SetTitleMatchMode, 3 which I require in my actual script
Thanx
smbs
Posts: 98
Joined: 27 Feb 2014, 11:07

Re: winexist(string include variable)

26 Nov 2021, 10:56

@just me
My apologies :D
Had title error---your solution works great!!!
Thanx
:dance: :dance:
smbs
Posts: 98
Joined: 27 Feb 2014, 11:07

Re: winexist(string include variable)

27 Nov 2021, 03:32

@just me
Once again many thanx
:D :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Holarctic, jameswrightesq, Lem2001 and 407 guests