DefaultPrinter

(Engine-Level Function)

Description: Returns the Windows™ default printer.
Returns: Handle
Usage: Script Only.
Function Groups: Printer
Related to:

Redirect

Format: DefaultPrinter()
Parameters:

None 

Comments:

This function is used primarily in conjunction with the Redirect statement, which permanently redirects the resources of the system. The only way to return to the original default printer without knowing its source in advance is by using this function as illustrated in the "Example" section.

Example:

  If MatchKeys(2, "p") { When letter "p" is pressed };
  [
    Str1 = DefaultPrinter() { Store the default printer }; 
    Redirect("DEF:", newPrinter) { Select different printer }; 
    PrtScrn() { Output screen to printer }; 
    Redirect("DEF:", Str1) { Restore original printer }; 
  ]

In this script, the default printer is saved before redirecting printing to another printer. This allows the original printer to be restored as the default when the custom printing is concluded.