Jump to content

Logical operators for activating windows


Recommended Posts

So i have a working code but now i want to implement to check which windows are active and do some operations based on the outcome.

For example:
Check if Window A exists or Window B, or Window C...

Then Activate Window A, or Window B or Window C...

I have tried putting my "Or" logical operator inside the brackets where i type the name and class of the windows but nothing happened

 

If WinExists ("[TITLE:D1.txt - Notepad]" or "[TITLE:D2.txt - Notepad]") Then
  If _IsPressed("6B") Then
         WinActivate ("[TITLE:D1.txt - Notepad]" or "[TITLE:D2.txt - Notepad]")

I removed the rest of the code, i need to figure this out first! Thanks in advance

Link to comment
Share on other sites

Hi @Cybazaar:)
You can't use the Or operator in an instruction like that.
If you want to perform both operation in the case the "Add" key is pressed, you need to do this:

If WinExists("[TITLE:D1.txt - Notepad]") Or WinExists("[TITLE:D2.txt - Notepad]") Then
  If _IsPressed("6B") Then
         WinActivate ("[TITLE:D1.txt - Notepad]")
         WinActivate ("[TITLE:D2.txt - Notepad]")

That's the way you have to do this :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...