Looking for a countdown timer with alarm

Booting, installing, newbie
Post Reply
Message
Author
T_B
Posts: 160
Joined: Sun 08 Apr 2007, 12:54

Looking for a countdown timer with alarm

#1 Post by T_B »

Looking for a small utility to enter a countdown timer (egg timer/cooking timer)
Searched the board, but didn't find something like this. Maybe I' m searching the wrong way, don't think I'm the first one in need for such a program.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

Puppy has one. It might not be in the latest Puppy, but it is an official PET package. It's called 'countdown'.

T_B
Posts: 160
Joined: Sun 08 Apr 2007, 12:54

#3 Post by T_B »

Thanks Barry, this was indeed something I was looking for (it is called countdown.tcl in puppy 3.01). The only major problem is it seems to be a silent alarm or is there another version?

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

#4 Post by mcewanw »

In Puppy version 2.17 there is a countdown timer in JWM Menu -> Personal

However I don't think the alarm is audible, but certainly visual (can't test that at the moment though, sorry).

Should be pretty easy to write a simple bash based script (using, say, the sleep command) to trigger playing an audio file though. I'm sure someone will sort you out with that (I'd throw something together, but I'm in the middle of another programming project so can't just now).

Just to give you the idea though, if you open an rxvt command console and enter the following you'll see the possibility (later you would say substitute echo with a command to start up a sound playing program):

sleep 3; echo hello

The above is for a 3 second delay...

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

#5 Post by mcewanw »

oops, Barry beat me to it before I had time to recheck the posts... :-)

T_B
Posts: 160
Joined: Sun 08 Apr 2007, 12:54

#6 Post by T_B »

Thanks mcewanw

For my purposes " sleep [time]; gxine alarm.mp3 " is good enough.
Would be nice to have something with a gui though :)

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#7 Post by HairyWill »

T_B wrote:For my purposes " sleep [time]; gxine alarm.mp3 " is good enough.
I think that sleep can drift, so . Try using pschedule to create a cron event and start the cron daemon.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#8 Post by muggins »

I had a squizz at countdown.tcl & it has a section of code commented out:

Code: Select all

if { ![catch { package require snack }] } {
    snack::sound alarmsound -file \
	[file join [file dirname [info script]] attention.wav]

    set ::countdown::gui::alarmcmd [list alarmsound play -block 1]
} else {
when I uncommented the code, it complained that it couldn't find /usr/local/bin/attention.wav. But when I replaced this with alarm.wav, and placed the file alarm.wav in /usr/local/bin bingo!

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#9 Post by muggins »

T_B,

The attached .zip contains a modified countdown.tcl & alarm.wav. I f you copy them to /usr/local/bin, then countdown has an audible alarm.

Does anyone know what modifications are required to the script, so that alarm.wav is located in /usr/share/audio, rather than /usr/local/bin?

Edit: Woops! No wonder it didn't work for T_B. I uploaded the wrong file. Have uploaded the one that does work, if alarm.wav is in the same directory.
Attachments
countdown.zip
(7.5 KiB) Downloaded 245 times
Last edited by muggins on Sun 25 Nov 2007, 12:21, edited 1 time in total.

T_B
Posts: 160
Joined: Sun 08 Apr 2007, 12:54

#10 Post by T_B »

Doesn't work for me, I think it got something to do with snack. I've read a comment from Barry that is was broken in newer puppy's.

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#11 Post by Ian »

Here is a quick & dirty timer that I just threw together.

Has no sound as I haven't had time to work out how to beep yet.

Just download and unpack it to a directory and open a terminal in that directory then type:

./timer.tcl
Attachments
PTimer.tar.gz
(502 Bytes) Downloaded 257 times
Last edited by Ian on Sat 24 Nov 2007, 15:42, edited 4 times in total.

mcewanw
Posts: 3169
Joined: Thu 16 Aug 2007, 10:48
Contact:

#12 Post by mcewanw »

Ian

If you just modify the wee part of your program to use muggins' /usr/local/bin/alarm.wav file like follows, your alarm gives sound...

Code: Select all

while {$t<$tm} { 
		     
incr t
exec sleep 1
}
         
exec play /usr/local/bin/alarm.wav
of course, you can now put alarm.wav in some other folder instead.

Might be best to put a gtkdialog3 version together though, since I think the newest Puppy (Dingo) doesn't have a tcl interpreter (but I haven't had time to download and try it so could be wrong)

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#13 Post by Ian »

Thanks for that.
Here are a couple of things to add:

catch {exec play /usr/local/bin/alarm.wav}

this to catch the errors and:

after line 19 add:

focus .top.tmr

this to save a mouse click :-)

I'll upgrade it on the post.

If I get time I might try and tidy it up a bit.

T_B
Posts: 160
Joined: Sun 08 Apr 2007, 12:54

#14 Post by T_B »

The version of Ian works very good with the adjustment of mcewanw. I think I will be able to adjust the tcl script myself to be perfect for my needs.

Thanks!

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#15 Post by BarryK »

That's right, no Tcl/Tk in Dingo. It would be easy enough to implement in Bash, with a GINS or Xdialog or Gtkdialog GUI.
I have been deliberating whether to put in PuppyBasic or GtkBasic -- probably the latter, and that would also give you a GUI.

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#16 Post by Ian »

Here's a dialog version of the timer. This time type in ./eggtmr.sh.
Attachments
XEgtmr.tar.gz
Xdialog version, type in Xeggtmr.sh :-)
(430 Bytes) Downloaded 255 times
Egtmr.tar.gz
Dialog version of timer, same instructions as before.
(426 Bytes) Downloaded 272 times
Last edited by Ian on Sun 25 Nov 2007, 01:00, edited 1 time in total.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#17 Post by MU »


muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#18 Post by muggins »

http://www.ne.jp/asahi/kazuo/sasagawa/eng.html

I thought I'd upload another tcl clock, with timer, as I quite like this little analogue clock. I replaced the original's bell.wav with alarm.wav, as I preferred the sound.

Just extract to /, and run by entering tkclock on the commandline. To use as an alarm you have to set the alarm's settings to wave.

Also, getting countdown.tcl to use the file /usr/share/audio/alarm.wav was simply adding a line at the start: cd /usr/share/audio
Attachments
tkclock1.jpg
(18.1 KiB) Downloaded 271 times
tkclock.zip
(13.15 KiB) Downloaded 263 times

Post Reply