![]() |
![]() |
![]() |
![]() |
The examples in the prior section show how to attach scripts to both the versions and issues program which have the potential of vetoing a user action. In such cases, when a veto occurs (by a before script returning a non-zero exit status), all the standard output from the script is saved, and eventually shown to the user through a window such as the one below.1
It's occasionally preferable to have the message back to the user appear in a nicer format. To accomplish this, instead of having the text caught as the standard output of the script, it should be written out to a specific temporary file. The filename itself is the concatenation of the Razor temporary directory ($RAZOR_TMP), the string "/Razor_notice.", the $RAZOR_PID and the exit status the script will be returning. If this file is present, the contents will be caught by the program and placed in a notice.
For example, working with the script in the prior section, if we replaced the echo statements as follows...
NOTICE_FILE=$RAZOR_TMP/Razor_notice.$RAZOR_PID.1 echo "Sorry, but you're not allowed to set" >> $NOTICE_FILE echo "an issue to be high priority." >> $NOTICE_FILE
... then the display presented to the user will have a much more concise appearance.
As a general rule, this method for instructing the user is preferred. There are situations, however, where you may prefer to use the default behavior, such as when the instructions and comments back to the user are particularly long and detailed.
There may be occasions within scripts that it is desirable to ask the user something, get the answer, and make an intelligent decision based on the response. The program rz_notice will display an X window, with configurable text, buttons, location, window title, and more. Usage is...
rz_notice [-center] [-button <name>[:<return code>]] \ [-field <name>] [-default <name>] [-text <string>] \ [-file <file>] [-title <string>]
Field values entered are sent to standard out in the form:
<field name>="<value>"
rz_notice -center \ -title "Razor notice" \ -text "Enter the value for:" -field "Due_date" \ -button "Set":11 -button "Unknown":22
and assuming the user entered "1/1/1999" and clicked "Set" would generate this...
Due_date="1/1/1999"
NOTE: The good news is this cool rz_notice can really enhance your scripts with interactive inputs from your users. The bad news is it is only available for UNIX, non-remote clients.
![]() |
![]() |
![]() |
![]() |
(Part 10 of 13 for this section) (Generated 09/13/99 at 18:14:47) |
Copyright Tower Concepts http://www.tower.com Voice: 315-363-8000 Fax: 315-363-7488 support@tower.com sales@tower.com |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |