Traditionally, applications are written for either the command line or for a graphical user interface - but not both. That difference is reflected in the choice one has in development products like Visual Studio.NET between a console or Windows application.
Both types of application can be used to run normal Windows programs, however, if built as a console application, an undesirable black command prompt console window will appear as the application runs.

Ideally, a script could be run both as a console and windows application without the black console window appearing.
Additionally, it can be extremely useful if an application (script) could be run without any interaction with the user. This use is often described as quiet, silent or unattended.
If a single script could handle all three scenarios, it would be extremely versatile.
The GUI/Cui/Unattended (GCU) design pattern provides that in conjunction with the
Determining the Scenario
How can a script determine which of the three scenarios the user intends? Your script can do so according to the following:-
If the /unattended option is specified, it is an unattended script.
If program arguments have been specified, it is a console application.
If no arguments have been supplied, it is a Windows application.
One should note, that the GCU pattern is not necessarily applicable to all scripts. It only applies to a script which requires user input.
Alintex Script provides a support class which you can use in your script to help determine each of those cases. Class ScriptTarget has three properties - IsUnattended, IsConsole and IsWindows - which correspond to each of the scenarios.
Additionally, a support class, which allows for the gathering of user supplied information (arguments) in the case of a Windows application, is provided. InputBox has a static/shared method which can be used to display a dialog such as that shown below.

Using the Pattern
While, the pattern can be implemented a number of ways, a typical script which handled all three scenarios might be implemented in pseudocode as follows.
if the user has indicated that this script is to be run unattended
perform unattended processing
or else if there are no command line arguments
this script is intended to present a Windows interface
present a dialog to gather required arguments from the user
perform processing based on the dialog results
provide output using a Window
or else if there are command line arguments
this script is a command line (console) script
perform processing
provide output to the console
Please note that a real life implementation would probably seek to consolidate the processing in one place, rather than duplicate the processing code in all three sections. The way the pattern is show above is provided for clarity. One might also omit one of the sections such as unattended, if inapplicable to a particular script.
How would one convert the pseudocode above into real code? See the examples supplied below. Please note that the Process method in the script code represents some arbitrary processing, and error handling is omitted for brevity.
[VB.NET]
#region "Script"
if ScriptTarget.IsUnattended then
' perform processing here if the script is to run unattended
' no errors or results will be visually reported
ScriptHost.WriteEventLog(args.Process())
else if ScriptTarget.IsWindows then
' no arguments provided on the command line so prompt for input with a dialog
' InputBox is part of the AlintexScript namespace.
args = result.Split(","c)
MessageBox.Show(args.Process())
else if ScriptTarget.IsConsole then
' arguments provided on the command line so output to the console
print(args.Process())
end if
#end region
[C#]
#region Script
if (ScriptTarget.IsUnattended)
{
// perform processing here if the script is to run unattended (/unattended)
// no errors or results will be visually reported
ScriptHost.WriteEventLog(args.Process())
}
else if (ScriptTarget.IsWindows)
{
// no arguments provided on the command line so prompt for input
// InputBox is part of the AlintexScript namespace.
string result = InputBox.Show("Enter arguments");
MessageBox.Show(args.Process());
}
else if (ScriptTarget.IsConsole)
{
// arguments provided on the command line so output to the console
print(args.Process);
}
#endregion
[Java (J#)]
#region Script
if (ScriptTarget.get_IsUnattended())
{
// perform processing here if the script is to run unattended (/unattended)
// no errors or results will be visually reported
ScriptHost.WriteEventLog(args.Process());
}
else if (ScriptTarget.get_IsWindows())
{
// no arguments provided on the command line so prompt for input
// InputBox is part of the AlintexScript namespace.
StringTokenizer st = new StringTokenizer(result, ",");
String array[] = new String[st.countTokens()];
for( int i = 0; i < array.length; i++ )
array[i] = st.nextToken();
MessageBox.Show(array.Process());
}
else if (ScriptTarget.get_IsConsole())
{
// arguments provided on the command line so output to the console
print(args.Process());
#endregion
[JScript.NET]
// get the arguments from the command line
var args : String[] = ScriptHost.Arguments;
if (ScriptTarget.IsUnattended)
{
// perform processing here if the script is to run unattended (/unattended)
// no errors or results will be visually reported
ScriptHost.WriteEventLog(args.Process())
}
{
// no arguments provided on the command line so prompt for input
// InputBox is part of the AlintexScript namespace.
result = InputBox.Show("Enter arguments");
args = result.Split(',');
MessageBox.Show(args.Process());
}
else if (ScriptTarget.IsConsole)
{
// arguments provided on the command line so output to the console
print(args.Process());
}
See also
script whatDay-gcu in the tutorial folder.