MBS FileMaker Plugin Example Databases

Terminal

All examples are included with download of MBS FileMaker Plugin.

Terminal.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts6
Value Lists0
Custom Functions0
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
Terminal
2 fields defined, 1 record
Terminal

Fields

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

          Layout Objects: Terminal

          Regular Fields

          Field Name: Terminal::Output
          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
          • Top: 56 pt
          • Left: 12 pt
          • Bottom: 226 pt
          • Right: 573 pt
          • Anchoring: Left and Right, Top and Bottom
          Field Format:
          • Edit Box
          • Include vertical scrollbar
          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: Terminal::Input
          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
            OnObjectKeystroke
          • Script: CheckKey
          • Modes: Browse
          • Top: 234 pt
          • Left: 11 pt
          • Bottom: 256 pt
          • Right: 572 pt
          • Anchoring: Left and Right, 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
          Yes

          Buttons

          Button PropertiesCoordinatesScript/Script Step
            Type:
          • Text: Clear
          • Top: 11 pt
          • Left: 488 pt
          • Bottom: 43 pt
          • Right: 573 pt
          • Anchoring: Right, Top
          Set Field [ Terminal::Output; "" ]

          Fields:


          Script Hierarchy

          Start
          ShellClosed
          SendCommand
          DataAvailable
          Close
          CheckKey

          Next Script: [ShellClosed]
          Script NameStart
          Run script with full access privilegesOff
          Include In MenuYes
          Layouts that use this script
            Scripts that use this script
              Script Definition
              Script Steps
              • #close existing shell if any
              • If [ Length ( $$Shell ) > 0 ]
              • Set Variable [ $r; Value:MBS("Shell.Release"; $$Shell) ]
              • Set Variable [ $$Shell; Value:"" ]
              • End If
              • #start new shell
              • Set Field [ Terminal::Output; "" ]
              • Set Variable [ $$shell; Value:MBS( "Shell.New" ) ]
              • If [ MBS("IsWindows") ]
              • Set Variable [ $s; Value:MBS( "Shell.Execute"; $$shell; "C:\Windows\System32\cmd.exe"; "/K") ]
              • Else
              • Set Variable [ $s; Value:MBS( "Shell.Execute"; $$shell; "/bin/sh"; "-i"; "-l") ]
              • End If
              • If [ $s ≠ "OK" ]
              • Show Custom Dialog [ Title: "Failed to run shell"; Message: $s; Default Button: “OK”, Commit: “Yes” ]
              • Else
              • Set Variable [ $r; Value:MBS( "Shell.SetDataAvailableScript"; $$shell; Get(FileName); "DataAvailable" ) ]
              • Set Variable [ $r; Value:MBS( "Shell.SetCompletedScript"; $$shell; Get(FileName); "ShellClosed" ) ]
              • #set command for you to try...
              • If [ MBS("IsWindows") ]
              • Set Field [ Terminal::Input; "ping -n 5 mbsplugins.de" ]
              • Else
              • Set Field [ Terminal::Input; "ping -c 5 mbsplugins.de" ]
              • 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: [Start]Next Script: [SendCommand]
                      Script NameShellClosed
                      Run script with full access privilegesOff
                      Include In MenuYes
                      Layouts that use this script
                        Scripts that use this script
                          Script Definition
                          Script Steps
                          • Show Custom Dialog [ Message: "Shell was closed."; 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: [ShellClosed]Next Script: [DataAvailable]
                                        Script NameSendCommand
                                        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 [ $Input; Value:Terminal::Input & Char(13) ]
                                          • Set Variable [ $$LastInput; Value:$Input ]
                                          • If [ MBS("IsWindows") ]
                                          • #for Windows add extra LF
                                          • Set Variable [ $Input; Value:$Input & Char(10) ]
                                          • End If
                                          • Set Variable [ $s; Value:MBS( "Shell.WriteInputText"; $$shell; $Input; "UTF-8") ]
                                          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: [SendCommand]Next Script: [Close]
                                                  Script NameDataAvailable
                                                  Run script with full access privilegesOff
                                                  Include In MenuYes
                                                  Layouts that use this script
                                                    Scripts that use this script
                                                      Script Definition
                                                      Script Steps
                                                      • #check error output
                                                      • Set Variable [ $error; Value:MBS( "Shell.ReadErrorText"; $$shell; "UTF-8") ]
                                                      • #convert line endings. Mac and Linux use LF, Windows does CRLF and we need CR for FileMaker
                                                      • Set Variable [ $error; Value:MBS( "Text.ReplaceNewline"; $error; 1) ]
                                                      • #check normal output
                                                      • Set Variable [ $result; Value:MBS( "Shell.ReadOutputText"; $$shell; "UTF-8") ]
                                                      • #convert line endings. Mac and Linux use LF, Windows does CRLF and we need CR for FileMaker
                                                      • Set Variable [ $result; Value:MBS( "Text.ReplaceNewline"; $result; 1) ]
                                                      • #check if we get input echod, Mac in $error and Win in $result
                                                      • If [ MBS("IsWindows") ]
                                                      • If [ Length ( $result ) > 0 ]
                                                      • #check if there is input
                                                      • If [ Length($$LastInput) > 0 and Left ( $result ; Length($$LastInput) ) = $$LastInput ]
                                                      • Set Field [ Terminal::Output; Terminal::Output & TextColor ( Left ( $result ; Length($$LastInput) ); /* gray */ RGB ( 200 ; 200 ; 0 ) ) ]
                                                      • Set Variable [ $result; Value:Middle( $result ; Length($$LastInput); Length($result) ) ]
                                                      • Set Variable [ $$LastInput; Value:"" ]
                                                      • End If
                                                      • End If
                                                      • If [ Length ( $error ) > 0 ]
                                                      • Set Field [ Terminal::Output; Terminal::Output & TextColor ( $error ; /* red */ RGB ( 255 ; 0 ; 0 ) ) ]
                                                      • End If
                                                      • If [ Length ( $result ) > 0 ]
                                                      • Set Field [ Terminal::Output; Terminal::Output & TextColor ( $result; /* white */ RGB ( 255 ; 255 ; 255 ) ) ]
                                                      • End If
                                                      • Else
                                                      • If [ Length ( $error ) > 0 ]
                                                      • #check if there is input
                                                      • If [ Length($$LastInput) > 0 and Left ( $error ; Length($$LastInput) ) = $$LastInput ]
                                                      • Set Field [ Terminal::Output; Terminal::Output & TextColor ( Left ( $error ; Length($$LastInput) ); /* gray */ RGB ( 200 ; 200 ; 0 ) ) ]
                                                      • Set Variable [ $error; Value:Middle( $error ; Length($$LastInput); Length($error) ) ]
                                                      • Set Variable [ $$LastInput; Value:"" ]
                                                      • End If
                                                      • End If
                                                      • If [ Length ( $result ) > 0 ]
                                                      • Set Field [ Terminal::Output; Terminal::Output & TextColor ( $result; /* white */ RGB ( 255 ; 255 ; 255 ) ) ]
                                                      • End If
                                                      • If [ Length ( $error ) > 0 ]
                                                      • Set Field [ Terminal::Output; Terminal::Output & TextColor ( $error ; /* red */ RGB ( 255 ; 0 ; 0 ) ) ]
                                                      • 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: [DataAvailable]Next Script: [CheckKey]
                                                              Script NameClose
                                                              Run script with full access privilegesOff
                                                              Include In MenuYes
                                                              Layouts that use this script
                                                                Scripts that use this script
                                                                  Script Definition
                                                                  Script Steps
                                                                  • If [ Length ( $$Shell ) > 0 ]
                                                                  • Set Variable [ $r; Value:MBS("Shell.Release"; $$Shell) ]
                                                                  • Set Variable [ $$Shell; Value:"" ]
                                                                  • 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: [Close]
                                                                                Script NameCheckKey
                                                                                Run script with full access privilegesOff
                                                                                Include In MenuNo
                                                                                Layouts that use this script
                                                                                  Scripts that use this script
                                                                                    Script Definition
                                                                                    Script Steps
                                                                                    • #check for return or enter keys
                                                                                    • Set Variable [ $key; Value:Code ( Get ( TriggerKeystroke ) ) ]
                                                                                    • If [ $key = 13 or $key = 10 ]
                                                                                    • Perform Script [ “SendCommand” ]
                                                                                    • Set Field [ Terminal::Input; "" ]
                                                                                    • Exit Script [ Result: False ]
                                                                                    • 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

                                                                                          Download example: Terminal

                                                                                          Used functions:




                                                                                          Links
                                                                                          MBS FileMaker tutorial videos