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

MBS FileMaker Plugin Example Databases

WebViewer MarkDown

All examples are included with download of MBS FileMaker Plugin.

WebViewer MarkDown.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts4
Value Lists0
Custom Functions0
Custom Menus33
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
OnFirstWindowOpenScript: Initialize
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
WebViewer MarkDown
2 fields defined, 2 records
WebViewer MarkDown

Fields

Table Name: WebViewer MarkDown - 2 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
InputNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      OutputNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German

          Layout Objects: WebViewer MarkDown

          Regular Fields

          Field Name: WebViewer MarkDown::Input
          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
          • Top: 24 pt
          • Left: 138 pt
          • Bottom: 206 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: System Default
          • Go to next field using: Tab key
          Yes

          Field Name: WebViewer MarkDown::Output
          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
          • Top: 210 pt
          • Left: 138 pt
          • Bottom: 398 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: System Default
          • Go to next field using: Tab key
          Yes

          Buttons

          Button PropertiesCoordinatesScript/Script Step
            Type:
          • Text: Convert
          • Top: 75 pt
          • Left: 7 pt
          • Bottom: 103 pt
          • Right: 92 pt
          • Anchoring: Left, Top
          Perform Script [ “Convert” ]

          Scripts:


          Web Viewer Controls

          Web Viewer Control PropertiesCoordinatesWeb Address
            Object Name:
          • MarkDownWebViewer
            Additional Properties:
          • Automatically encode URL
          • Top: 331 pt
          • Left: 18 pt
          • Bottom: 373 pt
          • Right: 115 pt
          • Anchoring: Left, Top
          "about:_blank"

          Web Viewer Control PropertiesCoordinatesWeb Address
            Object Name:
          • PreviewWebviewer
            Additional Properties:
          • Allow interaction with web viewer content
          • Display progress bar
          • Display status messages
          • Automatically encode URL
          • Top: 24 pt
          • Left: 396 pt
          • Bottom: 397 pt
          • Right: 769 pt
          • Anchoring: Left and Right, Top and Bottom
          "about:_blank"

          Script Hierarchy

          Convert
          Exit Trigger
          Initialize
          Clear

          Next Script: [Exit Trigger]
          Script NameConvert
          Run script with full access privilegesOff
          Include In MenuYes
          Layouts that use this script
          Scripts that use this script
          Script Definition
          Script Steps
          • #check if initialize is needed
          • Set Variable [ $URL; Value:MBS( "WebView.GetURL" ; "MarkDownWebViewer") ]
          • If [ Position ( $URL ; "markdown" ; 1 ; 1 ) = 0 ]
          • Perform Script [ “Initialize” ]
          • End If
          • #convert
          • #1. put text in input field
          • Set Variable [ $r; Value:MBS( "WebView.SetFormTextAreaValue" ; "MarkDownWebViewer"; "formtest"; "input"; WebViewer MarkDown::Input; 1 ) ]
          • Set Variable [ $r; Value:MBS( "WebView.SetFormTextAreaValue" ; "MarkDownWebViewer"; "formtest"; "output"; WebViewer MarkDown::Input; 1 ) ]
          • If [ MBS("IsError") = 0 ]
          • #2. run the conversion
          • Set Variable [ $r; Value:MBS( "WebView.RunJavaScript" ; "HTMLEditor"; "try { Convert(); } catch (e) { alert(e); }" ) ]
          • If [ MBS("IsError") = 0 ]
          • #3. read result
          • Set Variable [ $r; Value:MBS( "WebView.GetFormTextAreaValue" ; "MarkDownWebViewer"; "formtest"; "output"; 1 ) ]
          • If [ MBS("IsError") = 0 ]
          • If [ $r ≠ "" ]
          • #got new text!
          • Set Field [ WebViewer MarkDown::Output; $r ]
          • Set Web Viewer [ Object Name: "PreviewWebviewer"; URL: "data:text/html," & WebViewer MarkDown::Output ]
          • End If
          • Exit Script [ Result: "OK" ]
          • End If
          • End If
          • End If
          • Show Custom Dialog [ Title: "Failed to convert to markdown"; Message: $r; 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

                Previous Script: [Convert]Next Script: [Initialize]
                Script NameExit Trigger
                Run script with full access privilegesOff
                Include In MenuNo
                Layouts that use this script
                  Scripts that use this script
                    Script Definition
                    Script Steps
                    • Perform Script [ “Convert” ]
                    • Exit Script [ Result: 1 ]
                    Fields used in this script
                      Scripts used in this script
                      Layouts used in this script
                        Tables used in this script
                          Table occurrences used by this script
                            Custom Functions used by this script
                              Custom menu set used by this script

                                Previous Script: [Exit Trigger]Next Script: [Clear]
                                Script NameInitialize
                                Run script with full access privilegesOff
                                Include In MenuNo
                                Layouts that use this script
                                  Scripts that use this script
                                  Script Definition
                                  Script Steps
                                  • Pause/Resume Script [ Duration (seconds): ,3 ]
                                  • #init webviewer extension
                                  • If [ 0 // Hole ( HostAnwendungVersion ) = "" /* on server? */ ]
                                  • #find HTML code
                                  • 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" ]
                                  • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "markdown.html" ) ]
                                  • Set Variable [ $URL; Value:MBS( "Path.FilePathToFileURL"; $path ) ]
                                  • Set Web Viewer [ Object Name: "MarkDownWebViewer"; URL: $path ]
                                  • Else
                                  • Set Web Viewer [ Object Name: "MarkDownWebViewer"; URL: "https://www.monkeybreadsoftware.com/filemaker/examples/markdown/markdown.html" ]
                                  • End If
                                  • #give WebViewer time to actually load website
                                  • Loop
                                  • Pause/Resume Script [ Duration (seconds): ,3 ]
                                  • Exit Loop If [ MBS("WebView.IsLoading"; "MarkDownWebViewer") ≠ 1 ]
                                  • 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

                                                Previous Script: [Initialize]
                                                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 [ WebViewer MarkDown::Output; "" ]
                                                    • Set Web Viewer [ Object Name: "PreviewWebviewer"; URL: "about:_blank" ]
                                                    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: WebViewer MarkDown

                                                            Used functions: