Difference between revisions of "Print"

From MultiCharts
Jump to navigation Jump to search
m (Reverted edits by 176.8.90.7 (talk) to last revision by JoshM)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
Sends one or more specified expressions to the PowerLanguage Editor Output Log or another output target, if specified. Any combination of string, true/false, numerical series, or numerical expressions can be specified.   
 
Sends one or more specified expressions to the PowerLanguage Editor Output Log or another output target, if specified. Any combination of string, true/false, numerical series, or numerical expressions can be specified.   
  
==== Usage ====
+
== Usage ==
 
<syntaxhighlight>Print([OutputTarget],Expression1,Expression2,etc.)</syntaxhighlight>
 
<syntaxhighlight>Print([OutputTarget],Expression1,Expression2,etc.)</syntaxhighlight>
  
Parameter inside the square brackets is optional  
+
The parameter inside the square brackets is optional.
  
==== Parameters ====
+
== Parameters ==  
[[OutputTarget]]  - an optional parameter; specifies an output target other then the PowerLanguage Editor Output Log; the parameter must be followed by a comma.
 
  
There are two optional output targets:
+
:'''OutputTarget'''  - an optional parameter; specifies an output target other then the PowerLanguage Editor Output Log; the parameter must be followed by a comma.
  
[[Printer]]
+
::There are two optional output targets:
Specifies the default printer as the output target.
 
  
[[File("PathFilename")]]
+
:::'''Printer''' - Specifies the default printer as the output target.
  
Where: [[PathFilename]] - a string expression specifying the path and filename
+
:::'''File("PathFilename")''' - Specifies an ASCII file as the output target; if the specified file does not exist, the file will be created.
  
Specifies an ASCII file as the output target; if the specified file does not exist, the file will be created.
+
::::Where:
  
If [[OutputTarget]]  is not specified, the output will be sent to the PowerLanguage Editor Output Log.  
+
:::::'''PathFilename''' - a string expression specifying the path and filename.  
  
[[Expression]] - a string, true/false, numerical series, or numerical expression; any number of valid expressions, separated by commas, can be used
+
::::If '''OutputTarget''' is not specified, the output will be sent to the PowerLanguage Editor Output Log.
  
 +
:'''Expression''' - a string, true/false, numerical series, or numerical expression. Any number of valid expressions, separated by commas, can be used.
  
A '''''string expression''''' must be enclosed in quotation marks:  
+
::A '''''string expression''''' must be enclosed in quotation marks. For example: Print("Hello World!");
[["String Expression"]]
 
  
 +
::A '''''numerical expression''''' can be formatted to specify the minimum number of characters, including the decimal point, and the number of decimal places to be used for the output:
  
A '''''numerical expression'''''  can be formatted to specify the minimum number of characters, including the decimal point, and the number of decimal places, to be used for the output:
+
:::'''Expression:C:D'''  
  
[[Expression:C:D]]
+
::::'''Where''':
  
Where: [[C]] - minimum number of characters  
+
:::::'''C''' - minimum number of characters,              
              
+
:::::'''D''' - number of decimal places.
[[D]] - number of decimal places  
 
  
 +
:::The default output format for a numerical expression is two decimal places and a minimum of seven characters.
 +
::::If the number of decimal places in the numerical expression is more than the specified number, the value will be will be rounded off to the specified number of decimal places.
 +
::::If the number of characters in the output is less than the specified minimum, leading spaces will be added to bring the output to the specified minimum value.
  
The default output format for a numerical expression is two decimal places and a minimum of seven characters.
+
== Examples ==
If the number of decimal places in the numerical expression is more than the specified number, the value will be will be rounded off to the specified number of decimal places.  
+
<syntaxhighlight>Print(.1);</syntaxhighlight>
  
If the number of characters in the output is less than the specified minimum, leading spaces will be added to bring the output to the specified minimum value.
+
Will print  0.10 in the PowerLanguage Editor Output Log, with three leading spaces inserted.
  
==== Example ====
+
<syntaxhighlight>Print(1.555555:6:3);</syntaxhighlight>
<syntaxhighlight>Print(.1);</syntaxhighlight> will print 0.10 in the PowerLanguage Editor Output Log, with three leading spaces inserted
+
Will print 1.556 in the PowerLanguage Editor Output Log, with one leading space inserted.
  
<syntaxhighlight>Print(1.555555:6:3);</syntaxhighlight> will print 1.556 in the PowerLanguage Editor Output Log, with one leading space inserted
+
<syntaxhighlight>Print(Printer,"Print Test");</syntaxhighlight>
 +
Will send the string expression "Print Test" to the default printer.
  
<syntaxhighlight>Print(Printer,"Print Test");</syntaxhighlight> will send the string expression "Print Test" to the default printer
+
<syntaxhighlight>Print(File("C:\test.txt"),CurrentDate,CurrentTime);</syntaxhighlight>
 +
Will save the output of [[CurrentDate]] and [[CurrentTime]] to the 'test.txt' file in the root directory of the C: drive.
  
<syntaxhighlight>Print(File("C:\test.txt"),CurrentDate,CurrentTime);</syntaxhighlight>  will save the output of [[CurrentDate]] and [[CurrentTime]] to the test.txt file in the root directory of the C: hard drive
 
  
 
+
[[Category:Output]]
[[Category:Math and Trig]]
 

Latest revision as of 13:11, 13 February 2012

Sends one or more specified expressions to the PowerLanguage Editor Output Log or another output target, if specified. Any combination of string, true/false, numerical series, or numerical expressions can be specified.

Usage

Print([OutputTarget],Expression1,Expression2,etc.)

The parameter inside the square brackets is optional.

Parameters

OutputTarget - an optional parameter; specifies an output target other then the PowerLanguage Editor Output Log; the parameter must be followed by a comma.
There are two optional output targets:
Printer - Specifies the default printer as the output target.
File("PathFilename") - Specifies an ASCII file as the output target; if the specified file does not exist, the file will be created.
Where:
PathFilename - a string expression specifying the path and filename.
If OutputTarget is not specified, the output will be sent to the PowerLanguage Editor Output Log.
Expression - a string, true/false, numerical series, or numerical expression. Any number of valid expressions, separated by commas, can be used.
A string expression must be enclosed in quotation marks. For example: Print("Hello World!");
A numerical expression can be formatted to specify the minimum number of characters, including the decimal point, and the number of decimal places to be used for the output:
Expression:C:D
Where:
C - minimum number of characters,
D - number of decimal places.
The default output format for a numerical expression is two decimal places and a minimum of seven characters.
If the number of decimal places in the numerical expression is more than the specified number, the value will be will be rounded off to the specified number of decimal places.
If the number of characters in the output is less than the specified minimum, leading spaces will be added to bring the output to the specified minimum value.

Examples

Print(.1);

Will print 0.10 in the PowerLanguage Editor Output Log, with three leading spaces inserted.

Print(1.555555:6:3);

Will print 1.556 in the PowerLanguage Editor Output Log, with one leading space inserted.

Print(Printer,"Print Test");

Will send the string expression "Print Test" to the default printer.

Print(File("C:\test.txt"),CurrentDate,CurrentTime);

Will save the output of CurrentDate and CurrentTime to the 'test.txt' file in the root directory of the C: drive.