Pop up a dialog box from a shell script?

Pop up a dialog box from a shell script?

Post by bob desinge » Fri, 12 Apr 1996 04:00:00



What's the easiest way for me to pop up an error-message dialog box from
a shell script?  It doesn't have to be fancy; I just want to tell people
that a program doesn't exist any more.  Bonus points for Motif look and
feel.

This is for Solaris running CDE, so our options seem to be:
* dtksh
* Tk/Tcl
* an X11/Motif compiled application

I'd like to pick up something from the net, of course, or at least not
have to write it myself.  I could modify something that was freely
available, but if I have to write it from scratch it won't get written.

HP-UX has a program called xdialog that does what we need, but that's
only on HP-UX.  Its sources aren't available anywhere that I could find.

The cheap workaround is to pop up an xterm with a shell behind it that
blats the message to stdout, then exits after the user types Return.
The script is attached in shar format (encased in MIME).

-- bd

[ t 1K ]
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#               "End of shell archive."
# Contents:  popup

PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'popup' -a "${1}" != "-c" ; then
  echo shar: Will not clobber existing file \"'popup'\"
else
echo shar: Extracting \"'popup'\" \(1022 characters\)
sed "s/^X//" >'popup' <<'END_OF_FILE'
X#! /bin/ksh
X
X# Cheap and cheerful script to pop up an "error dialog box",
X# to use the term loosely.
X
X# get the offending program name into the dialog box
Xcat >/tmp/popup.$$ <<\EOF
X#! /bin/ksh
X: pop up a pseudo-dialog-box and return an error
XTERM=xterm        PATH=/bin:/usr/bin:$PATH
Xtput bold
Xecho "                             W a r n i n g"
Xtput rmso
X
Xcat <<EOM
X
XThe program $1 does not work under Solaris.
XPlease remove it from your ~/.mailrc file.
X
XThe line in your ~/.mailrc probably looks like this:
X    set sendmail='$1'
X
XTo comment it out instead of deleting it, use the \`#' character:
X    # set sendmail='$1'
X
XThen, after editing, exit your mail-reading program and restart it.
X
X
XEOM
X
Xread junk?"Press Return after you have done this:  "
Xexit 0
XEOF
X
Xchmod +x /tmp/popup.$$
Xxterm -title "/usr/local/bin/signmymail is old" -geometry 80x15 \
X       -font screen16 -bg Navy -fg PapayaWhip -ms Navy -cr Red \
X       -e /tmp/popup.$$ /usr/local/bin/signmymail
Xrm -f /tmp/popup.$$
X
X# inform dtmail that we failed so that it will inform the user
Xexit 99
END_OF_FILE
if test 1022 -ne `wc -c <'popup'`; then
    echo shar: \"'popup'\" unpacked with wrong size!
fi
chmod +x 'popup'
# end of 'popup'
fi
echo shar: End of shell archive.
exit 0

 
 
 

Pop up a dialog box from a shell script?

Post by Corne Beers » Sat, 13 Apr 1996 04:00:00


Bob

I used xterm for displaying the message an application is moved:

#!/bin/sh
appl_temp=/tmp/`basename $0`.$$
cat > ${appl_temp} << EndOfText
Sorry for you
$0 is moved to an other directory.

        - do a rehash to rescan the path
        - do a restart workspace manager for fresh menus
        - logout and login to refresh everything
        - try the /appl directories for the new location
                and adapt your aliasses, menus or other invokations
        - or call the helpdesk.

^L

EndOfText
xterm -e more ${appl_temp}
rm ${appl_temp}

--
My employer only sponsors the bandwidth, not my opinions
C.J.P. Beerse                          | Alcatel Telecom Nederland bv

tel:+31-70 3079108 fax:+31-70 3079 191 | NL-2280 GG  Rijswijk

 
 
 

1. Forcing to have txt filetypes pop up a save dialog box

Can anyone be able to help me how this task can be accomplished?

On my unix server running Netscape FastTrack Web Server, I have a
script that creates a "filename.txt" file on the fly.  This file is
then presented to the client's browser as an ftp link as follows:

echo "<Li><A
HREF=ftp://www.domain.com/${impfile}.txt>${impfile}.txt</A><br>"

Because this file has an extension of txt, the clients' browser
displays it on the browser rather than forcing a "save" dialog box to
save the file instead.

I know that this action can be modified on the clients'  web browser
under options , but I don't want to have to rely on them doing this.

I think I was told that the web server itself can force such an mime
action that overides the clients' browser.  If this can indeed be
done, can someone be so kind as to sharing me with  your suggestion?

Lastly, is the "save" dialog box can be forced to appear for "txt"
files by way of the server, can I also specify a default directory
with the "filename.txt" to be sent??

Thanx in advance for any help!!!!

Ray Sala

2. WfWG - internet via Linux

3. Dialog boxes for the shell

4. sendmail :s

5. Using dialogs in shell scripts

6. PCI for ethernet really necessary?

7. Help: How can a script stack (push and pop) shells?

8. Simple question about Performance ToolBox

9. how to retrieve message from a POP account in shell script?

10. Shell script POP equivalent!?

11. Shape Ups,Men's Shape Ups,Men's Skechers Shape Ups - new styles!

12. Pop-up dialog to X11 display from other program

13. handling SIGINT in shell scripts when executing another shell script.