qwert Posted December 5, 2015 Share Posted December 5, 2015 I need a way to determine if the desktop is "up" ... like after the user clicks Show Desktop.Autoit Window Info detects it correctly, but my script steps produce a blank result. (Other windows are correctly reported.)$sTitle = WinGetTitle("[active]") MsgBox (0, "", $sTitle, 0)Any suggestion will be appreciated. Link to comment Share on other sites More sharing options...
JohnOne Posted December 5, 2015 Share Posted December 5, 2015 (edited) Works fine when Program Manager is actually active.WinActivate("Program Manager") $sTitle = WinGetHandle("[ACTIVE]") ConsoleWrite(WinGetTitle($sTitle) & @LF)You'll probably find that the title-less window you got belongs to explorer.exePossible that this might get you started.#include <Process.au3> MsgBox(0,"Desktop visible",_DesktopOnTop()) Func _DesktopOnTop() $sTitle = WinGetTitle("(ACTIVE]") $sPName = _ProcessGetName(WinGetProcess(WinGetHandle("[ACTIVE]"))) If ($sTitle = "" And $sPName = "explorer.exe") Or ($sTitle = "Program Manager") Then Return True EndIf Return False EndFunc ;==>_DesktopOnTop Edited December 5, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jguinch Posted December 5, 2015 Share Posted December 5, 2015 (edited) If I understand, this could work :#include <WinAPISys.au3> MsgBox(0, "", "Desktop is active ?" & @CRLF & _DesktopActive() ) Func _DesktopActive() Return ( WinGetHandle("[ACTIVE]") = _WinAPI_GetShellWindow() ) EndFuncOr this :#include <WinAPISys.au3> MsgBox(0, "", "Desktop is active ?" & @CRLF & _DesktopActive() ) Func _DesktopActive() Return ( BitAND( WinGetState( _WinAPI_GetShellWindow() ), 8 ) <> 0 ) ; Return (WinActive( _WinAPI_GetShellWindow()) > 0) ; Or this EndFunc Edited December 9, 2015 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
qwert Posted December 6, 2015 Author Share Posted December 6, 2015 @JohnOne: Yes, the combination of the two checks seems to be the answer ... although I haven't tested a lot of cases. Thanks for the suggestion.$sTitle = WinGetTitle("(ACTIVE]") $sPName = _ProcessGetName(WinGetProcess(WinGetHandle("[ACTIVE]")))@jguinch: It seems that those methods should work, but I can't make them do so. Before calling _DesktopActive(), I place the cursor in the center of the desktop and left click once to make sure it's active ... but the function always returns False.Thanks for both responses. Link to comment Share on other sites More sharing options...
jguinch Posted December 6, 2015 Share Posted December 6, 2015 What is your operating system ? Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
qwert Posted December 7, 2015 Author Share Posted December 7, 2015 Windows 7 Professional. But I also have access to Win 8.1 and Win10. Link to comment Share on other sites More sharing options...
jguinch Posted December 7, 2015 Share Posted December 7, 2015 My code works for me (Windows 7 too) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
qwert Posted December 8, 2015 Author Share Posted December 8, 2015 Indeed, they do work. My test program was cycling through each method and the MSG from the first test was taking focus away from the desktop ... which caused the next method to fail.Sorry 'bout that. 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