TheFixer Posted April 28, 2016 Share Posted April 28, 2016 Basically i am trying to make a script that detects if the currently active window is 1920 x 1080 or bigger. If it detects a window that is active, that is indeed that size. It will do some stuff. The problem i am having is that it is detecting my desktop whenever i click on my desktop, so it's doing stuff when i don't want it to. So all i need to know, is how can i do a simple check to see if a window = a title. Here is what i have so far $wintitledesktop = WinGetTitle("[ACTIVE]") If not $wintitledesktop = "Program Manager" Then ;does stuff endif Program Manager is what my desktop is called btw. The problem with that code is that the script is still detecting the desktop and doing the code. In case you need the whole section of the code, here it is. $winsizecheck1 = WinGetClientSize("[ACTIVE]") $wintitledesktop = WinGetTitle("[ACTIVE]") If WinActive("[ACTIVE]") Then sleep(100) If $winsizecheck1[0] >= 1920 Then If $winsizecheck1[1] >= 1080 Then If not $wintitledesktop = "Program Manager" Then $gamesfolderstate = WinGetState($gamesfolder) If WinExists($gamesfolder) Then If Not BitAND($gamesfolderstate, 16) Then WinSetState($gamesfolder,"",@SW_MINIMIZE) EndIf EndIf EndIf EndIf EndIf EndIf Link to comment Share on other sites More sharing options...
Developers Jos Posted April 28, 2016 Developers Share Posted April 28, 2016 (edited) Your test need to be: If not ($wintitledesktop = "Program Manager") Then Jos Edited April 28, 2016 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
TheFixer Posted April 28, 2016 Author Share Posted April 28, 2016 1 minute ago, Jos said: Your test need to be: If not ($wintitledesktop = "Program Manager") Then Jos Just did a quick test with the updated code, it still is running the code when i click on my desktop. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 28, 2016 Developers Share Posted April 28, 2016 (edited) Then add some debug statement in there showing the exact content of the variable! Jos ps: the "game"word is quite often present in your script, so make sure you read up on our forum rules. Edited April 28, 2016 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
TheFixer Posted April 28, 2016 Author Share Posted April 28, 2016 (edited) 19 minutes ago, Jos said: ps: the "game"word is quite often present in your script, so make sure you read up on our forum rules. I assure you i'm not making any hack or exploit or a script that interacts with the game etc. What the script does is checks if a window is 1920 x 1080 (probably a game) then minimizes my games folder. Because usually it's open when i run a game from the folder. I made this because... OCD, a slight case of it anyway. Edited April 28, 2016 by TheFixer Link to comment Share on other sites More sharing options...
TheFixer Posted April 28, 2016 Author Share Posted April 28, 2016 (edited) 12 minutes ago, Jos said: Then add some debug statement in there showing the exact content of the variable! Jos ps: the "game"word is quite often present in your script, so make sure you read up on our forum rules. When i use this code $winsizecheck1 = WinGetClientSize("[ACTIVE]") $wintitledesktop = WinGetTitle("[ACTIVE]") If WinActive("[ACTIVE]") Then sleep(100) If $winsizecheck1[0] >= 1920 Then If $winsizecheck1[1] >= 1080 Then If not ($wintitledesktop = "Program Manager") Then MsgBox(0,"",$wintitledesktop) $gamesfolderstate = WinGetState($gamesfolder) If WinExists($gamesfolder) Then If Not BitAND($gamesfolderstate, 16) Then WinSetState($gamesfolder,"",@SW_MINIMIZE) EndIf EndIf EndIf EndIf EndIf EndIf The msgbox returns blank... white space. Nothing. Do you know why? p.s here are the global variables you are possibly wondering about. Global $progman = "Program Manager" Global $gamesfolder = "Games on this comp" Edited April 28, 2016 by TheFixer Link to comment Share on other sites More sharing options...
TheFixer Posted April 28, 2016 Author Share Posted April 28, 2016 (edited) Not sure how to delete this reply. Edited April 28, 2016 by TheFixer Link to comment Share on other sites More sharing options...
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