3.3.2.62 Type

Outputs a string to the specified device.

Contents

Syntax

type  option  string


Notes on Use

  • Double Quotes: If string contains any non-alphanumeric characters, such as punctuation marks or spaces, be sure to enclose it in double-quotation marks ("string"). This is especially important if string contains an equal sign (=), which, without enclosing double-quotes, will be interpreted as an assignment.
  • Special Characters: to specify non-printable characters or characters that are problematic during substitution, use the following table.
Escape Sequence Description
\n

New line

\r

Return

\d

Delete

\t

Tab

\u

Convert number to Unicode Char

\xhh

ASCII character; hh are hex digits


For example:

// Note: ASCII character 61 (hexadecimal 3D) is the equal sign.
// Output to a pop-up attention window the text "Test A"
// then on a new line type "Test B = Test C":
 
type -b "Test A \n Test B \x3d Test C";
type "\u2554====\u2557";//╔======╗


  • Message File as string: in addition to entering literal text for string, you can specify $[OMGfileName].Section.Title. This enables you to access a string title in a message file. For example:
// Output to a pop-up attention window the text in ''BadCalculation'',
// in the '''General''' section of the ORIGIN.OMG file.

Type -b $General.BadCalculation;
Notes:
  • The OMGfileName file extension must be OMG. The notation does not use extension.
  • The file must be in the appropriate language folder of the Localization folder.
  • If OMGfileName is not specified, the ORIGIN.OMG file is assumed.

Options

no option; Print string to the Script window

Syntax: type string

Print string to the Script window.

no option; string = ogsFileName; Print out the contents of the specified script file

Syntax: type ogsFileName

  • Print out the contents of the specified script file (.OGS) in the current directory to the Command (or Script) window.
  • Note that the file extension (.OGS) in ogsFileName may be omitted. The file name can be a full path. See also

Running and Debugging LabTalk Scripts: Debugging Tools.

-a; Open the Script Window and print string

Syntax: type -a string

Open the Script Window (if it is hidden or closed) and print string.

-b; Display string in a dialog box with an OK button

Syntax: type -b string

If the string is omitted, this command produces a beep.

-c; Display string in a dialog box with OK and Cancel buttons

Syntax: type -c string

  • Click Cancel to generate a break in the current script.
  • Click OK to continue running the script.

-gb; Type text to a file

Syntax: type -gb[e][f][n|r] filename

Send all subsequent type command strings to a file. End writing to file with type -ge.

  • e = empty file, if not specified then text is appended.
  • f = output to file only, no output to script window.
  • n = output LF for end-of-line.
  • r = output CR for end-of-line.

If neither n nor r is specified then output CRLF for end-of-line. Use type -l <text> to output with no end-of-line.

type -gb %Yjunk.txt;
type "some thing1";
type "some thing2";
type "some thing3";
type -ge;

-ge; End typing text to file

Syntax: type -ge

End writing to a text file. Used after type -gb.

//store some information to the active page storage area and type the tree to a file
page.tree.experiment.sample.RunNumber = 45;
page.tree.experiment.sample.Temperature = 273.8; 
type -gbef %Yjunk3.txt;
	page.tree.=;
type -ge;

-h; Hide the Script Window

Syntax: type -h

Hide the Script Window

-html; Create a dialog based on html code

Syntax: type -html "html str"

Create a dialog based on the html code.

type -html "file://Table.html";   // Execute the Table.html file, which is located in the User Files Folder
type -html "http://www.originlab.com";    // Open the website in a dialog
type -html "<button>Click</button>";  // Execute html command line to create an HTML button

-l; Print to the Script Window

Syntax: type -l string

Print to the Script Window, but disable the carriage return and linefeed for this text

-latex; create LaTeX object

Syntax: type -latex string

create LaTeX object

type -latex "y=3+\frac{2}{0.2\sqrt{\pi/2}}e^{-2\frac{(x-1)^2}{0.2^2}}"

-mb; Enable the use of attention messages

Syntax: type -mb n

  • n = 0, override messages, using a response of No/Cancel
  • n = 1 , override messages, using a response of Yes
  • Used in combination with -me; option -me turns attention messages back on
  • See Example #2 below

-me; Disable the use of attention messages

Syntax: type -me

  • The default setting is that attention messages are enabled.
  • If attention messages have been disabled using option -mb, re-enable them using -me.

-mg; Get the current value of an entry in the [ReminderMessages] section of origin.INI and assign it to a LabTalk variable

Syntax: type -mg stringoridofentry VarName

  • stringoridofentry is either the string keyword of the entry or the numerical id of the entry in the [ReminderMessages] section of origin.INI.
  • Only available after Origin 8/SR5
  • Use with option -ms.

-ms; Set the value of an entry in the [ReminderMessages] section of origin.INI

Syntax: type -ms stringoridofentry Value

  • stringoridofentry is either the string keyword of the entry or the numerical id of the entry in the [ReminderMessages] section of origin.INI.
  • Use a negative value to remove the entry (which will enable the corresponding reminder dialog box).
  • Only available after Origin 8/SR5
  • Typically, Value = 0 means the "No"-option whereas Value = 1 means the "Yes"-option in the corresponding reminder dialog box.
  • For use with option -mg: reset variable to prior status by letting Value=VarName.

-n; Display string in a dialog box with Yes and No buttons

Syntax: type -n string

  • Click No to generate a break in the current script.
  • Click Yes to continue running the script.

-o; Perform argument operation on the Script window

Syntax: type -o argument

Argument can be one of the following (you need only supply the first letter):

execute Turn Script Execution off. There is no script command to restore execution. User must select Edit : Script Execution in the Script window menu.
new Clears the contents of the Script window.
open [filename] Print the filename contents to the Script window. If filename is not specified, open the Open dialog box. Subsequent use of the File : Save menu option of the Script window or type -o save will write to this file until File : New is selected or type -o new is executed.
print Print the contents of the Script window to the current Windows default printer.
save [filename] Save the current Script window contents. If the open option was previously used and no filename is specified, then that file will be overwritten.
tab pixels Set the tab spacing to pixels pixels. The default value is 45 pixels. All tabs in the Script window will update immediately.
window title Change the title of the Script window to title. The change persists even if the Script window is hidden. Closing the Script window clears the change.

-q; Display string in the status bar

Syntax:type -q string

-qp n Enable or disable the arithmetic status messages that show the progress of calculations. n = 1 (enable) or (disable) n = 0.
-qs n Enable or disable the status bar. Enable (n = 1) or disable (n = 0) the status bar. When the status bar is disabled, the last message displays until the status bar is enabled again.

-s; Types string to a previously open Script window even if it has been hidden

Syntax:type -s string

Unlike the -a option, this command will not open a hidden Script window and it will do nothing if the Script window is closed.

-tb; Type a property of an object to an attention box

Syntax: type -tb object.property

-tn; Type a property of an object to a Yes/No dialog box

Syntax: type -tn object.property

-tq; Type a property of an object to the status bar

Syntax: type -tq object.property

-ty; Type a property of an object to a Yes/No/Cancel dialog box

Syntax: type -ty object.property

-v; Override escape sequence substitution

Syntax: type -v -option message

  • Override interpreting escape sequences so that \n is not recognized as New Line, \r is not recognized as Return, etc. (see the above note on "Specifying non-printable characters")
  • Use -v before (option) -b, -c, and -y to allow the use of file paths in message.
  • See the examples below.

-y; Display string in a dialog box with Yes, No and Cancel buttons

Syntax: type -y string

  • Click on the Yes button to set Origin's t variable to one.
  • Click on the No button to set t to zero.
  • Click on the Cancel button to generate a break in the current script.

Examples

Example #1: Simple text display

The following script displays the message "I'm busy right now" in the status bar.

type -q "I'm busy right now";

The next script displays the message "Here is some text, and here is some more" on one line in the Script window.

type -l "Here is some text";
// other code 
type ", and here is some more";

Example #2: Toggle the display of pop-up attention messages

The next two scripts illustrate use of the type -mb and type -me commands. In this example, you Append a project. Normally, a dialog opens that asks whether to Append to the current folder or to create a new folder. Such messages would normally stop a script until you responded to the message. With the type -mb command, you can override the dialog box.

// Begin override of messages, using a response of No/Cancel 
//- Do not create a folder
type -mb 0;
doc -a D:\SAMPLE.OPJ; // Append an OPJ
// End override of messages
type -me;
// Begin override of messages, using a response of Yes - Create a new folder
type -mb 1;
doc -a D:\SAMPLE.OPJ; // Append an OPJ
// End override of messages
type -me;

Example #3: Over-riding escape sequences

The next script prints "My file is stored in c:\temp\file1.opj." to the Script window.

Note: \t is not interpreted as a tab due to the use of the -v option. Remove the -v and try again to see the effect.

type -v "My file is stored in C:\temp\file1.opj.";

Example #4: Display text contained in a graph object

The last script displays the Bottom X Axis Title text from the active graph window in a dialog box with an OK button.

type -tb "XB.text";

See Also

Type, $() Substitution and its C formatting


Note: You can use Print (command) to print the output text in the Notes window.