PrinterSwitch 2: Overview of example scripts

From myFMbutler wiki
Jump to: navigation, search

Main Page > PrinterSwitch 2 > Example scripts

Contents

Introduction

Our example files also include a couple of sample scripts that allow you to get started quickly with PrinterSwitch. Most of these scripts have comments that should help you get started, but here’s a little more information about what they do:

Basic Example Scripts

  • rebuild printer list

This script will set the PrinterNames field with an up-to-date list of printer names.

  • print_to_printer_by_printer_name

In this script, just replace the value “your_printer_name_here” with your own printer name. Note: printer names are case sensitive.

  • register_PrinterSwitch_for_current_session

This is an example script that allows you to register the plugin for the current FileMaker session with the license information obtained from myFMbutler.com: Name - registration code - number of users - license type (please note that these fields are case sensitive). To use this script, just substitute the place holders with the correct registration information. A second script allows control over displaying the ‘demo’ dialog at startup.

  • register_PrinterSwitch_and_save_reg_info

This script registers the plugin, but also saves its registration information beyond the current session. To use this script, just substitute the place holders with the correct registration information. Note: the ‘register’ function can only be used with the Developer version of PrinterSwitch.


PDF Example Script

  • print_to_PDF_and_set_filename

Creates a PDF on your desktop (Mac), or in the Windows temp directory.

On Mac OS:

- Replace the value “your_printer_name_here” with your own printer name

- Change the value “your_PDF_name_here” to select a name for your PDF.

On Windows:

- Change the value “your_PDF_name_here” to select a name for your PDF.


Capture-Restore Example Scripts

  • Add new printer settings

Shows how to save print setup information using the PrSw_PrintSetup (“capture”) function. Because of the different nature of the printing engine on Mac OS X and on Windows platforms, there is a difference in how to capture the settings. On Mac OS X, the use of the function PrSw_PrintDialog ("macdialog") is required before capturing. Please refer to the example scripts for more details.

  • Print with restored printer (no dialog)

Shows how to restore setup information using the PrSw_PrintSetup (“restore|...”) function. Because of the different nature of the printing engine on Mac OS X and on Windows platforms, there is a difference in how to print with restored settings. On Windows, you need to replace the normal Print [No dialog] script steps by the following three script steps: PrSw_PrintDialog("disable" ) - Print [] - PrSw_PrintDialog("enable") Please refer to the example scripts for more details.

Personal tools