Page 1 of 1
Disable Web Control Sleep
Posted: Tue Mar 17, 2020 1:47 pm
by Science_1
I enjoy watching the progress of my cores, via the Web Control page, as they work on Folding At Home packets. I have a spare monitor to dedicate to the display of this page. Unfortunately, the display is constantly going to sleep and I must move the mouse to resume active display of the Web Control page. Is there a way to disable the sleep mode (of the Web Control page)? My search for "disabling sleep" returns posts about preventing a -computer- from going to sleep, which is not what I am after.
Any ideas?
Thanks!
-Science_1
Re: Disable Web Control Sleep
Posted: Tue Mar 17, 2020 4:01 pm
by foldy
You can use FAH advanced control instead which does not go to sleep. Or you can download a tool which moves the mouse slightly after some minutes to prevent fah web control sleep.
Re: Disable Web Control Sleep
Posted: Tue Mar 17, 2020 4:15 pm
by Science_1
The advanced control is ugly and not particularly informative at a glance. But your second idea has merit. I could try to whip something up in Python that moves the mouse from time to time. I wonder if that would work? Worth a shot. Thanks!
Re: Disable Web Control Sleep
Posted: Tue Mar 17, 2020 4:24 pm
by bruce
You could also go to the OS setting that allows you to define how long before your monitor goes to sleep if that's what is happening.
Re: Disable Web Control Sleep
Posted: Tue Mar 17, 2020 6:15 pm
by Science_1
Hi Bruce,
No, this seems to be a feature of the foldingathome web control page. Windows would just go blank or bring up the screen saver. It wouldn't say "Web Control sleeping..." The suggestion of using a tool that automatically moves the mouse works. I wrote a little script in Python to do just this, and it solved the sleep problem. Thank You foldy!!
Re: Disable Web Control Sleep
Posted: Wed Mar 18, 2020 12:20 am
by Science_1
Here is the Python program I wrote to prevent the Folding@home Web Control page from sleeping.
This code takes guidance from the excellent Python book, Automate The Boring Stuff With Python
by Al Sweigart. You will have to install the pyautogui library to your system before you can edit/compile/run
it with your python editor. The instructions for installation of the library can be found here:
https://automatetheboringstuff.com/chapter18/
My code is offered without warranty and without restriction.
Use it with my blessing, but at your own risk.
Yes, it is quick and dirty. Challenge yourself to do better!
Code: Select all
# Insomnia
# Written by Science_1
# 03/17/2020
# ---------------------
import pyautogui # Handles mouse positioning
from time import sleep
import time # Needed to read the clock.
pyautogui.PAUSE = .001
pyautogui.FAILSAFE = True
t0 = time.time() # The clock time when program starts
elapsed_mouse = 0 # Time elapsed since last mouse-check
elapsed_exit = 0 # Time lapsed since last exit_check
mouse_time = t0 # Clock time at start of current mouse wait
exit_time = t0 # Clock time at start of current exit wait
move_mouse_interval = 120 # Seconds between mouse checks.
check_exit_interval = 1 # Seconds between exit checks.
start_points = '' # Declare and initialize
end_point = '' # Declare and initialize
print("\n Folding@Home Sleep Stop")
print('',"-"*25)
print("\n Launch this program, then leave your mouse over the\n\
Folding@home Web Control Page to prevent the page from sleeping.\n\
\n\
You will be able to use your mouse normally for other activities.\n\
Move the mouse to the upper-left corner of your main screen to\n\
end this program.\n")
print('',"="*64)
while not start_points.isdigit(): # Reject all non-number characters.
start_points = input("\n What is your starting point total? ")
if start_points == '':start_points = '0' # Allow user to just hit Enter.
print("\n\n Running.. ",end="")
direction = 1 # If direction is 1, cursor moves right. When -1, left.
distance = 1 # Number of pixels to move the mouse right or left.
run_flg = True # Exit flag
while run_flg == True:
elapsed_mouse = ((time.time()-mouse_time)*100)//100 # Time the mouse has been waiting since last check
elapsed_exit = ((time.time()-exit_time)*100)//100 # Time the exit has been waiting since last check
if elapsed_mouse > move_mouse_interval: # If the move mouse timer has expired
mouse_time = time.time() # Reset move-mouse clock
direction *=-1 # Reverse direction
pyautogui.moveRel(direction*distance,0,duration = 0.01) # Move the mouse
if elapsed_exit > check_exit_interval: # If the exit timer has expired
exit_time = time.time() # reset the exit timer.
if pyautogui.position() == (0,0): # See if the mouse is in the upper left corner of main sceen.
run_flg = False # If it is there, then tell the run loop to exit.
sleep(0.24) # Suspend program function for a sort while to free up CPU cycles for Fold@home.
seconds = int(time.time()-t0) # Find total seconds elapsed of run time.
days = seconds//(60**2*24) # Calculate days that have elapsed
seconds -= days*(60**2*24) # Subtract seconds in that many days from run time.
hours = seconds//(60**2) # Calculate hours that have elapsed.
seconds -= hours*60*60 # Subtract sends in hours from run time.
minutes = seconds//60 # Calculate minutes that have elapsed.
seconds -= minutes*60 # Subtract seconds in minutes from run time. Only seconds are left.
print("\n Finished.")
end_points =""
while not end_points.isdigit(): # Reject non-number characters.
end_points = input("\n What is your end point total? ")
if end_points == '': end_points = '0' # Allow user to just hit Enter.
print("\n Current Run: "+str(days).rjust(3,'0')+" Days. Timer: "+str(hours).rjust(2,'0')+":"+str(minutes).rjust(2,'0')+":"+str(seconds).rjust(2,'0'))
print(" Points Earned:",(int(end_points) - int(start_points)),end = "\n\n ")
input("Press [ENTER] to Quit: ") # Input statment here so compiled program will not instantly close out.
print("\n",end=" ") # Position the cursor for Operating System's 'Press any key to continue...'