MBS FileMaker Plugin Example Databases

Pictures to PDF

All examples are included with download of MBS FileMaker Plugin.

Pictures to PDF.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts7
Value Lists0
Custom Functions1
Custom Menus0
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
PDF Testing
3 fields defined, 1 record
PDF Testing

Fields

Table Name: PDF Testing - 3 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
PDFContainerNormal, BinaryAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
      FolderPathNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: English
          FileListNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: English

              Layout Objects: PDF Testing

              Regular Fields

              Field Name: PDF Testing::PDFContainer
              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
              • Top: 91 pt
              • Left: 30 pt
              • Bottom: 645 pt
              • Right: 436 pt
              • Anchoring: Left, Top
              Field Format:
              • Edit Box
              • Optimized for interactive content
              Field Behavior:
              • Allow field to be entered: In Find mode, In Browse mode
              • Touch keyboard type: Default for Data Type
              • Go to next field using: Tab key
              No

              Field Name: PDF Testing::FolderPath
              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
              • Top: 29 pt
              • Left: 30 pt
              • Bottom: 50 pt
              • Right: 436 pt
              • Anchoring: Left, Top
              Field Format:
              • Edit Box
              Field Behavior:
              • Allow field to be entered: In Find mode, In Browse mode
              • Touch keyboard type: Default for Data Type
              • Go to next field using: Tab key
              Yes

              Field Name: PDF Testing::FileList
              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
              • Top: 91 pt
              • Left: 477 pt
              • Bottom: 495 pt
              • Right: 731 pt
              • Anchoring: Left, Top
              Field Format:
              • Edit Box
              Field Behavior:
              • Allow field to be entered: In Find mode, In Browse mode
              • Touch keyboard type: Default for Data Type
              • Go to next field using: Tab key
              Yes

              Buttons

              Button PropertiesCoordinatesScript/Script Step
                Type:
              • Text: Select Folder
                Additional Properties:
              • Change to hand cursor over button
              • Top: 28 pt
              • Left: 744 pt
              • Bottom: 50 pt
              • Right: 851 pt
              • Anchoring: Left, Top
              Perform Script [ “Select Scan Folder” ]

              Scripts:


              Button PropertiesCoordinatesScript/Script Step
                Type:
              • Text: Scan Pages (Optional)
                Additional Properties:
              • Change to hand cursor over button
              • Top: 69 pt
              • Left: 744 pt
              • Bottom: 105 pt
              • Right: 851 pt
              • Anchoring: Left, Top
              Perform Script [ “Scan Document” ]

              Scripts:


              Button PropertiesCoordinatesScript/Script Step
                Type:
              • Text: List Files
                Additional Properties:
              • Change to hand cursor over button
              • Top: 124 pt
              • Left: 744 pt
              • Bottom: 146 pt
              • Right: 851 pt
              • Anchoring: Left, Top
              Perform Script [ “List Files” ]

              Scripts:


              Button PropertiesCoordinatesScript/Script Step
                Type:
              • Text: Create PDF
                Additional Properties:
              • Change to hand cursor over button
              • Top: 165 pt
              • Left: 744 pt
              • Bottom: 187 pt
              • Right: 851 pt
              • Anchoring: Left, Top
              Perform Script [ “Image to PDF using PDFKit” ]

              Scripts:


              Script Hierarchy

              Select Scan Folder
              Scan Document
              List Files
              Image to PDF using PDFKit
              Clear
              Init DynaPDF
              Image to PDF using DynaPDF

              Next Script: [Scan Document]
              Script NameSelect Scan Folder
              Run script with full access privilegesOff
              Include In MenuYes
              Layouts that use this script
              Scripts that use this script
                Script Definition
                Script Steps
                • # Reset the FileDialog otherwise it will not appear the second time
                • Set Variable [ $Error; Value:MBS("FileDialog.Reset") ]
                • # Select the desired folder
                • Set Variable [ $Error; Value:MBS("FileDialog.SelectFolderDialog") ]
                • # Show the selected path to the chosen folder
                • Set Field [ PDF Testing::FolderPath; MBS("FileDialog.GetPath";0) ]
                • #List files in that folder
                • Set Field [ PDF Testing::FileList; MBS("Files.List";PDF Testing::FolderPath) ]
                Fields used in this script
                Scripts used in this script
                  Layouts used in this script
                    Tables used in this script
                    Table occurrences used by this script
                    Custom Functions used by this script
                      Custom menu set used by this script

                        Previous Script: [Select Scan Folder]Next Script: [List Files]
                        Script NameScan Document
                        Run script with full access privilegesOff
                        Include In MenuYes
                        Layouts that use this script
                        Scripts that use this script
                          Script Definition
                          Script Steps
                          • # Initialize the Twain Functions for Scanning
                          • Set Variable [ $Error; Value:MBS("Twain.Initialize";"USA";"ENGLISH") ]
                          • # Select the desired forlder to store the scans and record it in the field
                          • Set Variable [ $FolderPath; Value:MBS("Twain.SetFolderPath";PDF Testing::FolderPath) ]
                          • # Set the folder path to use
                          • Set Variable [ $Error; Value:MBS("Twain.SetFolderPath";PDF Testing::FolderPath) ]
                          • # Enable the sheet feeder on the copier
                          • Set Variable [ $Error; Value:MBS("Twain.SetFeededEnabled";1) ]
                          • # Set the sheet feeder to automatically feed all the pages
                          • Set Variable [ $Error; Value:MBS("Twain.SetAutofeed";1) ]
                          • # Scan the pages into the chosen folder
                          • Set Variable [ $Error; Value:MBS("Twain.Acquire";1;1) ]
                          Fields used in this script
                          Scripts used in this script
                            Layouts used in this script
                              Tables used in this script
                              Table occurrences used by this script
                              Custom Functions used by this script
                                Custom menu set used by this script

                                  Previous Script: [Scan Document]Next Script: [Image to PDF using PDFKit]
                                  Script NameList Files
                                  Run script with full access privilegesOff
                                  Include In MenuYes
                                  Layouts that use this script
                                  Scripts that use this script
                                    Script Definition
                                    Script Steps
                                    • # Choose the folder to store scans and record it in the field
                                    • Set Field [ PDF Testing::FileList; MBS("Files.List";PDF Testing::FolderPath) ]
                                    Fields used in this script
                                    Scripts used in this script
                                      Layouts used in this script
                                        Tables used in this script
                                        Table occurrences used by this script
                                        Custom Functions used by this script
                                          Custom menu set used by this script

                                            Previous Script: [List Files]Next Script: [Clear]
                                            Script NameImage to PDF using PDFKit
                                            Run script with full access privilegesOff
                                            Include In MenuYes
                                            Layouts that use this script
                                            Scripts that use this script
                                              Script Definition
                                              Script Steps
                                              • If [ Get(SystemPlatform) = -2 ]
                                              • #on Windows, use DynaPDF
                                              • Perform Script [ “Image to PDF using DynaPDF” ]
                                              • Exit Script [ ]
                                              • End If
                                              • # Create a new blank PDF document in a reference $ref
                                              • Set Variable [ $ref; Value:MBS("PDFKit.NewPDFDocument") ]
                                              • # Set the loop counter to 1
                                              • Set Variable [ $n; Value:1 ]
                                              • Loop
                                              • # Get the $n value in the file list
                                              • Set Variable [ $FileName; Value:GetValue ( PDF Testing::FileList ; $n ) ]
                                              • # Test to be sure it is a jpeg file and not a dot file in mac or windows (other formats can be read)
                                              • If [ Right ( $FileName ; 4 ) = ".jpg" ]
                                              • Set Variable [ $path; Value:MBS( "Path.AddPathComponent"; PDF Testing::FolderPath; $FileName) ]
                                              • Set Variable [ $Image; Value:MBS("Files.ReadJPEG"; $path) ]
                                              • Set Variable [ $Error; Value:MBS("PDFKit.AddImagePage";$ref;$Image) ]
                                              • End If
                                              • # Exit the loop if we have the last image
                                              • Exit Loop If [ $FileName = "" ]
                                              • Set Variable [ $n; Value:$n+1 ]
                                              • End Loop
                                              • # Use the $ref to create a PDF in the desired container
                                              • Set Field [ PDF Testing::PDFContainer; MBS("PDFKit.GetPDFDocument";$ref) ]
                                              • # Clear the $ref memory
                                              • Set Variable [ $result; Value:MBS("PDFKit.Release";$ref) ]
                                              Fields used in this script
                                              Scripts used in this script
                                              Layouts used in this script
                                                Tables used in this script
                                                Table occurrences used by this script
                                                Custom Functions used by this script
                                                  Custom menu set used by this script

                                                    Previous Script: [Image to PDF using PDFKit]Next Script: [Init DynaPDF]
                                                    Script NameClear
                                                    Run script with full access privilegesOff
                                                    Include In MenuYes
                                                    Layouts that use this script
                                                      Scripts that use this script
                                                        Script Definition
                                                        Script Steps
                                                        • Set Field [ PDF Testing::PDFContainer; "" ]
                                                        • Set Field [ PDF Testing::FolderPath; "" ]
                                                        • Set Field [ PDF Testing::FileList; "" ]
                                                        Fields used in this script
                                                        Scripts used in this script
                                                          Layouts used in this script
                                                            Tables used in this script
                                                            Table occurrences used by this script
                                                            Custom Functions used by this script
                                                              Custom menu set used by this script

                                                                Previous Script: [Clear]Next Script: [Image to PDF using DynaPDF]
                                                                Script NameInit DynaPDF
                                                                Run script with full access privilegesOff
                                                                Include In MenuYes
                                                                Layouts that use this script
                                                                  Scripts that use this script
                                                                  Script Definition
                                                                  Script Steps
                                                                  • # This startup is called when file is open to register MBS plugin and DynaPDF plugin
                                                                  • # Need to insert your own MBS registration here.
                                                                  • # Need to insert your own DynaPDF registration here but it will work in demo mode
                                                                  • # This uses my Filemaker pro extensions folder so it works for all my solutions it can be almost anywhere
                                                                  • If [ Get(SystemPlatform) = -2 ]
                                                                  • Set Variable [ $Path; Value:"dynapdf.dll" ]
                                                                  • Else
                                                                  • Set Variable [ $Path; Value:"dynapdf.dylib" ]
                                                                  • End If
                                                                  • #Initialize DynaPDF
                                                                  • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path) ]
                                                                  • If [ $r ≠ "OK" ]
                                                                  • Show Custom Dialog [ Title: "DynaPDF failed to initialize"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                  • Else
                                                                  • Set Variable [ $$DynaPDFInited; Value:1 ]
                                                                  • End If
                                                                  Fields used in this script
                                                                    Scripts used in this script
                                                                      Layouts used in this script
                                                                        Tables used in this script
                                                                          Table occurrences used by this script
                                                                            Custom Functions used by this script
                                                                              Custom menu set used by this script

                                                                                Previous Script: [Init DynaPDF]
                                                                                Script NameImage to PDF using DynaPDF
                                                                                Run script with full access privilegesOff
                                                                                Include In MenuYes
                                                                                Layouts that use this script
                                                                                  Scripts that use this script
                                                                                  Script Definition
                                                                                  Script Steps
                                                                                  • If [ MBS("DynaPDF.IsInitialized") = 0 ]
                                                                                  • Perform Script [ “Init DynaPDF” ]
                                                                                  • End If
                                                                                  • # Set the loop counter to 1
                                                                                  • Set Variable [ $n; Value:1 ]
                                                                                  • # Start with a new PDF reference
                                                                                  • Set Variable [ $PDF; Value:MBS("DynaPDF.New") ]
                                                                                  • Set Variable [ $Error; Value:MBS("DynaPDF.SetCompressionLevel";$PDF;"max") ]
                                                                                  • Loop
                                                                                  • # Get the $n value in the file list
                                                                                  • Set Variable [ $FileName; Value:GetValue ( PDF Testing::FileList ; $n ) ]
                                                                                  • # If no more files then exit
                                                                                  • Exit Loop If [ $FileName = "" ]
                                                                                  • # Append a page to the PDF reference
                                                                                  • Set Variable [ $Error; Value:MBS("DynaPDF.AppendPage";$PDF) ]
                                                                                  • # Change the path including filename to a native path from a filemaker path
                                                                                  • Set Variable [ $FullPath; Value:MBS("Path.AddPathComponent"; PDF Testing::FolderPath; $Filename) ]
                                                                                  • # Get the width of the PDF page
                                                                                  • Set Variable [ $w; Value:MBS("DynaPDF.GetPageWidth"; $PDF) ]
                                                                                  • # Get the height of the PDF page
                                                                                  • Set Variable [ $h; Value:MBS("DynaPDF.GetPageHeight"; $PDF) ]
                                                                                  • # Insert the image at 0,0 and scale to the width and height calculated
                                                                                  • Set Variable [ $Error; Value:MBS("DynaPDF.InsertImageFile";$PDF;$FullPath;0;0;$w;$h;1) ]
                                                                                  • # Close the page so we can add the next page
                                                                                  • Set Variable [ $Error; Value:MBS("DynaPDF.EndPage";$PDF) ]
                                                                                  • # Exit the loop if we have the last image
                                                                                  • Set Variable [ $n; Value:$n+1 ]
                                                                                  • End Loop
                                                                                  • Set Field [ PDF Testing::PDFContainer; MBS("DynaPDF.Save";$PDF; "output.pdf";1) ]
                                                                                  • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $PDF) ]
                                                                                  Fields used in this script
                                                                                  Scripts used in this script
                                                                                  Layouts used in this script
                                                                                    Tables used in this script
                                                                                    Table occurrences used by this script
                                                                                    Custom Functions used by this script
                                                                                      Custom menu set used by this script

                                                                                        Custom Functions

                                                                                        Function NameParametersAvailabilityDefinitionIn Field DefinitionsIn Scripts
                                                                                        FilePathToURLFMFilePathAll accounts/* Convert from FileMaker filepath to URL Useful for using the result from Get(FilePath) and Get(TemporaryPath) in an Open URL or Web Viewer Examples (from / to): Case A: OS X, FileVault protected home folder, normal folder, network folder, e.g. ‘Hard Drive’ file:/Hard Drive/Desktop/fold & er/filepath.fp7 file:///Volumes/Hard Drive/Desktop/fold & er/filepath.fp7 Note Open URL fails for FileVault protected volumes under OS Ⅹ 10.4 Case B: Windows, UNC volume file://comp/share/fold & er/filepath.fp7 file:\\comp\share\fold & er\filepath.fp7 Case C: Windows, drive letter, e.g. ‘C’ file:/C:/Documents and Settings/Administrator/My Documents/fold & er/filepath.fp7 file:///C:/Documents and Settings/Administrator/My Documents/fold & er/filepath.fp7 Case X: OS Ⅹ, Get(TemporaryPath) /Amphe/private/var/tmp/folders/501/TemporaryItems/FileMaker/ file:///Volumes/Amphe/private/var/tmp/folders/501/TemporaryItems/FileMaker/ Case Y: Windows, Get(TemporaryPath) /C:/Documents and Settings/Administrator/Local Settings/Temp/ file:///C:/Documents and Settings/Administrator/Local Settings/Temp/ Author: 2006-11-07 Tom Robinson <http://www.tomrobinson.co.nz/> Change History: 2007-02-15 Tom Robinson Fix when running under OS Ⅹ Intel 2007-05-03 Tom Robinson Add UNC drive support Don’t encode spaces, web viewer seems to want them raw 2008-08-12 Tom Robinson Add support for Get(TemporaryPath) because FMI made that different from the others */ Case( Left(FMFilePath;1)="/" and Abs(Get(SystemPlatform))=1; /* (case x) */ "file:///Volumes"&FMFilePath; Left(FMFilePath;1)="/" and Get(SystemPlatform)=-2; /* (case y) */ "file://"&FMFilePath; Abs(Get(SystemPlatform))=1; /* -1=PPC Mac, 1=Intel Mac (undocumented) */ "file:///Volumes/"&Right(FMFilePath;Length(FMFilePath)-6); /* (case a) */ Get(SystemPlatform)=-2 and Left(fmfilepath;7)="file://"; /* Windows UNC drive */ "file:\\\\"&Substitute(Right(FMFilePath;Length(FMFilePath)-7);"/";"\\") /* (case b) */ ; /* Anything else */ "file:///"&Right(FMFilePath;Length(FMFilePath)-6)) /* (case c) */

                                                                                          Custom Menu Sets

                                                                                          Menu SetsMenusIn ScriptsIn LayoutsComments
                                                                                          [Standard FileMaker Menus]
                                                                                          • All Standard Menus

                                                                                          Download example: Pictures to PDF

                                                                                          Used functions:




                                                                                          Links
                                                                                          MBS FileMaker tutorial videos