Temporarily Disable Screensaver

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Temporarily Disable Screensaver

Post by dbish » Wed Jan 08, 2003 8:47 am

I use MSched 5.1.1 (yes, I know its old but has served me well for around 5 years). Recently upgraded my Operating System to WinXP Home. A number of my macros are of the form:

Do This . .
Wait awhile . .
Find open window with text of "XXXX" and press a button to close and continue.
MOST of my macros run at night when I am unable to watch machine.

My problem is that I have a password-protected screensaver on the computer which in prior Windows OSs did not stop the Find a Window command. XP's screensaver is stronger and prevents Msched for finding a window and blows up the macro.

Does anybody know how to programmatically turn a screensaver off and then back on? I think this is the easiest fix. If any alternatives come to mind I would also consider them.

Thanks

Dave

Ernest

Post by Ernest » Wed Jan 08, 2003 9:31 am

Hi Dave,
as XP is partially based on NT/2000, I expect the Screensaver acts now the way like to lock the box. As I know MSched scripts can't be used like a service, therefore the script execution stops.

:idea: Maybe a way is not to (b)lock the box. Change the resolution of your screen (check graphics adapter) and move the window you've to work on outside of the visible part of the screen (which by the way should be switched off in general while you absent to save energy 8) ).

If you show us what you do with the script, we could have a look to find an alternative way to solve the issue ...

Ernest (working with MSched 6.0 :wink: )

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Wed Jan 08, 2003 10:44 am

Hi dbish,

The simplest solution:


Exe>c:\windows\system32\powercfg.cpl

I'm sure you'll figure out the rest of the script.

Ernest

Post by Ernest » Wed Jan 08, 2003 11:36 am

Hi,
as Execute File> works with a (to an application assigned) file, what's the app which should run that cpl (it's not working on my NTBox) ?

Thx,
Ernest

BTW: Isn't WINNT the default root directory with XP ?
Marcus Tettmar, will we get the DOS %COMSPEC% with a future release/patch of MSched ?

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Wed Jan 08, 2003 12:04 pm

Ernest,

I tested my suggested xe>c:\windows\system32\powercfg.cpl again per your request and confirm the validity of the statement on Windows XP. .CPL (control panel) is a system file and, thus, requires no explicitly declared application to run. I discovered this trick by accident.

As a matter of fact, this script is often used in my apps. For example, Norton Speed Disk for Win98 demands no screensaving; otherwise, it keeps on sorting. Neither do I desire screensaving when I drive my car in the United States with GPS-guided mapping software.

Guest

Post by Guest » Wed Jan 08, 2003 5:43 pm

Thanks for all the replies.

First, I tried to use the Execute File approach with desk.cpl which gives me control of the Screensaver applet. I tried to change my screensaver from the existing one to (none). XP blocked the keystrokes and just triggered the "Unlock Computer" password entry box.

I find as I play with this that the issue is not the screensaver per se but that it is a locking Screensaver (I have small kids near my computer during the day so I want the locking feature). If I toggle the Screensaver Apply password field off - all my other macros work fine.

So, re-orienting my thinking - how to change the locking switch. I think that if I run a locking macro in the am and unlocking macro at night (when my unattended processing takes place) I will be fine. The morning locking macro works find:

RegistryWriteKey>HKEY_CURRENT_USER,Control Panel\Desktop,ScreenSaverIsSecure,0
Wait>1
ExecuteFile>c:\windows\system32\desk.cpl
Wait>1
WaitWindowOpen>Display*
SetFocus>Display*
Press Ctrl
Wait>.5
Press Tab
Wait>.5
Press Tab
Wait>.5
Release Ctrl
Wait>1
Press Alt
Wait>.5
Send Character/Text>P
Release Alt
Wait>.5
Press Enter

The top RegistryWrite line is designed to place the system in a known status. RegistryWrite in XP writes a field of the type REG_DWORD. The manual use of the screensaver applet writes a registry field of the type REG_SZ. XP interprets a DWORD field (on this line) as a zero value so this returns my system to a known state of password off (value = 0). The manual process of going through desk.cpl then writes a REG_SZ value of 1 to the registry.


I am having a problem on the Unlocking macro. I tried the following:

RegistryReadKey>HKEY_CURRENT_USER,Control Panel\Desktop,ScreenSaverIsSecure,SSRStatus
Wait>.5
If>SSRStatus=1,Set0
Goto>ENDPOINT
Label>Set0
RegistryWriteKey>HKEY_CURRENT_USER,Control Panel\Desktop,ScreenSaverIsSecure,0
Wait>.5
Label>ENDPOINT

This would write a zero value to the registry (of DWORD form which is okay). However, the machine does not process the macro because the locking screensaver password box pops up and requires user to enter the password. I thought that lock on computer only stopped mouse and keyboard input - it even stops behind the scenes registry writes.

I hope that this extra information helps. Anybody have any ideas?

Thanks

Dave

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Wed Jan 08, 2003 5:46 pm

Sorry about name on above post. As you can probably guess, dbish wrote the above posting. I don't understand this forum software yet.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Jan 08, 2003 7:29 pm

dbish wrote:Sorry about name on above post. As you can probably guess, dbish wrote the above posting. I don't understand this forum software yet.
That just happened because you were not logged in to Forum.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Ernest

Post by Ernest » Wed Jan 08, 2003 10:46 pm

Hi dbish,
the case: An application blocked the memory with every session.
The option: I thought about to restart the box to free the memory.

Well I had to deal with a login issue as well!

Requirements:
TweakUI and local Admin rights on the box.
1. Enable "TweakUI/Logon/Logon automatically at system startup"
2. Set User name
3. Set Password

4. "Start/Shut down/Close all programms and logon as a different user"
the logon box appears but an automated login happens. If you would work this way you have to be aware that anyone can login to that box with a simple hardware reset!

As I know the automated TweakUI login is based on a setting at the registry. So it should be possible to set and reset the registry the same way as you're doing it with the screensaver solution.

I thought about this:
shutdown at 4 AM and restart as fully restricted (ChildSave) user: John Dow.
Change registry settings at 9 PM, shutdown and restart as unrestricted (Adult) user: dbish

Ernest

dbish
Junior Coder
Posts: 49
Joined: Wed Jan 08, 2003 8:38 am

Post by dbish » Thu Jan 09, 2003 12:27 am

Dear Ernest

That approach would work if I knew I would be present at the computer to restart it at each time interval. I leave my computer on all the time and I want to set it up with macros that can be scheduled so that if I am not at the machine some evening my middle of the night macros don't blow up.

Thanks for the thought though.

Dave

Ernest

Post by Ernest » Thu Jan 09, 2003 1:01 pm

Dave,
I'm sorry (maybe I haven't got it, english isn't my native language so there's always a chance of missunderstanding from my side :roll: ).

Another try:

Set the time the script should start in your absence (e.g. 09:00)
Create a batch file which sets the time for a restart at 09:00 - 9.bat

Code: Select all

echo 09 > C:\ScriptStart.txt
The settings done by this batch file won't allow a restart - NO.bat

Code: Select all

echo NO > C:\ScriptStart.txt
Your Msched Script will read that line, compares it with the current time and starts the shutdown and automated restart if matching.

Code: Select all

ReadLN>C:\ScriptStart.txt,1,line
MidStr>line,1,2,res
If>res=NO, End
Hour>hour

Label>time
If>res=%hour%, Time2Shutdown
Wait>900
Goto>time

Label>Time2Shutdown
...
with different batch files (9-,10-,11.bat) and the NO.bat it should be easy to handle.

Rgds,
Ernest

Other options:

:idea: Maybe you wanna connect your script to an incoming mail (cause your box is always runing) e.g with a predefined subject: "Start Msched 09:00" so you can start it remotely!

Use a second (download) box without a monitor and connect to it via PCAnywhere or the Terminal Service Client !

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts