The following example shows an example dialog procedure.
Note: We do not recommend embedding passwords in command procedures. It is a potential security risk. This example serves to show only the principles behind DIALOG.
!
! This is an example dialog file. It may be ! invoked from the monitor interface using the ! command: ! ! DIALOG filename [system] ! ! ! ! The command connects to the console of the ! specified system or systems then sends the ! specified strings and awaits the specified ! responses as though it were a user typing on the ! connected console. ! ! Valid commands within a dialog file are UNLOCK, ! SEND and WAIT. They are described in the example ! below. Lines with a ! or # in the first ! character position are treated as comments. ! ! This example dialog logs a user into a OpenVMS ! system. ! ! The RATE command sets the interval the DIALOG waits ! between SEND commands. ! This allows systems that are not able to do flow ! control properly to work. ! Set the interval in this example to 5 seconds. RATE 5 ! ! The UNLOCK command forces the console upon which ! the dialog is being ! executed to be unlocked i.e. any other connected ! users are placed into ! read-only mode. This command should be executed ! before the first SEND command. Otherwise the SEND ! command will fail if another user is connected to ! the console. ! UNLOCK ! ! The SEND command sends the characters in quotes to ! the connected console ! as though a connected user had typed them. The send ! command always appends a carriage Enter to the ! quoted string. The command below is, therefore ! sending a carriage Enter to the OpenVMS console to ! get a username prompt up. ! SEND "" ! ! The WAIT command causes the dialog to wait until a ! specified regular expression is seen on the ! connected console line. The first argument is ! a timeout in seconds after which the WAIT will ! terminate with an error causing the whole dialog ! sequence to terminate as well. A timeout value ! of zero causes an indefinite wait. ! ! The quoted string is the awaited regular ! expression. In this case we are waiting for the ! username prompt from OpenVMS. ! WAIT 20 "Username:" ! ! Now send our username. ! SEND "SMITHJ" ! ! Await the password prompt. ! WAIT 20 "Password:" ! ! Send our password ! SEND "SMITHJS_PASSWORD" ! ! Await the DCL prompt - give it plenty of time to get logged in. ! WAIT 40 "$" ! ! Send any DCL commands you want executed here ! SEND "SHOW TIME" ! ! This particular dialog exits leaving you logged in to the console. !
|
Copyright © 2010 CA.
All rights reserved.
|
|