Cybazaar Posted August 3, 2018 Posted August 3, 2018 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
FrancescoDiMuro Posted August 3, 2018 Posted August 3, 2018 (edited) 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 August 3, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
FrancescoDiMuro Posted August 3, 2018 Posted August 3, 2018 (edited) Happy to have helped Edited August 3, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
junkew Posted August 4, 2018 Posted August 4, 2018 Alternative is to use regexptitle See example 2 https://www.autoitscript.com/autoit3/docs/functions/WinList.htm FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now