How to simulate mouse movements to prevent screen saver activation?
Whenever the screesaver is active on the web we have to re-logon and re-type the password back again. This is simply weird. The settings are applied on all the computers. I am simply not able to figure out how to modify the same. Desktop should appear when someone movies the mouse and comes on the screen. But there the scenario is bit different. It just take the user to the logon screen. We are having a server here.
Re: How to simulate mouse movements to prevent screen saver activation?
If you are logged in to the local account instead of domain then you might have rights to modify the settings of your own pc. Not for the user profiles which are stored on the server. First ask anyone from your IT department if they will permit you to change your own screensaver timeout. They may not make a per-account change to let the timeouts vary by account but they may not bar you from altering your own timeout.
Re: How to simulate mouse movements to prevent screen saver activation?
Great job! I agree 100% - the bonehead administrators have no clue about the work life of average developers. I too work with at least 2 computers, sometimes 3 or 4. Besides which, a single call or meeting will activate all the screen savers.
I needed to use this tool while working remotely for a client of mine who has this stupid policy (and refused to change it). Our Gotomeeting session kept timing out and no-one was around to re-activate the screen. Bingo.. just run the keepalive program and the problem is solved.
I took the code and compiled it using .net 2.0 framework... works great.
Here is the main Form1.Cs file if anyone wants to do the same
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace KeepAlive
{
public partial class Form1 : Form
{
[DllImport("User32.dll")]
private static extern int SetForegroundWindow(IntPtr hWnd);
[DllImport("User32.dll")]
private static extern IntPtr GetForegroundWindow();
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
IntPtr previous = GetForegroundWindow();
SetForegroundWindow(this.Handle);
textBox1.Text = "";
SendKeys.Send("a");
SetForegroundWindow(previous);
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
here is the Form1.designer.cs file.. 100 secs on the timer.
namespace KeepAlive
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.textBox1 = new System.Windows.Forms.TextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(1, 4);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(28, 20);
this.textBox1.TabIndex = 0;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 100000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(39, 27);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Admin";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Timer timer1;
}
}
Re: How to simulate mouse movements to prevent screen saver activation?
I have the same problem here at work. My WinXP SP3 laptop locks itself (as if pressing Win+L) after about 15 minutes of inactivity. The irony is that I need to watch presentations that take more than 15 minutes, or I'm in online meetings where there's no need for mouse/keyboard and it pisses me off that the screen locks.
So I wrote a small Perl script to simulate mouse movement:
PHP Code:
use strict;
use Win32::GUI();
my ($x, $y) = Win32::GUI::GetCursorPos;
while(1) {
print "Shake it baby\n";
Win32::GUI::SetCursorPos($x+1, $y);
sleep 1;
Win32::GUI::SetCursorPos($x, $y);
sleep 10*60;
}
The script works and I see the mouse move, but that doesn't prevent the lock screen from activating. Does anyone know of a free software that would disable this behavior?
UPDATE: I found that if I have WinSCP 4.2.7 attempt to connect to an unreachable host, the screen never locks. I posted on their forum to find out why this happens and I asked the author to extract that functionality into a small utility to prevent screen saver activation.
Re: How to simulate mouse movements to prevent screen saver activation?
You guys are lucky. I work at the stupidest fuking company* in the world. My timeout is set to 3 minutes. So if I am holding still reading something, my screen locks, and I have to re-enter my password. Fuking distracting!
Re: How to simulate mouse movements to prevent screen saver activation?
Hi ,
I have been working on similar tool, the only way that made it work is to use SendInput function in Win32 API. Then P/Invoke it from .NET The tool is available as a binary if you want to download it from my blog.
Regards,
Mike
Re: How to simulate mouse movements to prevent screen saver activation?
Or go to murgee.com, download, run (doesn't install so no admin needed), pay $5 and go on with your life.