Keeps the computer awake by moving the mouse cursor and clicking periodically with a human-like behavior. It automatically detects the operating system (Windows or macOS) and runs the appropriate underlying logic.
Usage
dont_sleep(sec_range = c(20, 60), off_time = 18.5, quiet = FALSE)
Arguments
- sec_range
Numeric vector of length 2. Range (in seconds) of random intervals between mouse movements and clicks. Default is
c(20, 60)
.- off_time
Numeric. Decimal hour (24h format) to stop the function automatically, e.g. 18.5 means 18:30 (6:30 PM). Default is
18.5
.- quiet
Logical. If
TRUE
, suppresses progress messages. Default isFALSE
.
Details
The cursor initially moves to the upper-left corner (0,0), then performs small random movements and clicks periodically to avoid system sleep. The function exits if the user moves the mouse away from the corner or when the specified off-time is reached.
Requires cliclick
installed on macOS (install via Homebrew:
brew install cliclick
), and the KeyboardSimulator
package on Windows.
See also
Other Tools:
autoline()
,
bind_files()
,
bring_api()
,
chr2num()
,
db_download()
,
db_upload()
,
export_plot()
,
export_results()
,
files_functions()
,
font_exists()
,
formatColoured()
,
formatHTML()
,
get_credentials()
,
glued()
,
grepm()
,
h2o_selectmodel()
,
haveInternet()
,
image_metadata()
,
importxlsx()
,
ip_data()
,
json2vector()
,
list_cats()
,
listfiles()
,
mail_send()
,
markdown2df()
,
move_files()
,
msplit()
,
myip()
,
quiet()
,
read.file()
,
statusbar()
,
tic()
,
try_require()
,
updateLares()
,
warnifnot()
,
what_size()
Examples
if (FALSE) { # \dontrun{
# Keep the computer awake until 8:00 PM, with mouse actions every 30 to 60 seconds
dont_sleep(sec_range = c(30, 60), off_time = 20)
} # }