Hi folks,

I use following script:-

#!/bin/sh
# cd Linbread
TODAY=`date +"%m%d"`
DATA=`grep $TODAY linbread.dat`
HOUR=`date +"%H"`
if [ $HOUR -le 11 ]
	then TOD="Morning"
	elif [ $HOUR -ge 12 -a $HOUR -lt 18 ]
	then TOD="Afternoon"
	else
	TOD="Evening"
fi
echo $DATA | gawk -F"|" '{printf("%s\n\n%s",$2,$3)}' > $$tmp
fold -s -w60 $$tmp > $$tmp2
xmessage -timeout 300 -buttons Amen -title "Linbread - Good $TOD!  It's `date +"%A, %B %e, %Y"`"  -fn 9x15bold -bg SlateBlue -fg white -center -file $$tmp2
rm $$tmp $$tmp2
cd

to read a .dat file displaying a "Bible verse of The Day"


.dat :-

0101|"The LORD shall preserve thy going out and thy coming in from this time forth, and even for evermore."|Psalms 121:8
0102|"Verily, verily, I say unto you, He that heareth my word, and believeth on him that sent me, hath everlasting life, and shall not come into condemnation; but is passed from death unto life."|John 5:24
...
0201|"And be not conformed to this world: but be ye transformed by the renewing of your mind, that ye may prove what is that good, and acceptable, and perfect will of God."|Romans 12:2
0202|"Love not the world, neither the things that are in the world. If any man love the world, the love of the Father is not in him...And the world passeth away, and the lust thereof: but he that doeth the will of God abideth for ever."|1 John 2:15,17
....
...

It also works on leap year. The verse will repeat each year.


Now I want adding following function:-

- sound
When the window popup a song will play
- window frame
- Heading
Bible Verse of The Day
- to replace "OK" with "Amen".  On clicking "Amen" the window will close.
- adding "Thanks be to God" above "Amen" button
- an animated background

sound file .wav and background .gif are available. Please advise what shall I add to the script to do the job as expected. TIA


B.R.
satimis

Dani AI

Generated

already has the right idea by using an X dialog and a custom button name. The missing pieces can be added safely without rewriting the whole script: play the WAV asynchronously, append the “Thanks be to God” line to the message text (so it sits above the button), and run an animated GIF in a separate window behind the dialog. Use mktemp for temp files and a trap to clean up and stop background players so nothing is left running.

Example pieces to drop into the existing flow (adapt paths and variable names):

# play sound (fallback: paplay -> aplay)
if command -v paplay >/dev/null 2>&1; then
  paplay /path/to/song.wav &
  player=$!
elif command -v aplay >/dev/null 2>&1; then
  aplay -q /path/to/song.wav &
  player=$!
fi
# append the closing line so it appears above the button
printf "\n\nThanks be to God\n" >>"$messagefile"
# optional animated background (mpv or ImageMagick animate)
mpv --no-audio --loop-file=inf --really-quiet /path/to/anim.gif &
bgpid=$!

# show blocking dialog (zenity example uses Amen for OK)
zenity --info --title="Bible Verse of the Day" --text="$(cat "$messagefile")" --ok-label="Amen"
# cleanup handled by trap below

Always clean up temp files and kill background pids on exit:

trap 'kill "${player:-}" "${bgpid:-}" 2>/dev/null; rm -f "$messagefile" "$tmpfile" ' EXIT

Troubleshooting notes: confirm availability of aplay, paplay, mpv, or zenity on the target machine and use command -v checks. The GUI toolkit used (xmessage vs zenity/yad) determines how nicely you can style fonts and images; yad gives more control over layout but may not be installed. Ignore the unrelated reply by — it does not apply to this script.

We know that people use different software and tools to make their work flow easy and systematic. Also by project management software people can protect their important project data. Because security of project data is really necessary for everybody.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.