ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > Finished Programs


(1/2) > >>

Here is a small autohotkey program that I made because I needed it. I'll package it up more nicely some other time. Instead of a timer it would of course be cooler with some brain-sensor hardware device so that shutdown can occur right after you fall asleep  8). But this works pretty well too  :). Any suggestions on improving it? (Feel free to add code.)

--- ---;-- AudioBookSleep v090226
;-- by Nod5
;-- description: the program waits X minutes, then saves a screenshot of the VLC window to the desktop, then shuts down the computer
;-- The VLC screenshot shows the filename and time just before shutdown and makes it easier to next time continue from where you dozed off.
;-- use case: you listen to audiobooks at night but often fall asleep.
;-- You then awake hours later (at 3:23 AM) from the laptop light and audiobook sound.
;-- You dislike having to go up and turn it off manually. And now you're unsure at what point in the book you fell asleep.
;-- Even worse, when you woke up you heard some part from latter chapters that gives away the plot!
;-- You wish for some automatic screenshot-then-shutdown timer.
;-- So you start to use AudioBookSleep
;-- note: for screencaps you need minicap.exe by Mouser --

InputBox, xvar, sleep timer, Set time in minutes until computer shutdown, ,350,150,,,,,30
if errorlevel = 1
if errorlevel = 2

ifexist %A_ProgramFiles%\minicap\minicap.exe
 xpath = %A_ProgramFiles%\minicap\minicap.exe
else ifexist %A_scriptdir%\minicap.exe
  xpath = %A_ProgramFiles%\minicap\minicap.exe

if xvar != test
if xvar is not integer
xvar := xvar * 60000
sleep, %xvar%

IfWinExist, ahk_class QWidget ;-- screencap VLC window
WinActivate, ahk_class QWidget
WinWaitActive, ahk_class QWidget
sleep 500
if xpath !=
 run %A_ProgramFiles%\minicap\minicap.exe -captureactivewin -save "%A_Desktop%\sleep.jpg" -exit
if xvar != test
 Shutdown, 9

edit: corrected the default time in the code to 30 minutes

Looks like a useful little script. Except I don't usually have my computer in my bedroom, and couldn't stand wearing earphones to bed.

Any suggestions on improving it?-Nod5 (February 26, 2009, 03:57 PM)
--- End quote ---

How about adding that brain-sensor? ;D

 ;D I pass the buck to the Autohotkey devs. Clearly they need to add some more commands. After that we could just run this:

--- ---Loop
Sleep, 1000
IfExist Brain
 var := A_BrainState
if var = sleep
 Shutdown, 9
} :D

Need not be a brain sensor - just a button that you hold down while you are awake. If you release the button a 3(?) minute countdown is triggered that stops the book, unless of course you press the button again.

In the first instance it could just be a key on your laptop, but ultimately I think you'll need to go into production of buttons on the end of a USB cable,  then bluetooth buttons, wi-fi enabled buttons etc.


ultimately I think you'll need to go into production of buttons on the end of a USB cable,  then bluetooth buttons, wi-fi enabled buttons etc.
-Ampa (February 26, 2009, 04:54 PM)
--- End quote ---
And if all those buttons aren't enough, don't forget to zip up the code.

edit: can't proof read properly


[0] Message Index

[#] Next page

Go to full version