YOUSEFUL / FILEMAKER

Youseful Print: FAQ, examples and tutorial

Learning center · Function reference

Use YsflPrint.fmx64 to inspect Windows printers, choose the default printer and manage driver settings. The tutorial needs an installed default printer and does not submit a print job.

FAQ

Can it silently save a PDF to a chosen filename? Not in this version. Selecting Microsoft Print to PDF does not bypass its filename prompt. The plug-in selects printers and settings; it does not implement a PDF export function.

Will every printer accept every setting? No. Query papers and trays for names supported by that driver. Drivers may adjust or ignore unsupported values; read the setting back after a change.

What does Save capture? The current default printer and that printer's driver settings. It does not snapshot every installed printer. If you alter a different printer's settings, preserve that printer separately as well.

Do changes affect only my current script? Driver defaults persist for the Windows user. Restore the saved state when the task finishes, including on an error path.

Examples

List installed printer names:

filemaker
YsflPr_ListPrinters

Result: one name per paragraph; the names depend on the workstation.

List papers for the current default printer:

filemaker
YsflPr_GetSetting ( YsflPr_GetDefault ; "papers" )

Result: driver-provided paper names, or an error if no usable default exists.

Tutorial

Standalone sample scripts: Printer settings.

Goal: temporarily select landscape on the current default printer, inspect the result, then restore the saved settings before displaying any message.

  1. Create a script named Youseful - Printer settings.
  2. Add these steps:
filemaker
Set Variable [ $saved ; Value: YsflPr_Save ]
If [ Left ( $saved ; 1 ) = "?" ]
    Show Custom Dialog [ "Cannot save settings" ; $saved ]
    Exit Script [ Text Result: $saved ]
End If
Set Variable [ $prepared ; Value: YsflPr_Prepare ( "" ; "orientation=landscape" ) ]
Set Variable [ $prepareError ; Value: YsflPr_LastError ]
Set Variable [ $prepareMessage ; Value: YsflPr_LastErrorText ]
If [ $prepareError = 0 ]
    Set Variable [ $orientation ; Value: YsflPr_GetSetting ( "" ; "orientation" ) ]
    Set Variable [ $readError ; Value: YsflPr_LastError ]
End If
Set Variable [ $restored ; Value: YsflPr_Restore ( $saved ) ]
If [ Left ( $restored ; 1 ) = "?" ]
    Show Custom Dialog [ "Restore failed" ; $restored ]
Else If [ $prepareError <> 0 ]
    Show Custom Dialog [ "Prepare failed" ; $prepareMessage ]
Else If [ $readError <> 0 ]
    Show Custom Dialog [ "Could not read orientation" ; $orientation ]
Else
    Show Custom Dialog [ "Driver reported" ; $orientation & " (original settings restored)" ]
End If
  1. Run it. A compatible driver reports landscape; the original settings should be restored afterward. No page is printed.

The empty printer name selects the current default. If you later insert a Print step, capture FileMaker's print error and still run Restore. Do not halt the script between Prepare and Restore.

Troubleshooting

Install/select a default printer if Save reports none. Use a supported paper or tray name exactly as returned by the driver. Queue cancellation is not needed for this exercise; CancelJobs purges a printer's queued jobs.