Jump to content
Sign in to follow this  
Klexen

Use more then one word for WinExists and Winclose

Recommended Posts

Klexen

If winexists("","Chat") then Winclose("","Chat")

I want to be able to use more than one keyword. Such as Winexists("","Chat","chat","MySpace") then Winclose("","Chat,"chat""MySpace")

Any ideas?

Edited by Klexen

Share this post


Link to post
Share on other sites
Valuater

Maybe...

If WinExists("","Chat") And WinExists("","MySpace") Then...

???

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
ResNullius

Check the help file for the Winlist() function.

You can then iterate through the results of the array, testing each window for the text you are looking for.

Share this post


Link to post
Share on other sites
Klexen

This is what I got, how do I get it to close if either is open?

If I have it like this the program crashes.

AdlibEnable("killchat")
$killchat = "Chat"
$killmyspace = "MySpace"
while 1
    sleep(1000)
    WEnd
Func killchat()
    if WinExists("",$killchat) And WinExists("",$killmyspace) then winclose("",$killchat) and winclose("",$killmyspace)
sleep(1000)

EndFunc
Edited by Klexen

Share this post


Link to post
Share on other sites
Klexen

Not tested

AdlibEnable("killchat")
$killchat = "Chat"
$killmyspace = "MySpace"
While 1
    Sleep(1000)
WEnd
Func killchat()
    If WinExists("", $killchat) Then WinClose("", $killchat)
    If WinExists("", $killmyspace) Then WinClose("", $killmyspace)
    Sleep(1000)
EndFunc   ;==>killchat

8)

I could have sworn I tried that before. I think when I did that Igoogled the word "chat" and since it wasnt Chat it didn't work, so I thought I did something wrong. Thanks a lot Valuater.

I noticed it doesn't read the words chat in a webpage such as this form. Is it possible to do that with the WinExists or similar command?

CODE

AdlibEnable("killchat")

$killchat = "Chat"

$killmyspace = "MySpace"

$killchat2 = "chat"

While 1

Sleep(1000)

WEnd

Func killchat()

If WinExists("", $killchat) Then WinClose("", $killchat)

If WinExists("", $killchat2) Then WinClose("", $killchat2)

If WinExists("", $killmyspace) Then WinClose("", $killmyspace)

Sleep(1000)

EndFunc ;==>killchat

Share this post


Link to post
Share on other sites
Generator

In help File

WinTitleMatchMode Alters the method that is used to match window titles during search operations.

1 = Match the title from the start (default)

2 = Match any substring in the title

3 = Exact title match

4 = Advanced mode, see Window Titles & Text (Advanced)

-1 to -4 = force lower case match according to other type of match.

In autoit it would be

Opt("WinTitleMatchMode",2)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×