MBS FileMaker Plugin Example Databases

Scan with WIA to PDF

All examples are included with download of MBS FileMaker Plugin.

Scan with WIA to PDF.fmp12

Overview
Tables2
Relationships0
Layouts3
Scripts15
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
WIA Scan
3 fields defined, 0 record
WIA Scan
Images
5 fields defined, 0 record
Images

Fields

Table Name: WIA Scan - 3 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
DeviceNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      KeyNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          ValueNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German

              Table Name: Images - 5 Fields
              Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
              NameNormal, TextAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                    ImageNormal, BinaryAuto-Enter:
                    • Allow editing
                    Validation:
                    • Only during data entry
                    Storage:
                    • Repetitions: 1
                        Gray ICC ProfileNormal, BinaryAuto-Enter:
                        • Allow editing
                        Validation:
                        • Only during data entry
                        Storage:
                        • Global
                        • Repetitions: 1
                              RGB ICC ProfileNormal, BinaryAuto-Enter:
                              • Allow editing
                              Validation:
                              • Only during data entry
                              Storage:
                              • Global
                              • Repetitions: 1
                                  CMYK ICC ProfileNormal, BinaryAuto-Enter:
                                  • Allow editing
                                  Validation:
                                  • Only during data entry
                                  Storage:
                                  • Global
                                  • Repetitions: 1

                                      Layout Objects: WIA Scan

                                      Regular Fields

                                      Field Name: WIA Scan::Device
                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                      • Top: 114 pt
                                      • Left: 4 pt
                                      • Bottom: 136 pt
                                      • Right: 134 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: WIA Scan::Key
                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                      • Top: 114 pt
                                      • Left: 142 pt
                                      • Bottom: 136 pt
                                      • Right: 395 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: WIA Scan::Value
                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                      • Top: 114 pt
                                      • Left: 403 pt
                                      • Bottom: 136 pt
                                      • Right: 827 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: Initialize
                                      • Top: 16 pt
                                      • Left: 9 pt
                                      • Bottom: 41 pt
                                      • Right: 124 pt
                                      • Anchoring: Left, Top
                                      Perform Script [ “Initialize” ]

                                      Scripts:


                                      Button PropertiesCoordinatesScript/Script Step
                                        Type:
                                      • Text: Select Device Dialog
                                      • Top: 16 pt
                                      • Left: 134 pt
                                      • Bottom: 41 pt
                                      • Right: 279 pt
                                      • Anchoring: Left, Top
                                      Perform Script [ “SelectDevice” ]

                                      Scripts:


                                      Button PropertiesCoordinatesScript/Script Step
                                        Type:
                                      • Text: List Devices
                                      • Top: 16 pt
                                      • Left: 290 pt
                                      • Bottom: 41 pt
                                      • Right: 423 pt
                                      • Anchoring: Left, Top
                                      Perform Script [ “List Devices” ]

                                      Scripts:


                                      Button PropertiesCoordinatesScript/Script Step
                                        Type:
                                      • Text: Current Device
                                      • Top: 16 pt
                                      • Left: 434 pt
                                      • Bottom: 41 pt
                                      • Right: 567 pt
                                      • Anchoring: Left, Top
                                      Perform Script [ “List Properties”; Parameter: "" ]

                                      Scripts:


                                      Button PropertiesCoordinatesScript/Script Step
                                        Type:
                                      • Text: Select Device
                                      • Top: 114 pt
                                      • Left: 845 pt
                                      • Bottom: 137 pt
                                      • Right: 960 pt
                                      • Anchoring: Left, Top
                                      Perform Script [ “Select Device” ]

                                      Scripts:


                                      Button PropertiesCoordinatesScript/Script Step
                                        Type:
                                      • Text: Scann to PDF
                                      • Top: 16 pt
                                      • Left: 589 pt
                                      • Bottom: 41 pt
                                      • Right: 722 pt
                                      • Anchoring: Left, Top
                                      Perform Script [ “Get Image Dialog”; Parameter: "" ]

                                      Scripts:


                                      Layout Objects: Images

                                      Regular Fields

                                      Field Name: Images::Name
                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                      • Top: 52 pt
                                      • Left: 138 pt
                                      • Bottom: 74 pt
                                      • Right: 391 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: Images::Image
                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                      • Top: 76 pt
                                      • Left: 138 pt
                                      • Bottom: 523 pt
                                      • Right: 1015 pt
                                      • Anchoring: Left and Right, Top and Bottom
                                      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
                                      No

                                      Field Name: Images::Gray ICC Profile
                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                      • Top: 544 pt
                                      • Left: 138 pt
                                      • Bottom: 572 pt
                                      • Right: 391 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
                                      No

                                      Field Name: Images::RGB ICC Profile
                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                      • Top: 573 pt
                                      • Left: 138 pt
                                      • Bottom: 601 pt
                                      • Right: 391 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
                                      No

                                      Field Name: Images::CMYK ICC Profile
                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                      • Top: 601 pt
                                      • Left: 138 pt
                                      • Bottom: 629 pt
                                      • Right: 391 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
                                      No

                                      Buttons

                                      Button PropertiesCoordinatesScript/Script Step
                                        Type:
                                      • Text: Back
                                      • Top: 6 pt
                                      • Left: 39 pt
                                      • Bottom: 36 pt
                                      • Right: 189 pt
                                      • Anchoring: Left, Top
                                      Go to Layout [ “WIA Scan” (WIA Scan) ]

                                      Layouts:


                                      Script Hierarchy

                                      Initialize
                                      SelectDevice
                                      List Devices
                                      List Properties
                                      Select Device
                                      Clear All
                                      Get Image Dialog
                                      Scan Flatbed
                                      Import Images
                                      Build PDF
                                      InitDynaPDF
                                      Scan Flatbed
                                      Scan Duplex
                                      Scan Fedder
                                      PicturePDF

                                      Next Script: [SelectDevice]
                                      Script NameInitialize
                                      Run script with full access privilegesOff
                                      Include In MenuYes
                                      Layouts that use this script
                                      Scripts that use this script
                                        Script Definition
                                        Script Steps
                                        • Set Variable [ $r; Value:MBS("WIA.Initialize") ]
                                        • Show Custom Dialog [ Title: "WIA Initialize"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                        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: [Initialize]Next Script: [List Devices]
                                                      Script NameSelectDevice
                                                      Run script with full access privilegesOff
                                                      Include In MenuYes
                                                      Layouts that use this script
                                                      Scripts that use this script
                                                        Script Definition
                                                        Script Steps
                                                        • Go to Layout [ “WIA Scan” (WIA Scan) ]
                                                        • Delete All Records [ No dialog ]
                                                        • Set Variable [ $r; Value:MBS("WIA.SelectDeviceDialog"; "Scanner") ]
                                                        • If [ $r = "OK" ]
                                                        • Show Custom Dialog [ Title: "Select Device Dialog Result"; Message: "DeviceID: " & MBS("WIA.GetCurrentDevice") & ¶ & "Name: " & MBS("WIA.DevicePropertyValue"; ""; "Name"); Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                        • #List properties of current device:
                                                        • Perform Script [ “List Properties”; Parameter: "" ]
                                                        • Else
                                                        • Show Custom Dialog [ Title: "Select Device Dialog Result"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                        • 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: [SelectDevice]Next Script: [List Properties]
                                                                  Script NameList Devices
                                                                  Run script with full access privilegesOff
                                                                  Include In MenuYes
                                                                  Layouts that use this script
                                                                  Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    • Go to Layout [ “WIA Scan” (WIA Scan) ]
                                                                    • Delete All Records [ No dialog ]
                                                                    • Set Variable [ $c; Value:MBS("WIA.DeviceCount") ]
                                                                    • If [ MBS("IsError") ]
                                                                    • Show Custom Dialog [ Title: "Error"; Message: $c; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                    • Else
                                                                    • If [ $c > 0 ]
                                                                    • Set Variable [ $i; Value:0 ]
                                                                    • Loop
                                                                    • Perform Script [ “List Properties”; Parameter: $i ]
                                                                    • #Next
                                                                    • Set Variable [ $i; Value:$i + 1 ]
                                                                    • Exit Loop If [ $i >= $c ]
                                                                    • End Loop
                                                                    • End If
                                                                    • 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: [List Devices]Next Script: [Select Device]
                                                                              Script NameList Properties
                                                                              Run script with full access privilegesOff
                                                                              Include In MenuNo
                                                                              Layouts that use this script
                                                                              Scripts that use this script
                                                                              Script Definition
                                                                              Script Steps
                                                                              • Set Variable [ $device; Value:Get(ScriptParameter) ]
                                                                              • Set Variable [ $list; Value:MBS("WIA.DevicePropertyKeys"; $device) ]
                                                                              • If [ MBS("IsError") ]
                                                                              • Show Custom Dialog [ Title: "Error"; Message: $list; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                              • Else
                                                                              • Set Variable [ $count; Value:ValueCount ( $list ) ]
                                                                              • If [ $count > 0 ]
                                                                              • Set Variable [ $i; Value:1 ]
                                                                              • Loop
                                                                              • Set Variable [ $key; Value:GetValue ( $list; $i) ]
                                                                              • Set Variable [ $value; Value:MBS("WIA.DevicePropertyValue"; $device; $key) ]
                                                                              • New Record/Request
                                                                              • Set Field [ WIA Scan::Device; $device ]
                                                                              • Set Field [ WIA Scan::Key; $key ]
                                                                              • Set Field [ WIA Scan::Value; $value ]
                                                                              • Commit Records/Requests [ No dialog ]
                                                                              • #Next
                                                                              • Set Variable [ $i; Value:$i+1 ]
                                                                              • Exit Loop If [ $i > $count ]
                                                                              • End Loop
                                                                              • End If
                                                                              • 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: [List Properties]Next Script: [Clear All]
                                                                                      Script NameSelect Device
                                                                                      Run script with full access privilegesOff
                                                                                      Include In MenuYes
                                                                                      Layouts that use this script
                                                                                      Scripts that use this script
                                                                                        Script Definition
                                                                                        Script Steps
                                                                                        • Set Variable [ $r; Value:MBS("WIA.SetCurrentDevice"; WIA Scan::Value) ]
                                                                                        • If [ $r = "OK" ]
                                                                                        • Show Custom Dialog [ Title: "Select Device Dialog Result"; Message: "DeviceID: " & MBS("WIA.GetCurrentDevice") & ¶ & "Name: " & MBS("WIA.DevicePropertyValue"; ""; "Name"); Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                        • Else
                                                                                        • Show Custom Dialog [ Title: "Select Device Dialog Result"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                        • 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: [Select Device]Next Script: [Get Image Dialog]
                                                                                                Script NameClear All
                                                                                                Run script with full access privilegesOff
                                                                                                Include In MenuYes
                                                                                                Layouts that use this script
                                                                                                  Scripts that use this script
                                                                                                    Script Definition
                                                                                                    Script Steps
                                                                                                    • Truncate Table [ No dialog; Table: “WIA Scan” ]
                                                                                                    • Truncate Table [ No dialog; Table: “Images” ]
                                                                                                    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 All]Next Script: [Scan Flatbed]
                                                                                                                  Script NameGet Image Dialog
                                                                                                                  Run script with full access privilegesOff
                                                                                                                  Include In MenuYes
                                                                                                                  Layouts that use this script
                                                                                                                  Scripts that use this script
                                                                                                                    Script Definition
                                                                                                                    Script Steps
                                                                                                                    • #creating the temporary folder
                                                                                                                    • Set Variable [ $folder; Value:MBS( "Folders.UserTemporary" ) ]
                                                                                                                    • Set Variable [ $path; Value:MBS( "Path.AddPathComponent"; $folder; "FileMakerScans") ]
                                                                                                                    • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $path) ]
                                                                                                                    • #call scandialog
                                                                                                                    • Set Variable [ $r; Value:MBS("WIA.ImageDialog"; "Default"; $path; "scan") ]
                                                                                                                    • #Result can be OK or Cancel and in both cases some images may be there
                                                                                                                    • If [ $r ≠ "OK" ]
                                                                                                                    • Show Custom Dialog [ Title: "Scan Result"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                    • Else
                                                                                                                    • Perform Script [ “Import Images” ]
                                                                                                                    • 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: [Get Image Dialog]Next Script: [Import Images]
                                                                                                                                Script NameScan Flatbed
                                                                                                                                Run script with full access privilegesOff
                                                                                                                                Include In MenuYes
                                                                                                                                Layouts that use this script
                                                                                                                                  Scripts that use this script
                                                                                                                                    Script Definition
                                                                                                                                    Script Steps
                                                                                                                                    • Set Variable [ $r; Value:MBS( "WIA.Scan"; "Flatbed") ]
                                                                                                                                    • #Result can be OK or Cancel and in both cases some images may be there
                                                                                                                                    • If [ $r ≠ "OK" ]
                                                                                                                                    • Show Custom Dialog [ Title: "Scan Result"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                                    • Else
                                                                                                                                    • Perform Script [ “Import Images” ]
                                                                                                                                    • 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: [Scan Flatbed]Next Script: [Build PDF]
                                                                                                                                                Script NameImport Images
                                                                                                                                                Run script with full access privilegesOff
                                                                                                                                                Include In MenuYes
                                                                                                                                                Layouts that use this script
                                                                                                                                                  Scripts that use this script
                                                                                                                                                  Script Definition
                                                                                                                                                  Script Steps
                                                                                                                                                  • #gets the path to the scan result
                                                                                                                                                  • Set Variable [ $paths; Value:MBS( "WIA.Images") ]
                                                                                                                                                  • Perform Script [ “Build PDF”; Parameter: $paths ]
                                                                                                                                                  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: [Import Images]Next Script: [InitDynaPDF]
                                                                                                                                                              Script NameBuild PDF
                                                                                                                                                              Run script with full access privilegesOff
                                                                                                                                                              Include In MenuYes
                                                                                                                                                              Layouts that use this script
                                                                                                                                                                Scripts that use this script
                                                                                                                                                                Script Definition
                                                                                                                                                                Script Steps
                                                                                                                                                                • Set Variable [ $paths; Value:Get ( ScriptParameter ) ]
                                                                                                                                                                • Go to Layout [ “Images” (Images) ]
                                                                                                                                                                • #Initialize DynaPDF if needed
                                                                                                                                                                • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                                                                                • Perform Script [ “InitDynaPDF” ]
                                                                                                                                                                • End If
                                                                                                                                                                • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                                                                                                                • Exit Script [ ]
                                                                                                                                                                • End If
                                                                                                                                                                • #Clear current PDF document
                                                                                                                                                                • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                                                                                                                • #Specifies the language of the document
                                                                                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetLanguage"; $pdf; "en-US") ]
                                                                                                                                                                • #Creates a global structure tree that is required to create Tagged PDF files
                                                                                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.CreateStructureTree"; $pdf) ]
                                                                                                                                                                • Perform Script [ “PicturePDF”; Parameter: $pdf & ¶ & $paths ]
                                                                                                                                                                • #Check if this PDF conforms to PDF/A-1b 2005
                                                                                                                                                                • Set Variable [ $c; Value:MBS("DynaPDF.CheckConformance"; $pdf; "PDFA 1b 2005") ]
                                                                                                                                                                • If [ $c = 1 ]
                                                                                                                                                                • # A RGB ICC profile must be added to the document
                                                                                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.AddOutputIntentEx"; $pdf; Images::RGB ICC Profile) ]
                                                                                                                                                                • Else If [ $c = 2 ]
                                                                                                                                                                • # A CMYK ICC profile must be added to the document
                                                                                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.AddOutputIntentEx"; $pdf; Images::CMYK ICC Profile) ]
                                                                                                                                                                • Else If [ $c = 3 ]
                                                                                                                                                                • # A Gray, RGB, or CMYK ICC profile must be added to the document
                                                                                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.AddOutputIntentEx"; $pdf; Images::RGB ICC Profile) ]
                                                                                                                                                                • End If
                                                                                                                                                                • #now set PDF Version.
                                                                                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetPDFVersion"; $pdf; "PDF/A-1b 2005") ]
                                                                                                                                                                • New Record/Request
                                                                                                                                                                • Set Field [ Images::Image; MBS("DynaPDF.Save"; $pdf; "Merged.pdf") ]
                                                                                                                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                                                                                                                • Commit Records/Requests [ No dialog ]
                                                                                                                                                                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: [Build PDF]Next Script: [Scan Flatbed]
                                                                                                                                                                    Script NameInitDynaPDF
                                                                                                                                                                    Run script with full access privilegesOff
                                                                                                                                                                    Include In MenuYes
                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                      Script Definition
                                                                                                                                                                      Script Steps
                                                                                                                                                                      • #Locate DynaPDF library
                                                                                                                                                                      • #you can have libraries in container and export at runtime to folder of your choice.
                                                                                                                                                                      • #Or install library somewhere and pass path.
                                                                                                                                                                      • #If library is in same folder as plugin, you can only pass only file name.
                                                                                                                                                                      • If [ MBS("IsServer") ]
                                                                                                                                                                      • #Put the path you use for your server here:
                                                                                                                                                                      • If [ Get(SystemPlatform) = -2 ]
                                                                                                                                                                      • #Server on Windows
                                                                                                                                                                      • Set Variable [ $path; Value:"C:\Programs\FileMaker Server\dynapdf64.dll" ]
                                                                                                                                                                      • Else If [ MBS("IsLinux") ]
                                                                                                                                                                      • #Server on Linux for FileMaker Cloud
                                                                                                                                                                      • Set Variable [ $path; Value:"/opt/FileMaker/FileMaker Server/dynapdf.linux.so" ]
                                                                                                                                                                      • Else
                                                                                                                                                                      • #Server on Mac
                                                                                                                                                                      • Set Variable [ $path; Value: "/Library/FileMaker Server/dynapdf.dylib" ]
                                                                                                                                                                      • End If
                                                                                                                                                                      • Else
                                                                                                                                                                      • #For desktop and our examples we look in same folder as database:
                                                                                                                                                                      • Set Variable [ $databasePath; Value:Get(FilePath) ]
                                                                                                                                                                      • Set Variable [ $databasePath; Value:MBS("Path.FilemakerPathToNativePath"; $databasePath) ]
                                                                                                                                                                      • Set Variable [ $databasePath; Value:Substitute ( $databasePath ; ".fp7" ; ".fmp12") ]
                                                                                                                                                                      • Set Variable [ $databaseName; Value:Get(FileName) & ".fmp12" ]
                                                                                                                                                                      • If [ Get(SystemPlatform) = -2 ]
                                                                                                                                                                      • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dll" ) ]
                                                                                                                                                                      • #plugin will look for dynapdf.dll and if not found also for dynapdf64.dll (64-bit) and dynapdf32.dll (32-bit).
                                                                                                                                                                      • Else
                                                                                                                                                                      • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dylib" ) ]
                                                                                                                                                                      • #Mac dylib is usually 32 and 64 bit together.
                                                                                                                                                                      • End If
                                                                                                                                                                      • End If
                                                                                                                                                                      • #You can test for free.
                                                                                                                                                                      • #If you like to get a dynapdf license, please follow links on our pricing page:
                                                                                                                                                                      • #https://www.monkeybreadsoftware.de/filemaker/pricing.shtml
                                                                                                                                                                      • Set Variable [ $LicenseKey; Value:"" // put your key here or leave empty for demo. ]
                                                                                                                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path; $LicenseKey) ]
                                                                                                                                                                      • If [ $r ≠ "OK" ]
                                                                                                                                                                      • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                                                                      • Halt Script
                                                                                                                                                                      • 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: [InitDynaPDF]Next Script: [Scan Duplex ]
                                                                                                                                                                                    Script NameScan Flatbed
                                                                                                                                                                                    Run script with full access privilegesOff
                                                                                                                                                                                    Include In MenuYes
                                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                        Script Definition
                                                                                                                                                                                        Script Steps
                                                                                                                                                                                        • #Progress Dialog
                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.Reset" ) ]
                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetTitle"; "Please wait") ]
                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetTopText"; "Scanning...") ]
                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetProgress"; -1 ) ]
                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.Show" ) ]
                                                                                                                                                                                        • #Scan
                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "WIA.Scan"; "Flatbed") ]
                                                                                                                                                                                        • Set Variable [ $d; Value:MBS( "ProgressDialog.Hide" ) ]
                                                                                                                                                                                        • #Result can be OK or Cancel and in both cases some images may be there
                                                                                                                                                                                        • If [ $r ≠ "OK" ]
                                                                                                                                                                                        • Show Custom Dialog [ Title: "Scan Result"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                                                                                        • Else
                                                                                                                                                                                        • Perform Script [ “Import Images” ]
                                                                                                                                                                                        • 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: [Scan Flatbed]Next Script: [Scan Fedder ]
                                                                                                                                                                                                    Script NameScan Duplex
                                                                                                                                                                                                    Run script with full access privilegesOff
                                                                                                                                                                                                    Include In MenuYes
                                                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                                        Script Definition
                                                                                                                                                                                                        Script Steps
                                                                                                                                                                                                        • #Progress Dialog
                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.Reset" ) ]
                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetTitle"; "Please wait") ]
                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetTopText"; "Scanning...") ]
                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetProgress"; -1 ) ]
                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.Show" ) ]
                                                                                                                                                                                                        • #Scan
                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "WIA.SetItemPropertyValue"; "Feeder"; "Document Handling Select"; 4) ]
                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "WIA.Scan";"Feeder" ) ]
                                                                                                                                                                                                        • Set Variable [ $d; Value:MBS( "ProgressDialog.Hide" ) ]
                                                                                                                                                                                                        • #Result can be OK or Cancel and in both cases some images may be there
                                                                                                                                                                                                        • If [ $r ≠ "OK" ]
                                                                                                                                                                                                        • Show Custom Dialog [ Title: "Scan Result"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                                                                                                        • Else
                                                                                                                                                                                                        • Perform Script [ “Import Images” ]
                                                                                                                                                                                                        • 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: [Scan Duplex ]Next Script: [PicturePDF]
                                                                                                                                                                                                                    Script NameScan Fedder
                                                                                                                                                                                                                    Run script with full access privilegesOff
                                                                                                                                                                                                                    Include In MenuYes
                                                                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                                                        Script Definition
                                                                                                                                                                                                                        Script Steps
                                                                                                                                                                                                                        • #Progress Dialog
                                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.Reset" ) ]
                                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetTitle"; "Please wait") ]
                                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetTopText"; "Scanning...") ]
                                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.SetProgress"; -1 ) ]
                                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "ProgressDialog.Show" ) ]
                                                                                                                                                                                                                        • #Scan
                                                                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "WIA.Scan"; "Fedder") ]
                                                                                                                                                                                                                        • Set Variable [ $d; Value:MBS( "ProgressDialog.Hide" ) ]
                                                                                                                                                                                                                        • #Result can be OK or Cancel and in both cases some images may be there
                                                                                                                                                                                                                        • If [ $r ≠ "OK" ]
                                                                                                                                                                                                                        • Show Custom Dialog [ Title: "Scan Result"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                                                                                                                        • Else
                                                                                                                                                                                                                        • Perform Script [ “Import Images” ]
                                                                                                                                                                                                                        • 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: [Scan Fedder ]
                                                                                                                                                                                                                                    Script NamePicturePDF
                                                                                                                                                                                                                                    Run script with full access privilegesOff
                                                                                                                                                                                                                                    Include In MenuYes
                                                                                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                                                                                      Script Definition
                                                                                                                                                                                                                                      Script Steps
                                                                                                                                                                                                                                      • Set Variable [ $SP; Value:Get ( ScriptParameter ) ]
                                                                                                                                                                                                                                      • Set Variable [ $pdf; Value:GetValue($SP; 1) ]
                                                                                                                                                                                                                                      • Set Variable [ $i; Value:ValueCount ( $SP ) ]
                                                                                                                                                                                                                                      • Set Variable [ $paths; Value:MiddleValues ( $SP; 2; $i - 1 ) ]
                                                                                                                                                                                                                                      • Go to Record/Request/Page [ First ]
                                                                                                                                                                                                                                      • Set Variable [ $destPage; Value:1 ]
                                                                                                                                                                                                                                      • Set Variable [ $CurrentImage; Value:1 ]
                                                                                                                                                                                                                                      • Loop
                                                                                                                                                                                                                                      • Set Variable [ $currentPicturePaths; Value:GetValue ($paths ; $currentImage ) ]
                                                                                                                                                                                                                                      • #is the page empty
                                                                                                                                                                                                                                      • #Loads a picture file and returns the ImageRef number on success
                                                                                                                                                                                                                                      • Set Variable [ $RefNum; Value:MBS( "GMImage.NewFromFile"; $currentPicturePaths ) ]
                                                                                                                                                                                                                                      • #Change the picture to RGB, that is necessary for GMImage.AveragePixelValue
                                                                                                                                                                                                                                      • Set Variable [ $r; Value:MBS("GMImage.SetType"; $RefNum; 6) ]
                                                                                                                                                                                                                                      • #Returns the image height and width
                                                                                                                                                                                                                                      • Set Variable [ $ImageHeight; Value:MBS("GMImage.GetHeight"; $RefNum) ]
                                                                                                                                                                                                                                      • Set Variable [ $ImageWidth; Value:MBS("GMImage.GetWidth"; $RefNum) ]
                                                                                                                                                                                                                                      • #Calculates the average pixel value. Value is in range from 0.0 to 1.0 depending if it is more black (0.0) or white (1.0).
                                                                                                                                                                                                                                      • Set Variable [ $AveragePixelValue; Value:MBS( "GMImage.AveragePixelValue"; $refNum; 0; 0; $imageWidth; $imageHeight ) ]
                                                                                                                                                                                                                                      • #If AveragePixelValue can not be calculated the Image is not import into the pdf
                                                                                                                                                                                                                                      • If [ MBS("IsError") ]
                                                                                                                                                                                                                                      • Show Custom Dialog [ Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                                                                      • Else
                                                                                                                                                                                                                                      • #If the scanned page is completely white, mostly the value is not completly 1, because we have tiny kinks on our page or dirt particles into our scanner. You need to adjust the value individual for your scanner
                                                                                                                                                                                                                                      • If [ $AveragePixelValue < ,9999 ]
                                                                                                                                                                                                                                      • #Adds new pages to the PDF
                                                                                                                                                                                                                                      • Set Variable [ $r; Value:MBS( "DynaPDF.AppendImagePages"; $pdf; $currentPicturePaths ) ]
                                                                                                                                                                                                                                      • #Releases the image from memory
                                                                                                                                                                                                                                      • Set Variable [ $r; Value:MBS( "GMImage.Release"; $RefNum ) ]
                                                                                                                                                                                                                                      • End If
                                                                                                                                                                                                                                      • End If
                                                                                                                                                                                                                                      • Set Variable [ $CurrentImage; Value:$CurrentImage + 1 ]
                                                                                                                                                                                                                                      • Exit Loop If [ $CurrentImage > $i - 1 ]
                                                                                                                                                                                                                                      • Go to Record/Request/Page [ Next; Exit after last ]
                                                                                                                                                                                                                                      • End Loop
                                                                                                                                                                                                                                      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
                                                                                                                                                                                                                                                    SeparateStringString;NummerAll accountsCase(Nummer = 1; Left ( String; (Position ( String; "¶"; 1; 1))-1); Middle ( String; (Position ( String; "¶"; 1; Nummer-1))+1; (Position ( String; "¶"; 1; Nummer)) - ((Position ( String; "¶"; 1; Nummer-1))+1) ) )

                                                                                                                                                                                                                                                      Custom Menu Sets

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

                                                                                                                                                                                                                                                      Download example: Scan with WIA to PDF

                                                                                                                                                                                                                                                      Used functions:




                                                                                                                                                                                                                                                      Links
                                                                                                                                                                                                                                                      MBS Xojo Plugins