Welcome Guest.   Make a donation to an author on the site July 29, 2010, 03:39:28 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Latest Newsletter: July 14th, 2010 - "Friends of a Feather"
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: AudioBookSleep  (Read 3370 times)
Nod5
Supporting Member
**
Posts: 593


View Profile Give some DonationCredits to this forum member
« on: February 26, 2009, 03:57:12 PM »

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  Cool. But this works pretty well too  smiley. Any suggestions on improving it? (Feel free to add code.)

[copy or print]
;-- 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 -- http://www.donationcoder.com/Software/Mouser/MiniCap/

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

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
 exitapp
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
« Last Edit: February 26, 2009, 04:47:56 PM by Nod5 » Logged
Deozaan
Charter Member
***
Posts: 3,451



plarker Deozaan see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: February 26, 2009, 04:17:23 PM »

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?

How about adding that brain-sensor? Grin
Logged

Nod5
Supporting Member
**
Posts: 593


View Profile Give some DonationCredits to this forum member
« Reply #2 on: February 26, 2009, 04:50:53 PM »

 Grin I pass the buck to the Autohotkey devs. Clearly they need to add some more commands. After that we could just run this:
[copy or print]
Loop
{
Sleep, 1000
IfExist Brain
 var := A_BrainState
if var = sleep
 Shutdown, 9
}
cheesy
« Last Edit: February 26, 2009, 04:53:56 PM by Nod5 » Logged
Ampa
Charter Member
***
Posts: 457


I am cute ;)

View Profile Give some DonationCredits to this forum member
« Reply #3 on: February 26, 2009, 04:54:52 PM »

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.

Ampa
Logged
cranioscopical
Friend of the Site
Supporting Member
**
Posts: 2,412



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #4 on: February 26, 2009, 05:02:56 PM »

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.
And if all those buttons aren't enough, don't forget to zip up the code.


edit: can't proof read properly
Logged

Chris
Shades
Member
**
Posts: 716


see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: February 26, 2009, 06:07:15 PM »

yep, there are definitely a lot of places in the computing world where a "dead man's switch" can be of use.

Speaking for myself, I like to see some series/movies when I go to sleep. It would be great to have such a switch handy. However it should be possible for some piece of software to override this switch, for example when you're downloading something.
Logged
Nod5
Supporting Member
**
Posts: 593


View Profile Give some DonationCredits to this forum member
« Reply #6 on: February 27, 2009, 12:05:56 PM »

AudioBookSleep v090227
http://nod5.dcmembers.com/audiobooksleep.html

overview:
AudioBookSleep waits X minutes, saves a screenshot of VLC to desktop, then shuts down the computer.
The VLC screenshot shows the filename and time just before shutdown.
That 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 later chapters that gives away the plot! You wish for some automatic screenshot-then-shutdown timer. So you start to use AudioBookSleep.

« Last Edit: February 28, 2009, 03:01:53 AM by Nod5 » Logged
mouser
First Author
Administrator
*****
Posts: 24,001



plarker mouser see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: March 17, 2009, 04:35:23 PM »

Cool.
Written up in ghacks today: http://www.ghacks.net/2009/03/17/audiobook-sleep/

ps. feel free to bundle minicap.exe in with your zip if you like.

Logged
Nod5
Supporting Member
**
Posts: 593


View Profile Give some DonationCredits to this forum member
« Reply #8 on: March 19, 2009, 04:02:59 PM »

Great! ghacks is a cool place!

AudioBookSleep v090319b
http://nod5.dcmembers.com/audiobooksleep.html
090319: if a VLC window is not found then the entire desktop (=all active screens) is screencapped instead
090319b: fixed a pathbug, bundled minicap.exe (thanks and cheers to mouser!)
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
SMF © 2006-2009, Simple Machines LLC

social bookmark this page