Operating System - HP-UX
1833873 Members
2116 Online
110063 Solutions
New Discussion

Re: Doubt about frames in a shell script

 
SOLVED
Go to solution
LucianoCarvalho
Respected Contributor

Doubt about frames in a shell script

Hi guys,

Does anyone know how can I create frames (not the same, but as frames used in SAM) in a shell script?
Any tip will help.

thanks in advance.
3 REPLIES 3
Howard Palmer
Advisor

Re: Doubt about frames in a shell script

Depending on what exactly you want to do, you could use "dialog".

http://hpux.connect.org.uk/hppd/hpux/Shells/dialog-0.9b/

Basically lets you create pretty windows asking questions, input boxes, etc.

Otherwise you'll most likely need to use the ncurses libraries in C.


Sy
GTCI
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Doubt about frames in a shell script

Hi Luciano,

You can do it using 'tput' command. But that would be very tedious and you have to keep track of ROW and COLUMN positions.

I suggest you use tools that are already there. For ex.,

http://hpux.cs.utah.edu/hppd/hpux/Development/Tools/xenmenu-0.8b/

It can help you create text based menus.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: Doubt about frames in a shell script

Hi,

Just to give you some idea, I am posting this sample script. It will create a small box on the right hand top corner and prints numbers upto 10 while printing something on the main window.

clear

cols=$(tput cols)
startx=1
(( starty = $cols - 10 ))
endx=7
endy=$cols
midx=4
(( midy = $starty + 4 ))

x=$startx
y=$starty

while [ $x -le $endx ]
do
tput cup $x $starty
printf "."
tput cup $x $endy
printf "."
(( x = $x + 1 ))
done

while [ $y -le $endy ]
do
tput cup $startx $y
printf "."
tput cup $endx $y
printf "."
(( y = $y + 1 ))
done

I=0
while [ $I -le 12 ]
do
tput cup $midx $midy
printf "%2d" $I
tput cup 1 1
printf "Working on item $I"
sleep 1
(( I = $I + 1 ))
done

clear

-Sri
You may be disappointed if you fail, but you are doomed if you don't try