MBS FileMaker Plugin Example Databases

SmartCard ReadFile

All examples are included with download of MBS FileMaker Plugin.

SmartCard ReadFile.fmp12

Overview
Tables2
Relationships0
Layouts2
Scripts6
Value Lists2
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
SmartCard
1 field defined, 1 record
SmartCard
Card
11 fields defined, 1 record
Card

Fields

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

      Table Name: Card - 11 Fields
      Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
      ReaderNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          StateNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              ProtocolNormal, TextAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                  AttributesNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                      StateTextNormal, TextAuto-Enter: Validation:
                      • Only during data entry
                      Storage:
                      • Repetitions: 1
                      • Indexing: None
                      • Automatically create indexes as needed
                      • Index Language: German
                            CardTypeNormal, TextAuto-Enter:
                            • Allow editing
                            • Do not replace existing value for field (if any)
                            • Context table: Card
                              Calculation: If(Card::Attributes = "3BBF13008131FE45455041"; "ACOS04"; "") & If(Card::Attributes = "3BBF11008131FE45455041"; "ACOS04"; "") & If(Card::Attributes = "3bdf18008131fe588031905241016405c903ac73b7b1d444"; "CARDOS"; "")
                            Validation:
                            • Only during data entry
                            Storage:
                            • Repetitions: 1
                            • Indexing: None
                            • Automatically create indexes as needed
                            • Index Language: German
                                  FileIDNormal, TextAuto-Enter:
                                  • Allow editing
                                  Validation:
                                  • Only during data entry
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                      StatusNormal, TextAuto-Enter:
                                      • Allow editing
                                      Validation:
                                      • Only during data entry
                                      Storage:
                                      • Repetitions: 1
                                      • Indexing: None
                                      • Automatically create indexes as needed
                                      • Index Language: German
                                          FileDataNormal, TextAuto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                          • Indexing: None
                                          • Automatically create indexes as needed
                                          • Index Language: German
                                              JSONNormal, TextAuto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                              • Indexing: None
                                              • Automatically create indexes as needed
                                              • Index Language: German
                                                  PictureNormal, BinaryAuto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1

                                                      Layout Objects: SmartCard

                                                      Regular Fields

                                                      Field Name: SmartCard::Reader Name
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 60 pt
                                                      • Left: 112 pt
                                                      • Bottom: 81 pt
                                                      • Right: 365 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: List SmartCard Readers
                                                      • Top: 14 pt
                                                      • Left: 56 pt
                                                      • Bottom: 43 pt
                                                      • Right: 276 pt
                                                      • Anchoring: Left, Top
                                                      Perform Script [ “Initialize” ]

                                                      Scripts:


                                                      Button PropertiesCoordinatesScript/Script Step
                                                        Type:
                                                      • Text: Connect
                                                      • Top: 59 pt
                                                      • Left: 387 pt
                                                      • Bottom: 81 pt
                                                      • Right: 508 pt
                                                      • Anchoring: Left, Top
                                                      Perform Script [ “Connect”; Parameter: SmartCard::Reader Name ]

                                                      Scripts:

                                                      Fields:


                                                      Layout Objects: Card

                                                      Regular Fields

                                                      Field Name: Card::Reader
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 52 pt
                                                      • Left: 138 pt
                                                      • Bottom: 73 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: Card::State
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 73 pt
                                                      • Left: 138 pt
                                                      • Bottom: 94 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: Card::Protocol
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 96 pt
                                                      • Left: 138 pt
                                                      • Bottom: 117 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: Card::Attributes
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 119 pt
                                                      • Left: 138 pt
                                                      • Bottom: 140 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: Card::StateText
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 73 pt
                                                      • Left: 402 pt
                                                      • Bottom: 94 pt
                                                      • Right: 630 pt
                                                      • Anchoring: Left, Top
                                                      Field Format:
                                                      • Checkbox Set
                                                      • Display values from: States
                                                      Field Behavior:
                                                      • Touch keyboard type: Default for Data Type
                                                      • Go to next field using: Tab key
                                                      Yes

                                                      Field Name: Card::CardType
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 119 pt
                                                      • Left: 402 pt
                                                      • Bottom: 140 pt
                                                      • Right: 655 pt
                                                      • Anchoring: Left, Top
                                                      Field Format:
                                                      • Checkbox Set
                                                      • Display values from: CardTypes
                                                      Field Behavior:
                                                      • Touch keyboard type: Default for Data Type
                                                      • Go to next field using: Tab key
                                                      Yes

                                                      Field Name: Card::FileID
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 186 pt
                                                      • Left: 138 pt
                                                      • Bottom: 207 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: Card::Status
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 209 pt
                                                      • Left: 138 pt
                                                      • Bottom: 230 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: Card::FileData
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 232 pt
                                                      • Left: 138 pt
                                                      • Bottom: 385 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: Card::JSON
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 233 pt
                                                      • Left: 451 pt
                                                      • Bottom: 518 pt
                                                      • Right: 877 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: Card::Picture
                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                      • Top: 393 pt
                                                      • Left: 138 pt
                                                      • Bottom: 518 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: 12 pt
                                                      • Left: 12 pt
                                                      • Bottom: 34 pt
                                                      • Right: 77 pt
                                                      • Anchoring: Left, Top
                                                      Perform Script [ “Disconnect” ]

                                                      Scripts:


                                                      Button PropertiesCoordinatesScript/Script Step
                                                        Type:
                                                      • Text: Read File
                                                      • Top: 183 pt
                                                      • Left: 451 pt
                                                      • Bottom: 212 pt
                                                      • Right: 609 pt
                                                      • Anchoring: Left, Top
                                                      Perform Script [ “ReadFile” ]

                                                      Scripts:


                                                      Button PropertiesCoordinatesScript/Script Step
                                                        Type:
                                                      • Text: Check Status
                                                      • Top: 82 pt
                                                      • Left: 690 pt
                                                      • Bottom: 112 pt
                                                      • Right: 848 pt
                                                      • Anchoring: Left, Top
                                                      Perform Script [ “Check Status” ]

                                                      Scripts:


                                                      Value Lists

                                                      Value List NameSourceValuesOn Layouts
                                                      StatesCustom
                                                      • Present, Removed
                                                      CardTypesCustom
                                                      • ACOS04, CARDOS

                                                      Script Hierarchy

                                                      Initialize
                                                      Connect
                                                      Check Status
                                                      Disconnect
                                                      ReadFile
                                                      Split

                                                      Next Script: [Connect]
                                                      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
                                                        • Go to Layout [ “SmartCard” (SmartCard) ]
                                                        • Delete All Records [ No dialog ]
                                                        • If [ MBS( "SmartCard.Valid"; $$SmartCard ) ]
                                                        • #already inited
                                                        • Else
                                                        • Set Variable [ $$SmartCard; Value:MBS( "SmartCard.Init" ) ]
                                                        • End If
                                                        • If [ MBS("IsError") ]
                                                        • Show Custom Dialog [ Title: "Failed to initialize SmartCard"; Message: $$SmartCard; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                        • Else
                                                        • Set Variable [ $list; Value:MBS( "SmartCard.ListReaders"; $$SmartCard) ]
                                                        • Set Variable [ $count; Value:ValueCount ( $list ) ]
                                                        • If [ $count < 1 ]
                                                        • Show Custom Dialog [ Message: "No SmartCard Readers found."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                        • Else
                                                        • Set Variable [ $index; Value:1 ]
                                                        • Loop
                                                        • New Record/Request
                                                        • Set Field [ SmartCard::Reader Name; GetValue($list; $index) ]
                                                        • Commit Records/Requests [ No dialog ]
                                                        • #next
                                                        • Set Variable [ $index; Value:$index + 1 ]
                                                        • Exit Loop If [ $index > $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: [Initialize]Next Script: [Check Status]
                                                              Script NameConnect
                                                              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 [ $reader; Value:Get(ScriptParameter) ]
                                                                • Set Variable [ $r; Value:MBS( "SmartCard.Connect"; $$SmartCard; $Reader; "Shared"; "any" ) ]
                                                                • If [ MBS("IsError") ]
                                                                • Show Custom Dialog [ Title: "Connect failed"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                • Else
                                                                • Set Variable [ $Protocol; Value:MBS("SmartCard.GetActiveProtocol"; $$SmartCard) ]
                                                                • If [ $Protocol = "T0" ]
                                                                • Set Variable [ $$SendHeader; Value:MBS( "SmartCard.HeaderTemplate"; "T0" ) ]
                                                                • Else
                                                                • Set Variable [ $$SendHeader; Value:MBS( "SmartCard.HeaderTemplate"; "T1" ) ]
                                                                • End If
                                                                • Go to Layout [ “Card” (Card) ]
                                                                • Set Field [ Card::Reader; $Reader ]
                                                                • Set Field [ Card::Status; "" ]
                                                                • Set Field [ Card::FileData; "" ]
                                                                • Perform Script [ “Check Status” ]
                                                                • #for EID cards you may need to go into folder 3F00:
                                                                • // Set Variable [ $r; Value:MBS( "SmartCard.Transmit"; $$SmartCard; "T1"; "00A4020C023F0000"; 200 ) ]
                                                                • #Select subfolder DF 01
                                                                • // Set Variable [ $r; Value:MBS( "SmartCard.Transmit"; $$SmartCard; "T1"; "00A4020C02DF0100"; 200 ) ]
                                                                • 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: [Connect]Next Script: [Disconnect]
                                                                    Script NameCheck Status
                                                                    Run script with full access privilegesOff
                                                                    Include In MenuYes
                                                                    Layouts that use this script
                                                                    Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    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: [Check Status]Next Script: [ReadFile]
                                                                            Script NameDisconnect
                                                                            Run script with full access privilegesOff
                                                                            Include In MenuYes
                                                                            Layouts that use this script
                                                                            Scripts that use this script
                                                                              Script Definition
                                                                              Script Steps
                                                                              • If [ $$SmartCard ≠ "" ]
                                                                              • Set Variable [ $r; Value:MBS( "SmartCard.DisConnect"; $$SmartCard; "Eject") ]
                                                                              • If [ MBS("IsError") ]
                                                                              • Show Custom Dialog [ Title: "Disconnect failed"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                              • End If
                                                                              • End If
                                                                              • Go to Layout [ “SmartCard” (SmartCard) ]
                                                                              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: [Disconnect]Next Script: [Split]
                                                                                          Script NameReadFile
                                                                                          Run script with full access privilegesOff
                                                                                          Include In MenuYes
                                                                                          Layouts that use this script
                                                                                          Scripts that use this script
                                                                                            Script Definition
                                                                                            Script Steps
                                                                                            • #Read file from smartcard with APDU protocol.
                                                                                            • Set Variable [ $result; Value:MBS( "SmartCard.ReadFile"; $$SmartCard; Card::FileID) ]
                                                                                            • If [ MBS("IsError") ]
                                                                                            • Set Field [ Card::Status; $result ]
                                                                                            • Show Custom Dialog [ Title: "Error"; Message: $result; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                            • Else
                                                                                            • Set Field [ Card::FileData; $result ]
                                                                                            • Set Field [ Card::Status; "OK" ]
                                                                                            • If [ Card::FileID = "4035" ]
                                                                                            • #EID picture
                                                                                            • Set Field [ Card::Picture; HexDecode ( $result; "test.jpg" ) ]
                                                                                            • Else
                                                                                            • Perform Script [ “Split” ]
                                                                                            • 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: [ReadFile]
                                                                                                  Script NameSplit
                                                                                                  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 [ $json; Value:MBS("SmartCard.SplitValues"; Card::FileData) ]
                                                                                                    • If [ MBS("IsError") ]
                                                                                                    • Set Field [ Card::JSON; "" ]
                                                                                                    • Else
                                                                                                    • Set Field [ Card::JSON; MBS("JSON.Colorize"; $json) ]
                                                                                                    • 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: SmartCard ReadFile

                                                                                                            Used functions:




                                                                                                            Links
                                                                                                            MBS FileMaker tutorial videos