Spawning a Child Window
'Tips for developers working within the Sysgem Enterprise Manager (SEM) environment'.
Spawning a child window in SEM:
To Initiate the Spawn Command from the Parent Window...
To spawn a new window from a menu option, code needs to be entered in the '(M) Pre-processing script' of the menu option in the main 'Pre-processing' script of the child window.
In the (M) Pre-processing script enter the following code:
#
# start another display window, passing along information
# extracted from the selected entries.
#
# @{{START_DISPLAY_SCRIPT
#
# Don't display the menu dialog.
#
# @{{MENU_OPTION_SILENT
#
print "\@{{START_DISPLAY_TITLE Child Example\n";
print "\@{{START_DISPLAY_NEW\n";
print "\@{{START_DISPLAY_TILED\n";
To Identify the Child Window...
The following comment is added to the main 'Pre-processing' script to identify the display window as the one required. The phrase "Child Example" is variable text to identify this particular window. The same text is used in the "\@{{START_DISPLAY_TITLE" output initiated by the (M) Pre-processing script in the menu option of the parent window.
#
# @{{AUTOSTART_DISPLAY_TITLE Child Example
#
To Pass Parameters from the Parent to the Child Window...
The following code added to the Parent menu option (in the (M) Pre-processing script) will pass parameters to the child window using the selected entry in the parent window.
print "\@{{START_DISPLAY_PARAM AA $SelectedEntry{0}{AA}\n";
print "\@{{START_DISPLAY_PARAM AB $SelectedEntry{0}{AB}\n";
This will cause the variables $INPUT_AA and $INPUT_AB to be defined in the Main Agent script of the child window when the display window has been spawned. In UNIX agent scripts - access the Korn shell variables as ${INPUT_AA} and ${INPUT_AB}. In VMS agent scripts - access the DCL logical names as INPUT_AA and INPUT_AB.
To Determine which Agents Should be Started in the Child Window...
The parent window can specify which agents should be used when starting the child window. For example, if the same agents should be used by the child as are selected in the parent window, then the following code needs to be added to the menu option of the parent and in the startip initialize script of the child:
In the (M) Pre-processing script of the parent menu option:
use Sysgem;
#
# Pass the server list to the child window via a temporary file
#
my $path = "";
Sysgem::GetApplicationPath("Sysgem AG", "TempFiles", $path);
my $FilePath = $path . "\\Temp_SV_File.txt";
my @servers = map $SelectedEntry{$_}{"SV"}, sort keys %SelectedEntry;
open(SVRS, "> $FilePath") || die "Can't open $FilePath - $!\n";
print SVRS join("\,", @servers) . "\n";
close(SVRS);
In the startup Initialize script of the child:
use Sysgem;
#
# Open the selected server list from the parent window via a temporary file
#
my $path = "";
Sysgem::GetApplicationPath("Sysgem AG", "TempFiles", $path);
my $FilePath = $path . "\\Temp_SV_File.txt";
open(SVRS, "< $FilePath") || die "Can't open $FilePath - $!\n";
my @servers = <SVRS>;
close(SRVS);
print "\@{{LOAD_SERVERS $servers[0]\n"; # to preselect the same servers as those selected in the parnet window
print "\@{{LOCK_SERVERS\n"; # to force these and only these to be used