Jump to content
Sign in to follow this  
Cybazaar

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

Share this post


Link to post
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

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

Happy to have helped :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...