Jump to content

Check for Screensaver


Recommended Posts

@EvilToaster:

Thanks for the link. It looked really useful until I got something working. It appears to actually only tell you if there is a screensaver set for each user logged into the computer. (It returns 0 if you have screensaver set to "none" and -1 otherwise.)

$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$Screensaver = $objWMIService.ExecQuery("Select * from Win32_Desktop")

For $objDesktop In $ScreenSaver
    ConsoleWrite( $objDesktop.Name & '.ScreenSaverActive=' & $objDesktop.ScreenSaverActive & @CRLF )
NextoÝ÷ Øh¯zÇ(uãSDÇ9cOvIÄ­ç§I«Þ¬-÷

Which looked like the parameters I saw someone using in the 3rd post down on this thread. With 16 being the code for GETSCREENSAVEACTIVE... but alas, I get nothing when I look at the value.

I'm not sure whether your call is going to return just whether a screen saver is set, or if one is actively saving the screen at this moment as I apparently cannot get the syntax right.

@Everyone:

Thanks for the responses so far, but I'm still having problems and would appreciate any more help.

Link to comment
Share on other sites

Dim $ScreenSaverActive
DllCall("user32","int","SystemParametersInfo","int",16,"int",0,"int",$ScreenSaverActive,"int",0)
ConsoleWrite( "DllCall returns '" & $ScreenSaverActive & "'")oÝ÷ Ûú®¢×Ê{ZÅú+YBjYl¥u·ºÚ"µÍÌÍÔØÜY[Ø]XÝ]HHØ[
    ][ÝÝÙÌ][ÝË    ][ÝÚ[ ][ÝË  ][ÝÔÞÝ[T[Y]Ò[É][ÝË  ][ÝÚ[ ][ÝËM ][ÝÚ[ ][ÝË  ][ÝÚ[ ][ÝË  ][ÝÚ[ ][ÝË
BÛÛÛÛUÜ]J  ][ÝÑØ[]È    ÌÎNÉ][ÝÈ   [È ÌÍÔØÜY[Ø]XÝ]VÌ×H   [È ][ÝÉÌÎNÉ][ÝÊB

But I didn't check others, only corrected your bad syntax.

Look at other examples for DllCall

Link to comment
Share on other sites

Syntax for DllCall should be:

$ScreenSaverActive = DllCall("user32","int","SystemParametersInfo","int",16,"int",0,"int",0,"int",0)
ConsoleWrite( "DllCall returns '" & $ScreenSaverActive[3] & "'")

But I didn't check others, only corrected your bad syntax.

Look at other examples for DllCall

Thanks for the syntax fix. It's been a long while since I've written anything in AutoIT and I forgot much.

Something's still not right, but I believe it's the parameters I'm passing to the DllCall and I'll try looking into that myself for a bit before giving up and asking for more help as the code itself is working.

Link to comment
Share on other sites

  • 1 year later...

Very old topic, but... whatever!

This code'll work:

Global Const $SPI_GETSCREENSAVERRUNNING = 114

$state = DllStructCreate("int")
DllStructSetData($state, 1, 0)
DllCall("user32.dll", "int", "SystemParametersInfo", "int", $SPI_GETSCREENSAVERRUNNING, "int", 0,  "ptr", DllStructGetPtr($state), "int", 0)
MsgBox(64, Default, DllStructGetData($state, 1))oÝ÷ Ùú+{¦¦W¢«­¢+Ù±½°
½¹ÍÐÀÌØíMA%}QM
I9MYQ%5=UPôÄÐ)±½°
½¹ÍÐÀÌØíMA%}MQM
I9MYQ%5=UPôÄÔ)±½°
½¹ÍÐÀÌØíMA%}QM
I9MY
Q%YôÄØ)±½°
½¹ÍÐÀÌØíMA%}MQM
I9MY
Q%YôÄÜ)±½°
½¹ÍÐÀÌØíMA%}QM
I9MYIIU99%9ôÄÄÐ((ÀÌØí±±!¹±ô±±=Á¸ ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì¤(ìµ­ÍÕÉÍɹÍÙÈ¥ÌÑ¥Ù(ÀÌØí½±Ñ¥Ùô±±MÑÉÕÑ
ÉÑ ÅÕ½Ðí¥¹ÐÅÕ½Ðì¤)±±
±° ÀÌØí±±!¹±°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMåÍѵAɵÑÉÍ%¹¼ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíMA%}QM
I9MY
Q%Y°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À°ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØí½±Ñ¥Ù¤°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤)±±
±° ÀÌØí±±!¹±°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMåÍѵAɵÑÉÍ%¹¼ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíMA%}MQM
I9MY
Q%Y°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°Ä°ÅÕ½ÐíÁÑÈÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤(ìÐÑ¥µ½ÕÐ(ÀÌØí½±Q¥µ½ÕÐô±±MÑÉÕÑ
ÉÑ ÅÕ½Ðí¥¹ÐÅÕ½Ðì¤)±±MÑÉÕÑMÑÑ ÀÌØí½±Q¥µ½ÕаİÀ¤)±±
±° ÀÌØí±±!¹±°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMåÍѵAɵÑÉÍ%¹¼ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíMA%}QM
I9MYQ%5=UP°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À°ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØí½±Q¥µ½ÕФ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤(ìÍÐÌͽ¹Ñ¥µ½ÕÐ)±±
±° ÀÌØí±±!¹±°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMåÍѵAɵÑÉÍ%¹¼ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíMA%}MQM
I9MYQ%5=UP°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°Ì°ÅÕ½ÐíÁÑÈÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤(ìÐÍÑÑ(ÀÌØíÍÑÑô±±MÑÉÕÑ
ÉÑ ÅÕ½Ðí¥¹ÐÅÕ½Ðì¤)±±MÑÉÕÑMÑÑ ÀÌØíÍÑÑ°Ä°À¤)¼(%M±À ÈÔÀ¤(%±±
±° ÀÌØí±±!¹±°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMåÍѵAɵÑÉÍ%¹¼ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíMA%}QM
I9MYIIU99%9°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À°ÅÕ½ÐíÁÑÈÅÕ½Ðì°±±MÑÉÕÑÑAÑÈ ÀÌØíÍÑѤ°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤(%%9½Ð±±MÑÉÕÑÑÑ ÀÌØíÍÑѰĤQ¡¸($%Q½½±Q¥À ÅÕ½ÐíÍɹÍÙÈ¥Ì=ÅÕ½Ðì¤(%±Í($%Q½½±Q¥À ÅÕ½ÐíÍɹÍÙÈ¥Ì=8ÅÕ½Ðì¤($%M±À ÌÀÀÀ¤(%¹%)U¹Ñ¥°±±MÑÉÕÑÑÑ ÀÌØíÍÑѰĤ(ìÉÍѽÉ)±±
±° ÀÌØí±±!¹±°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMåÍѵAɵÑÉÍ%¹¼ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíMA%}MQM
I9MYQ%5=UP°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°±±MÑÉÕÑÑÑ ÀÌØí½±Q¥µ½ÕаĤ°ÅÕ½ÐíÁÑÈÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤)%9½Ð±±MÑÉÕÑÑÑ ÀÌØí½±Ñ¥Ù°Ä¤Q¡¸(%±±
±° ÀÌØí±±!¹±°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐíMåÍѵAɵÑÉÍ%¹¼ÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÀÌØíMA%}MQM
I9MY
Q%Y°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°±±MÑÉÕÑÑÑ ÀÌØí½±Ñ¥Ù°Ä¤°ÅÕ½ÐíÁÑÈÅÕ½Ðì°À°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤)¹%)±±
±½Í ÀÌØí±±!¹±¤
Edited by fastnick1oo
SciTE - much better than notepad. ; ]
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...