Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you make the monitor "wake up" from the screen saver?

Status
Not open for further replies.

FastLearner

Technical User
May 10, 2002
17
0
0
US
I've written a nifty script that runs in line with our system alarm printer. (I work on an Intecom E-14 PBX.) All the alarms that hit the printer also display to the screen in my work area in color coded format. It also pages/emails out on certain alarms, plays wave files on others, and even keeps a daily alarm log.

The one thing I CAN'T get it to do is wake up from the screen saver when it receives an input! I don't want my screen to get burn in but I need to see when activity occurs. Does anyone know of some trick to accomplish this?

FYI: sendkeystr doesn't work
 
Hi,

I had the same problem, and I solved it with a workaround, here it comes:

proc MAIN

set modem acceptcall data ON
set aspect rxdata ON

LUS:
when ELAPSED 0 180 call SCRNSVR
while $CARRIER < 1
yield
endwhile
call GETRPT
goto LUS

endproc

proc GETRPT

.
.
.
termreset
sendkey ALT 'U'
taskexit SCR
set modem connection 0
execute ALMCATCH2
endproc

proc SCRNSVR

when clear
run &quot;c:\winnt\system32\scrsvr&quot; SCR
taskactivate SCR
when ELAPSED 0 180 call SCRNSVR
endproc
 
That would work great if I had an NT4 box, but I'm running Win2000 Pro.

&quot;c:\winnt\system32\scrsvr&quot; does not exist. Not only that but I can't locate ANY executable that triggers the screensaver from the command-line.

If you double-click on &quot;Misc.SCR&quot; from explorer it will launch that screensaver, but if you RUN &quot;Misc.SCR&quot; from the command line it pulls up the screen saver options dialog for that screen saver. Without the ability to &quot;RUN&quot; the screensaver, you don't have a taskid to terminate.

Anyone else have any ideas??
 
Hello,

I have tried this on my Win 2000 Pro machine and got the Same failure Meassage. I'll keep playing with it when I get a few minutes.

Hank camphm@bellsouth.net
 
Hello,

This is a Crude way to do the Wakeup. Maybe you can try it and see if you can use it in your Script. I set my screen saver to come on in 1 Minute. I then started the Following script. The Saver came on and when the Script ran, the screen saver deactivated after the 200 second Pause. This came from the Help Files.

Proc Main
Pause 200
winminimize $PWMAINWIN ; Minimize the PW main window.
pause 5 ; Wait for five seconds.
winrestore $PWMAINWIN ; Restore the PW window.
Endproc

Hank camphm@bellsouth.net
 
Hello Again,

I think this will work a Little Better. I used the same conditions as above but modified the script with the Winactivate Command, which show just kill the screen saver.

Proc Main
Pause 90
winactivate $PWMAINWIN ; Activate PW main window.
Endproc

I would use the Winactivate within a Procedure so when an alarm occurs, it calls the procedure.
Example:

Proc Wakeup
winactivate $PWMAINWIN
Endproc

Hank camphm@bellsouth.net
 
Good solution! But not perfect... The winactivate will ONLY work when the main procomm window has the focus. If it's minimized or another application is on top, winactivate fails to kill the screensaver.

I used winfocus to put Procomm on top but it doesn't seem to do anything. It stays in the background. Here's what I've done to test:

Code:
string title=&quot;Alarm Server&quot;

proc MAIN
   pwtitlebar title 	; set Title bar for easy reference
   while 1
    pause 80		; wait for saver to activate @ 60
    beep 		; notify me of attempt to wakeup
    call wakeupscreen
   endwhile
endproc

Proc WakeupScreen
integer State                  ; State of the window.
   winstate $PWMAINWIN State   ; Get state of PW window.
   if State == 0               ; See if PW is minimized.
      winmaximize $PWMAINWIN   ; Maximize if not already
   endif
  winfocus title               ; Set focus to Procomm.
  winactivate title    
Endproc

Any idea why winfocus doesn't bring it up front? I'm running Procomm version 4.5
 
Hello,

I took your Script and Compiled it. Had to add an Exitwhile to Break out of the While Loop; But it worked Fine. Got the Beep when the ScreenSaver was Killed.

Note that I am using Win 2000 pro with Procomm Plus 4.8. I don't have a Machine with Procomm 4.5 on it. Maybe Knob has an Idea.

Hank camphm@bellsouth.net
 
Did you make sure that Procomm was NOT the active window? To test, activate the script and quickly click on another app to take the focus away from procomm, then let the screensaver start.

If PW is minimized, the Maximize command will kill the screensaver. However, if it's NOT minimized and another app is the active window, the winactivate only blinks the taskbar and does not kill the screensaver. The winfocus command does not appear to do anything.

I left it looping intentionally to see if my screensaver would reactivate in the face of recurring &quot;winactivate&quot; commands. It does as long as procomm doesn't have focus.
 
Hello,

I started the Script and minimized the Procomm Window. I then launched the Textpad Editor in Full Screen Mode. After 60 Seconds the Screen Saver kicked in. In about 20 Seconds I Got the Beep, Screen Saver was Killed and Procomm was Maximized.

Hank camphm@bellsouth.net
 
Running your script on Win2K with version 4.8, a minimized instance of Procomm was restored as expected. However, if Procomm was not the active window and was minimized, then your script did not end the screen saver. I made some modifications to your script and was able to get the screensaver killed in all scenarios I tested.

First, remove the winfocus and winactivate commands from the end of the wakeupscreen procedure. Next, add an else clause to the if structure in wakeupscreen that looks like:

else
winminimize $PWMAINWIN
mspause 100
winrestore $PWMAINWIN
endif
aspect@aspectscripting.com
 
Knob,

This is for an &quot;Alarm Server&quot;. I simply want it to wake up from the screen saver when activity occurs. Sometimes alarms come within the same second. If I use minimize/restore on every alarm instance, it will wake up the from the screen saver, but you'll have a hard time reading alarms as they occur.

I'm also not sure if that will slow down script execution or not. I could get a handfull of alarms in the time it takes to minimize/restore.

Winactivate will do the job as long as Procomm is maximized and active. My question still stands, why doesn't &quot;winfocus&quot; change the active application to Procomm? Am I using it wrong? Is there another command to do this?

I can build the error-checking, but the commands have to work first...

Thanks
 
Hello,

I have a Direct Connect to a Nortel Switch that Outputs Alarms all day long. I'll hook This LapTop up to it in the Morning and see how the Script Reacts when an Alarm comes in and Post the Results tomorrow. This LapTop is Running Win 2000 Pro and Procomm 4.8.

Hank camphm@bellsouth.net
 
Does anyone have a clue why the following does not work? This test script should steal the focus every 10 seconds. I'm trying to get Procomm to put itself ontop when events occur. IF the winfocus would work the winactivate would kill the screensaver.

Code:
proc main
 while 1			;loop indefinitely
   pause 10			;wait 10 seconds
   if $FOCUSWIN != $PWMAINWIN	;check if PW has focus
     winfocus $PWMAINWIN	;if not, give it focus
   endif
   winactivate $PWMAINWIN	;kill screensaver
 endwhile
endproc
 
Revised: look below... Run this and while running, click on another app. According to what Procomm can see, it IS changing the focus, but that doesn't mean it's on top?!? Anyone know how to solve this? We can't do much window navigation at all if this command doesn't work. Winfocus is supposed to change the active window for keyboard input and it most definitely is not accomplishing that task...

p.s. I'm going to post this as a new thread also as this is moving away from screensavers.

Code:
proc main
 while 1			;loop indefinitely for test
   pause 10			;wait 10 seconds
   if $FOCUSWIN != $PWMAINWIN	;check if PW has focus
     winfocus $PWMAINWIN	;if not, give it focus
     if $FOCUSWIN != $PWMAINWIN
       usermsg &quot;The focus change failed. I don't know why....&quot;
      else
       usermsg &quot;Focus change was successful! Or was it?&quot;
     endif
   endif
   winactivate $PWMAINWIN	;kill screensaver
 endwhile
endproc
 
Finally, a solution! A &quot;mouse wiggle&quot; works great! Here's how:

Use &quot;setpointer&quot; twice (to ensure a change of position). Also, Procom MUST be the active task for this to work. Example below

Code:
proc main
   pause 90
   if $TASK != $PWTASK           ; Is current task PW?
      winactivate $PWMAINWIN     ; Activate PW main window.
   endif
   setpointer 10 10
   setpointer 20 20
endproc

Even though the &quot;winactivate&quot; still does not put the Procomm window &quot;on top&quot;, it DOES make Procomm the active task so that the pointer change can occur. This is will wake up the monitor every time! Hooray!!!
 
Hello,

I tried the Left Mouse Click and it worked during Testing but Not in a Working Script that includes Captures or While Loops. I'll Try the Mouse Movement... This is interesting.
Thanks for the Update..

Hank
 
Darn it, it looks like the same holds true for movement. I implemented this in my script and it failed to wake the monitor. Worked fine during testing though.... Arrgh!!

Also, to update the issue with winactivate not putting procomm &quot;on top&quot;, it seems to do with the Task List. As long as Procomm starts as the active app and is the one intiating the &quot;activates&quot; it has no problem navigating. But if the user selects a task while the script is running and changes the order of the task list, all procomm can do is blink the taskbar. Go figure. The TaskID never changes, just it's placement. Weird....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top