Jump to content

Need help testing screenlock


Recommended Posts

I have a small piece of code that starts the screensaver after x minutes and waits for the screensaver to turn off via keyboard or mouse movement.  Then the screen is locked.  My problem is once the screen is locked my counter starts over and at x minutes the screensaver is launched again.  I get an at this point that the screensaver can't open.  How can I pause everything until the user logs back in thus unlocking the computer?

Thanks very much for any assistance.

Here is the code:

Opt("TrayIconHide", 1)

Local $minutes = 0
Local $posx = 0
Local $posy = 0
Local $lastposx = 9999
Local $lastposy = 9999

While 1
  
   $posx = MouseGetPos(0)
   $posy = MouseGetPos(1)
  
   If $posx = $lastposx AND $posy = $lastposy Then
   $minutes = $minutes + 1
   Else
   $minutes = 0
   EndIf
  
   If $minutes = 30 Then
   RunWait("C:WindowsSysWOW64ssText3d.scr -s")
   dllcall("user32.dll","Int","LockWorkStation")  
   EndIf
  
   If $minutes >
  
   $lastposx = $posx
   $lastposy = $posy
  
   Sleep(60000)
  
WEnd
  
  
  

Link to comment
Share on other sites

Search for isLocked functions and then just idle until it is unlocked again.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...