Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Printer.SetPrinter
Switches printer or changes paper setup.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Printer | 6.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | ❌ No |
MBS( "Printer.SetPrinter"; Printer { ; CloseDialog; Paper Format; Paper Orientation; Paper Source } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Printer | The printer name to set. Must not match exactly, just the first letters. Leave empty to not change printer. |
"Brother" | |
CloseDialog | Whether to close print dialog. Pass 1 to close or 0 to not close. Pass 2 to press cancel button in case you just want to learn the options. |
1 | Optional |
Paper Format | Available in MBS FileMaker Plugin 10.0 or newer. The name of the paper format. Leave empty to not change. |
"A4" | Optional |
Paper Orientation | Available in MBS FileMaker Plugin 10.0 or newer. The paper orientation. Pass portrait or landscape. Empty value leaves setting as is. |
"landscape" | Optional |
Paper Source | Available in MBS FileMaker Plugin 10.0 or newer. The paper source. Pass name of setting. Name doesn't need to match exactly, just first letters. So you can pass "Man" für Manual (English) and Manuell (German). |
"Man" | Optional |
Result
Returns OK or error.
Description
Switches printer or changes paper setup.Shows the printer setup dialog and switches target printer or paper settings.
Please use a script pause of at least a second after calling this function to let Windows show the dialogs.
This function requires the permissions for current user to print and the print menu commands be available via menu as we trigger those to set printer.
You can later call Print.ErrorLog to detect errors. If Windows ever change dialogs, features may no longer work.
For Mac, please check PrintDialog.Install function.
Version 10.0 of MBS Plugin adds three new parameters paper format, orientation and source. And the plugin fills the internal lists for paper sources, formats and printers.
Original source code sponsored by schubec.com
http://www.schubec.com
Examples
Switch printer:
Set Variable [$r; Value:MBS("Printer.SetPrinter"; Printer Dialog::Printer Name)]
Pause/Resume Script [Duration (seconds): 2]
Show Custom Dialog ["Result"; MBS("Printer.ErrorLog")]
Change paper to Letter in landscape:
MBS( "Printer.SetPrinter"; ""; 0; "Letter"; "landscape")
See also
- PageSetupDialog.Enable
- PageSetupDialog.Install
- PrintDialog.Install
- Printer.CurrentPaperFormat
- Printer.CurrentPaperSource
- Printer.CurrentPrinterName
- Printer.ErrorLog
- Printer.PaperFormats
- Printer.PaperSources
- Printer.PrinterNames
Release notes
- Version 10.0
- Added more options to Printer.SetPrinter function to set paper format, orientation and source.
Example Databases
Blog Entries
- MBS @ FMTraining.TV - Printing in FileMaker with the MonkeyBread Plug-in
- Control printing in FileMaker with MBS Plugin on Windows
- Neues MBS FileMaker Plugin 10.0
- MBS FileMaker Plugin 10.0 - More than 6000 Functions In One Plugin
- MBS FileMaker Plugin, version 9.6pr1
- MBS FileMaker Plugin, version 6.5pr7
- Printer Switch for Windows with MBS FileMaker Plugin
This function is free to use.
Created 14th November 2016, last changed 1st December 2020