Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

KillSaver


  • Please log in to reply
21 replies to this topic

#1 TomTheGeek

TomTheGeek

    Seeker

  • Active Members
  • 12 posts

Posted 30 June 2005 - 03:49 PM

This is a little program I wrote for all of you that are using a corporate computer system at work that forces a screensaver lockout on you. Just a simple little script that moves the mouse every so often (but only if the mouse is idle) so the screensaver doesn't kick in.

The code is below, and I attached the compiled version, just unzip into your favorite location (I suggest the startup menu) and run.

Any feedback or suggestions would be appreciated!!

Plain Text         
Opt("GuiOnEventMode",1) Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1); no default tray menuitems #NoTrayIcon #include <GUIConstants.au3> Global $infolabel Global $sleepTime Global $pause = 1 ;---------------Tray event values---------------- Global $TRAY_EVENT_SHOWICON         = -3 Global $TRAY_EVENT_HIDEICON         = -4 Global $TRAY_EVENT_FLASHICON        = -5 Global $TRAY_EVENT_NOFLASHICON      = -6 Global $TRAY_EVENT_PRIMARYDOWN      = -7 Global $TRAY_EVENT_PRIMARYUP        = -8 Global $TRAY_EVENT_SECONDARYDOWN    = -9 Global $TRAY_EVENT_SECONDARYUP      = -10 Global $TRAY_EVENT_MOUSEOVER        = -11 Global $TRAY_EVENT_MOUSEOUT         = -12 Global $TRAY_EVENT_PRIMARYDOUBLE    = -13 Global $TRAY_EVENT_SECONDARYDOUBLE  = -14     ;---------------Build UI---------------- TraySetClick(16) $runitem = TrayCreateItem("Set Timeout") TrayItemSetOnEvent(-1,"SetTimeout") TrayCreateItem("") $infoitem = TrayCreateItem("About") TrayItemSetOnEvent(-1,"DisplayAbout") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"ExitEvent") TraySetIcon(@AutoItExe) TraySetState() TraySetToolTip("KillSaver 1.2") ;---------------Set initial variables---------------- $lastpos = MouseGetPos() $PreviousSetting = RegRead("HKEY_CURRENT_USER\SOFTWARE\KillSaver\", "Timeout") If $PreviousSetting <> "" Then     $sleepTime = $PreviousSetting Else     $sleepTime = 1000 * 60 * 5;Five minutes = 1000 * 60 * 5 EndIf ;---------------Main loop---------------- While 1     $currentpos = MouseGetPos()    ;Check if current position is the same as the last position, if true move the mouse to the right.     if $lastpos[0] = $currentpos[0] AND $lastpos[1] = $currentpos[1] then         MouseMove($currentpos[0] + 50, $currentpos[1], 4)                ;Check to see if the mouse has actually moved, move the mouse to the left if not.         $newpos = MouseGetPos()         if $lastpos[0] = $newpos[0] AND $lastpos[1] = $newpos[1] then             MouseMove($currentpos[0] - 50, $currentpos[1], 4)         endif                ;Move back to original position so the mouse is in the same place they left it.         MouseMove($currentpos[0], $currentpos[1], 4)     EndIF    ;MsgBox(48,"",$sleepTime)     Sleep($sleepTime)     $lastpos = $currentpos WEnd Exit ;---------------Functions---------------- ;Dialog for setting loop timout. Func SetTimeout()     GUICreate("Set Timout", 210, 100)     GUISetIcon(@AutoItExe)         $Label = GUICtrlCreateLabel("Enter a timeout value" & @CRLF & "(in minutes)", 20, 15, 100, 30)     $inputID = GUICtrlCreateInput ($sleepTime/60/1000, 150, 17, 50, 20)     $timeoutID = GUICtrlCreateUpdown ($inputID, $UDS_ARROWKEYS)     GUICtrlSetLimit ( $timeoutID, 9999, 1)         $SaveID  = GUICtrlCreateButton("Save", 40, 70, 50, 20)     GUICtrlSetOnEvent($SaveID,"OnSave")         $CancelID = GUICtrlCreateButton("Cancel", 120, 70, 50, 20)     GUICtrlSetOnEvent($CancelID,"OnClose")         GUISetOnEvent($GUI_EVENT_CLOSE,"OnClose")         GUISetState() ; display the GUI EndFunc ;Display about dialog box Func DisplayAbout()     GUICreate("About", 250, 180)     GUISetIcon(@AutoItExe)         GUICtrlCreateIcon(@AutoItExe, -1, 5, 7)     GUICtrlCreateLabel("KillSaver Version 1.2" & @CRLF & "by Tom Beighley", 50, 10, 190, 30)     GUICtrlCreateLabel("An application that moves the mouse when idle to disable the screen saver." & @CRLF & "Does not need Admin rights to install or run.", 50, 45, 190, 50)     GUICtrlCreateLabel("TomTheGeek@gmail.com" & @CRLF & "www.TomTheGeek.com", 50, 105, 190, 30)             $OkID = GUICtrlCreateButton("OK", 100, 150, 50, 20)     GUICtrlSetOnEvent($OkID,"OnClose")         GUISetOnEvent($GUI_EVENT_CLOSE,"OnClose")         GUISetState() ; display the GUI EndFunc ;Save settings Func OnSave()     $Timeout = Number(ControlGetText("Set Timout", "", "Edit1"))     If $Timeout > 0 Then         $sleepTime = $Timeout * 60 * 1000        ;MsgBox(48,"",$sleepTime)         RegWrite("HKEY_CURRENT_USER\SOFTWARE\KillSaver\", "Timeout", "REG_DWORD", $sleepTime)         GUIDelete()     Else         MsgBox(48,"Incorrect Data","Please enter non-zero numerical data only for the timeout value.")     EndIF EndFunc ;Function for exiting the app Func ExitEvent()     Exit EndFunc ;Close last GUI window Func OnClose()     GUIDelete() EndFunc

Attached Files


www.TomTheGeek.com - All the geeky stuff that gets me hot







#2 jftuga

jftuga

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 335 posts

Posted 30 June 2005 - 04:39 PM

Can you access the registry to determine how many minutes of inactivity (wait time) before the SS starts? If so, you can make the default $sleepTime equal to that time minus one minute.

What do you think?

-John

#3 blindwig

blindwig

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 772 posts

Posted 30 June 2005 - 04:48 PM

Maybe a stupid question, but why put all this work into making a screensaver not come up? Wouldn't it be a lot easier to just turn off your screen saver?

#4 jftuga

jftuga

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 335 posts

Posted 30 June 2005 - 04:51 PM

You can't turn it off. If you are logged into a domain, a group policy can be set to deny access to the desktop properties.

-John

#5 blindwig

blindwig

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 772 posts

Posted 30 June 2005 - 05:42 PM

You can't turn it off.  If you are logged into a domain, a group policy can be set to deny access to the desktop properties.

-John

<{POST_SNAPBACK}>

So fix the group policy to allow the screen saver to be disabled.
I'm just saying that why not go to the root source of the problem instead of trying to write a program to work around it?

#6 jftuga

jftuga

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 335 posts

Posted 01 July 2005 - 02:56 AM

Some companies do not want you to change it. It is their computer and you are just a simple end-user who must conform to their computer usage policy.

For example, our systems are locked down tight. No changing background or screensaver, no right-clicking on My Computer, no access to C: from My Computer (all data is saved to the network share), minimal internet explorer options, no ability to install software, no Start -> Run, no games, no control panel, etc.

-John

#7 seandisanti

seandisanti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,927 posts

Posted 13 July 2005 - 02:36 PM

Some companies do not want you to change it.  It is their computer and you are just a simple end-user who must conform to their computer usage policy. 

For example, our systems are locked down tight.  No changing background or screensaver, no right-clicking on My Computer, no access to C: from My Computer (all data is saved to the network share), minimal internet explorer options, no ability to install software, no Start -> Run, no games, no control panel, etc.

-John

<{POST_SNAPBACK}>

My company is like that, but there are several work arounds which you could do to kill it at the source. You could as was suggested above set the timer to -1 (i think 0 would work too), you could change it in the registry to disable the screensaver completely, etc etc. i will code an example or two and post when it's done.
1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

#8 seandisanti

seandisanti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,927 posts

Posted 13 July 2005 - 02:58 PM

My company is like that, but there are several work arounds which you could do to kill it at the source.  You could as was suggested above set the timer to -1 (i think 0 would work too), you could change it in the registry to disable the screensaver completely, etc etc.  i will code an example or two and post when it's done.

<{POST_SNAPBACK}>

ok, got it... we have win2k at work, so that's the only thing i could test it on, but it worked for me. realized after my last post how old this thread was... oops... oh well here's the code anyway...and changing registry values works regardless of group policy etc...(i test all of the new images my work uses to TRY to lock stuff down.)



$KILL = RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop\","SCRNSAVE.EXE","REG_SZ","")

IF $KILL = 1 THEN
MSGBOX(0,"SUCCESS","SCREENSAVER KILLED")
ELSE
MSGBOX(0,"FAIL","SCREENSAVER NOT KILLED")
ENDIF

Edited by cameronsdad, 13 July 2005 - 03:02 PM.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

#9 Nova

Nova

    Gui creation freak

  • Active Members
  • PipPipPipPipPipPip
  • 675 posts

Posted 13 July 2005 - 04:02 PM

Wait a second your company will not let you change display settings but they allow you edit the registry?

#10 seandisanti

seandisanti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,927 posts

Posted 13 July 2005 - 04:27 PM

Wait a second your company will not let you change display settings but they allow you edit the registry?

<{POST_SNAPBACK}>

i test the images for the machines for security, so i have alot of freedom to do what i want with the computers. i'm not in IT or anything, i just help them out. so far they haven't made an image that i couldn't get through in under 10 minutes (usually under 1) without having to use autoit or vba.
1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

#11 seandisanti

seandisanti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,927 posts

Posted 13 July 2005 - 04:29 PM

i test the images for the machines for security, so i have alot of freedom to do what i want with the computers.  i'm not in IT or anything, i just help them out.  so far they haven't made an image that i couldn't get through in under 10 minutes (usually under 1) without having to use autoit or vba.

<{POST_SNAPBACK}>

and with something like disabling a screensaver, how are they going to know that it's disabled unless they sit there and watch it for 10-15 minutes to make sure that noone is doing anything? for all they know, yours just never comes on because you're never away from your computer for more than 10 minutes at a time...
1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

#12 Doug

Doug

    Seeker

  • Active Members
  • 12 posts

Posted 13 July 2005 - 04:52 PM

This utility could be useful for online games that time you out and close your connection if you're idle too long...it would be especially gratifying if the game took minutes to restart.

#13 ryeguy

ryeguy

    Wayfarer

  • Active Members
  • Pip
  • 78 posts

Posted 13 July 2005 - 07:28 PM

There's no such thing as an online game that doesn't have the option to turn off the idle quit thing.

#14 seandisanti

seandisanti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,927 posts

Posted 14 July 2005 - 01:10 PM

There's no such thing as an online game that doesn't have the option to turn off the idle quit thing.

<{POST_SNAPBACK}>

sure there is. matrix online has an inactivity timer that you can't configure in the options. typically the screensaver won't come up while the game is on anyway, but if you're away too long it will exit out on you
1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

#15 Insolence

Insolence

    Not distastefully arrogant

  • Active Members
  • PipPipPipPipPipPip
  • 1,304 posts

Posted 14 July 2005 - 08:23 PM

There's no such thing as an online game that doesn't have the option to turn off the idle quit thing.

<{POST_SNAPBACK}>

Diablo II has that also.
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

#16 TomTheGeek

TomTheGeek

    Seeker

  • Active Members
  • 12 posts

Posted 27 July 2005 - 02:28 AM

I work at a government branch and it's required to have the screen saver lockout set using group policy and there's nothing we can do. Since I work in the IT dept I could change it, but then I would get fired. :)

I hadn't thought about changing the registry, but I'm guessing it wouldn't work since the users don't have admin privilages. That would be a slick way of fixing it though, I will try cameronsdad's code and see if it works.

I am working on a some changes to this program, mostly how the timer works and possibly adding some more user configurable options. Even if this is a useless program it was a good learning experiance, I got to play around with autoit's GUI and learned how to setup a tray bar app with a right click menu so it wasn't a total waste.
www.TomTheGeek.com - All the geeky stuff that gets me hot

#17 /dev/null

/dev/null

    Universalist

  • MVPs
  • 2,946 posts

Posted 27 July 2005 - 04:24 AM

I work at a government branch and it's required to have the screen saver lockout set using group policy and there's nothing we can do. Since I work in the IT dept I could change it, but then I would get fired.  :)


O.K., with your script you are actively circumventing the IT policy. Why do you think you could get fired for changing the group policy and not for "disabling" it by running your script??

I guess, there is a reason for your policy....

Cheers
Kurt

Edited by /dev/null, 27 July 2005 - 04:25 AM.

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

#18 TomTheGeek

TomTheGeek

    Seeker

  • Active Members
  • 12 posts

Posted 27 July 2005 - 04:40 AM

Mainly because I am only circumventing the IT policy on one computer at a time and not the entire domain. Also, this way I'm not breaking the rules, just sort of bending them. The GP still exists and the program isn't doing anything I normally don't do (move the mouse), it just does it for me.

That probably is still a strech but like someone else said, unless they knew I had this program there is almost no way of knowing whats going on so it's a lot safer. Sure they could fire me for it, but they could fire me for lots of things worse than this I'm sure. Being on the IT dept makes a big difference :)

O.K., with your script you are actively circumventing the IT policy. Why do you think you could get fired for changing the group policy and not for "disabling" it by running your script??

I guess, there is a reason for your policy....

Cheers
Kurt

<{POST_SNAPBACK}>


www.TomTheGeek.com - All the geeky stuff that gets me hot

#19 seandisanti

seandisanti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,927 posts

Posted 27 July 2005 - 07:58 PM

Mainly because I am only circumventing the IT policy on one computer at a time and not the entire domain. Also, this way I'm not breaking the rules, just sort of bending them. The GP still exists and the program isn't doing anything I normally don't do (move the mouse), it just does it for me.

That probably is still a strech but like someone else said, unless they knew I had this program there is almost no way of knowing whats going on so it's a lot safer. Sure they could fire me for it, but they could fire me for lots of things worse than this I'm sure. Being on the IT dept makes a big difference  :)

<{POST_SNAPBACK}>

here we go, i tweaked it a little to help avoid the whole firing thing... now there is a hotkey... when you run the script, it kills the screensaver, then idles around doing nothing until you hit the pause button at which point it restores the screensaver functionality...
$old = RegRead ( "HKEY_CURRENT_USER\Control Panel\Desktop\","SCRNSAVE.EXE" ) $KILL = RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop\","SCRNSAVE.EXE","REG_SZ","") HotKeySet("{PAUSE}","ToggleSS") while 1     sleep(1000) WEnd Func ToggleSS()     RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop\","SCRNSAVE.EXE","REG_SZ",$old)     Exit EndFunc

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

#20 eltorro

eltorro

    more or less the same as the latter of the former.

  • Active Members
  • PipPipPipPipPipPip
  • 596 posts

Posted 30 July 2005 - 12:58 AM

I too wanted to toggle killsaver on and off. I added an a checked menu item to the traymenu and changed the tool tip to show current state of activation.

I tried using the reg but found that the screensaver would not restart after changing the key with regwrite. But if I merge it in, It worked. Any ideas?


I don't have either code here (home.) I'll try to upload it later.

-Steve




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users