LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-20-2013, 04:36 PM   #1
bryanh
LQ Newbie
 
Registered: Feb 2013
Location: Dallas, TX
Distribution: Use Fedora now KDE
Posts: 4

Rep: Reputation: Disabled
Dialog gauge question


I already wrote a script using barcode, ps2pdf, pdftk and of course bash to create a pdf document for each record in a database file.

so basically the script goes [ short jest here ]

for idnum in `cat database`
do
barcode -b $idnum -o $idnum.ps # barcode program takes value makes
# ps file of value [scannable barcode]

ps2pdf $idnum.ps $idnum.pdf # converts ps to pdf file

pdftk template.pdf background $idnum.pdf cat output vendor_$idnum.pdf

# the pdftk background takes a template and I merge my barcode pdf to
# it so I can get a company logo, etc...

done
pdftk vendor*.pdf cat output master_vendor.pdf #make master pdf of
# all database records

rm -rf vendor*.pdf

what I would like to do is show a dialog gauge after each record in database is converted to vendor_$idnum.pdf

I am new at programming and got my gauge to work by saying something like last_record=`wc -l < database` and count=1 and made a loop function to progress thru but dumb me only gets dialog gauge to run its own loop and not progress thru the steps above I want to complete

Can anyone help? Also point me to where I could learn more about dialog-seen examples but for me to learn I need alot of examples-
more than one example program to sink into my brain...
 
Old 02-20-2013, 09:54 PM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,170
Blog Entries: 10

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
Quote:
Originally Posted by bryanh View Post
what I would like to do is show a dialog gauge after each record in database is converted to vendor_$idnum.pdf
...
Can anyone help? Also point me to where I could learn more about dialog-seen examples but for me to learn I need alot of examples-
more than one example program to sink into my brain...
If you know how programming control works, this real example may help.

It uses Yad (yet another dialog)
YAD is a program that will display GTK+ dialogs (GUI'fied dialogs)

Code:
#!/bin/bash
################################################################
# Name:               AWS SnapsCount
# Version:            1310054340
# Author:             jj_of_c9
# Date:                Thu Jul 07, 2011
# Requirements:        yad,ec2-api-tools
# Description:        Retrieves AWS Snapshots and counts them.
################################################################
export EC2_HOME=/edit/me
#Local date/time stamp
var1=`date`

yad --image=/home/jj/Documents/cirrhus9/Legal/cirrhus9_logo_blue.png --no-buttons --undecorated --skip-taskbar --timeout=2
function do_work()
{
var3=`echo -n "FTB Snapshots="$(/home/jj/Bin/ec2/bin/ec2-describe-snapshots -K /home/jj/.ssh/domain.com/pem/pk-32CHARACTERS.pem -C /home/jj/.ssh/domain.com/pem/cert-32CHARACTERS.pem --region us-west-1 | sort -r -k 5 | wc -l)`
}

touch /tmp/$$
( ( echo 1 ; while [ -f /tmp/$$ ] ; do sleep 1 ; done ; echo 100 ) | yad --progress --pulsate --auto-close --text="Counting Snapshots..." --width=150 --title="" --undecorated --no-buttons) & do_work
rm /tmp/$$

#output
echo -e "$var1\n$var3"| yad --text-info --show-uri --width=300 --height=265 --center --name="EC2 Snapshots" --window-icon="/home/jj/Documents/favicon.ico" --button=Done
Basically, write a /tmp/$$ and then process the work with do_work() function.
When that's done, remove /tmp/$$


"5) Building a Gauge"
http://mywiki.wooledge.org/BashFAQ/044
http://mywiki.wooledge.org/BashFAQ/040

should get you started, I hope.

Good luck!

subscribed with interest...

JJ

Last edited by Habitual; 02-20-2013 at 09:58 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use --gauge in dialog ashburn Linux - Newbie 1 08-15-2012 09:15 AM
Creating a gauge with dialog for an dd operation bcnx Linux - General 5 09-22-2010 03:35 AM
Need help with dialog(Xdialog) --gauge option zackarya Programming 7 09-02-2010 04:25 AM
dialog bash gauge wget question... DjRakso Linux - Newbie 1 12-19-2007 04:57 PM
Using dialog --gauge to display download percentage from wget mentallysilent Programming 2 08-17-2006 03:55 AM


All times are GMT -5. The time now is 04:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration