Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Add Weblinks

All examples are included with download of MBS FileMaker Plugin.

Add Weblinks.fmp12

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

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
PDF
3 fields defined, 1 record
PDF
Links
4 fields defined, 4 records
Links

Fields

Table Name: PDF - 3 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
PDF IDNormal, NumberAuto-Enter:
  • Context table: PDF
    Calculation: Get(UUIDNumber)
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: All
  • Index Language: German
        Input PDFNormal, BinaryAuto-Enter:
        • Allow editing
        Validation:
        • Only during data entry
        Storage:
        • Repetitions: 1
            Output PDFNormal, BinaryAuto-Enter:
            • Allow editing
            Validation:
            • Only during data entry
            Storage:
            • Repetitions: 1

                Table Name: Links - 4 Fields
                Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
                Link IDNormal, NumberAuto-Enter:
                • Context table: Links
                  Calculation: Get(UUIDNumber)
                Validation:
                • Only during data entry
                Storage:
                • Repetitions: 1
                • Indexing: None
                • Automatically create indexes as needed
                • Index Language: German
                      TextNormal, TextAuto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Repetitions: 1
                      • Indexing: None
                      • Automatically create indexes as needed
                      • Index Language: German
                          URLNormal, TextAuto-Enter:
                          • Allow editing
                          Validation:
                          • Only during data entry
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                              PDF IDNormal, NumberAuto-Enter:
                              • Allow editing
                              Validation:
                              • Only during data entry
                              Storage:
                              • Repetitions: 1
                              • Indexing: All
                              • Index Language: German

                                    Layout Objects: PDF

                                    Regular Fields

                                    Field Name: PDF::Input PDF
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 75 pt
                                    • Left: 138 pt
                                    • Bottom: 200 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: PDF::Output PDF
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 202 pt
                                    • Left: 138 pt
                                    • Bottom: 327 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: Links::Text
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 79 pt
                                    • Left: 411 pt
                                    • Bottom: 100 pt
                                    • Right: 662 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: Links::URL
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 79 pt
                                    • Left: 664 pt
                                    • Bottom: 100 pt
                                    • Right: 915 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: Clear Output
                                    • Top: 347 pt
                                    • Left: 138 pt
                                    • Bottom: 382 pt
                                    • Right: 285 pt
                                    • Anchoring: Left, Top
                                    Perform Script [ “Clear” ]

                                    Scripts:


                                    Button PropertiesCoordinatesScript/Script Step
                                      Type:
                                    • Text: Add Links
                                    • Top: 395 pt
                                    • Left: 138 pt
                                    • Bottom: 430 pt
                                    • Right: 285 pt
                                    • Anchoring: Left, Top
                                    Perform Script [ “Add Links” ]

                                    Scripts:


                                    Portals

                                    Portal PropertiesCoordinatesFieldsOptions
                                      Layout Name:
                                    • PDF
                                    • Top: 76 pt
                                    • Left: 408 pt
                                    • Bottom: 503 pt
                                    • Right: 955 pt
                                    • Anchoring: Left, Top
                                    Field Objects
                                    • Sort records: Off
                                    • Filter calculation: None
                                    • Initial Row: 1
                                    • Number of Rows: 17
                                    • Show vertical scroll bar

                                    Layout Objects: Links

                                    Regular Fields

                                    Field Name: Links::Link ID
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 52 pt
                                    • Left: 138 pt
                                    • Bottom: 73 pt
                                    • Right: 217 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: Links::Text
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 75 pt
                                    • Left: 138 pt
                                    • Bottom: 96 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: Links::URL
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 98 pt
                                    • Left: 138 pt
                                    • Bottom: 119 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

                                    Script Hierarchy

                                    InitDynaPDF
                                    Clear
                                    Add Links

                                    Next Script: [Clear]
                                    Script NameInitDynaPDF
                                    Run script with full access privilegesOff
                                    Include In MenuNo
                                    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\dynapdf.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 dynapdf.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. // Use e.g. "Lite", "Pro" or "Starter" to use demo mode for just that mode. ]
                                      • 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: [Add Links]
                                                    Script NameClear
                                                    Run script with full access privilegesOff
                                                    Include In MenuYes
                                                    Layouts that use this script
                                                    Scripts that use this script
                                                      Script Definition
                                                      Script Steps
                                                      • Set Field [ PDF::Output PDF; "" ]
                                                      Fields used in this script
                                                      Scripts used in this script
                                                        Layouts used in this script
                                                          Tables used in this script
                                                          Table occurrences used by this script
                                                          Custom Functions used by this script
                                                            Custom menu set used by this script

                                                              Previous Script: [Clear]
                                                              Script NameAdd Links
                                                              Run script with full access privilegesOff
                                                              Include In MenuYes
                                                              Layouts that use this script
                                                              Scripts that use this script
                                                                Script Definition
                                                                Script Steps
                                                                • #Initialize DynaPDF if needed
                                                                • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                • Perform Script [ “InitDynaPDF” ]
                                                                • End If
                                                                • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                • Exit Script [ ]
                                                                • End If
                                                                • # go to PDF Layout
                                                                • Go to Layout [ “PDF” (PDF) ]
                                                                • If [ Get(LastError) ≠ 0 ]
                                                                • Exit Script [ ]
                                                                • End If
                                                                • #Start new PDF
                                                                • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                • #Set some flags for import
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetImportFlags"; $pdf; "ImportAll ImportAsPage") ]
                                                                • #Add first page
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; PDF::Input PDF) ]
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
                                                                • #setup drawing for links
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetLineWidth"; $pdf; 1) ]
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetLinkHighlightMode"; $pdf; "invert") ]
                                                                • #Add Links
                                                                • Set Variable [ $count; Value:0 ]
                                                                • Go to Related Record [ From table: “Links”; Using layout: “Links” (Links) ] [ Show only related records ]
                                                                • If [ Get(FoundCount) > 0 ]
                                                                • Set Variable [ $PageCount; Value:MBS( "DynaPDF.GetPageCount"; $pdf ) ]
                                                                • Set Variable [ $PageNumber; Value:1 ]
                                                                • Loop
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.EditPage"; $pdf; $PageNumber) ]
                                                                • #check for all texts
                                                                • Go to Record/Request/Page [ First ]
                                                                • Loop
                                                                • Set Variable [ $pos; Value:MBS( "DynaPDF.FindText"; $pdf; Links::Text; 1) ]
                                                                • If [ IsEmpty ( $pos ) ]
                                                                • #not found
                                                                • Else
                                                                • # read positions
                                                                • Set Variable [ $pos; Value:Substitute($pos; " "; ¶) ]
                                                                • Set Variable [ $x1; Value:MBS( "Math.TextToNumber"; GetValue($pos; 1)) ]
                                                                • Set Variable [ $y1; Value:MBS( "Math.TextToNumber"; GetValue($pos; 2)) ]
                                                                • Set Variable [ $x2; Value:MBS( "Math.TextToNumber"; GetValue($pos; 3)) ]
                                                                • Set Variable [ $xy; Value:MBS( "Math.TextToNumber"; GetValue($pos; 4)) ]
                                                                • Set Variable [ $x3; Value:MBS( "Math.TextToNumber"; GetValue($pos; 5)) ]
                                                                • Set Variable [ $y3; Value:MBS( "Math.TextToNumber"; GetValue($pos; 6)) ]
                                                                • Set Variable [ $x4; Value:MBS( "Math.TextToNumber"; GetValue($pos; 7)) ]
                                                                • Set Variable [ $y4; Value:MBS( "Math.TextToNumber"; GetValue($pos; 8)) ]
                                                                • Set Variable [ $w; Value:MBS( "Math.TextToNumber"; $x3-$x1) ]
                                                                • Set Variable [ $h; Value:MBS( "Math.TextToNumber"; $y3-$y1) ]
                                                                • #place web link
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.WebLink"; $pdf; $x1; $y1; $w; $h; Links::URL ) ]
                                                                • Set Variable [ $count; Value:$count +1 ]
                                                                • End If
                                                                • #next link...
                                                                • Go to Record/Request/Page [ Next; Exit after last ]
                                                                • End Loop
                                                                • #next page...
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                                • Set Variable [ $PageNumber; Value:$PageNumber +1 ]
                                                                • Exit Loop If [ $PageNumber > $PageCount ]
                                                                • End Loop
                                                                • End If
                                                                • Go to Layout [ “PDF” (PDF) ]
                                                                • #add another normal link
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.EditPage"; $pdf; 1) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetFont"; $pdf; "Helvetica"; "none"; 12) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetTextRect"; $pdf; 10; 30; 200; 20) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetStrokeColor"; $pdf; 0; 0; 0) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.WriteFText"; $pdf; "center"; "Open MBS Website") ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.WebLink"; $pdf; 10; 10; 200; 20; "https://www.monkeybreadsoftware.com/filemaker/") ]
                                                                • #now try a link with JavaScript
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetFont"; $pdf; "Helvetica"; "none"; 12) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetTextRect"; $pdf; 310; 30; 200; 20) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.SetStrokeColor"; $pdf; 0; 0; 0) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.WriteFText"; $pdf; "center"; "Open MBS Website in new Tab") ]
                                                                • #the page link points to the page to go for if no JavaScript is enabled
                                                                • // Set Variable [ $LinkRef; Value:MBS( "DynaPDF.PageLink"; $pdf; 310; 10; 200; 20; 2) ]
                                                                • #the web link points to the URL to use when no JavaScript is enabled
                                                                • Set Variable [ $LinkRef; Value:MBS( "DynaPDF.WebLink"; $pdf; 310; 10; 200; 20; "https://www.monkeybreadsoftware.com/filemaker/") ]
                                                                • #we add a JavaScript action to open URL
                                                                • Set Variable [ $JSAction; Value:MBS( "DynaPDF.CreateJSAction"; $PDF; "app.launchURL(\"https://www.monkeybreadsoftware.com/filemaker/\", true);" ) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.AddActionToObj"; $pdf; "PageLink"; "OnMouseUp"; $JSAction; $LinkRef; ) ]
                                                                • Set Variable [ $r; Value:MBS( "DynaPDF.EndPage"; $pdf) ]
                                                                • #save PDF
                                                                • Set Variable [ $PDFData; Value:MBS( "DynaPDF.Save"; $pdf; GetAsText(PDF::Input PDF)) ]
                                                                • #Free all data
                                                                • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                • #Put in Container
                                                                • Set Field [ PDF::Output PDF; $PDFData ]
                                                                • Show Custom Dialog [ Title: "done"; Message: $count & " links placed."; Default Button: “OK”, Commit: “Yes” ]
                                                                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

                                                                    Download example: Add Weblinks

                                                                    Used functions: