MBS FileMaker Plugin Example Databases

Find Pixels

All examples are included with download of MBS FileMaker Plugin.

Find Pixels.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts2
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
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
Find Pixels
2 fields defined, 1 record
Find Pixels

Fields

Table Name: Find Pixels - 2 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
InputImageNormal, BinaryAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
      OutputImageNormal, BinaryAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1

          Layout Objects: Find Pixels

          Regular Fields

          Field Name: Find Pixels::InputImage
          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
          • Top: 24 pt
          • Left: 138 pt
          • Bottom: 209 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
          No

          Field Name: Find Pixels::OutputImage
          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
          • Top: 216 pt
          • Left: 138 pt
          • Bottom: 437 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
          No

          Group Buttons

          Button PropertiesCoordinatesScript/Script Step
            Type:
          • Text: Color Rows
            Additional Properties:
          • Change to hand cursor over button
          • Rectangular
          • Top: 30 pt
          • Left: 432 pt
          • Bottom: 61 pt
          • Right: 535 pt
          • Anchoring: Left, Top
          Perform Script [ “Find Rows” ]

          Scripts:


          Button PropertiesCoordinatesScript/Script Step
            Type:
          • Text: Color Columns
            Additional Properties:
          • Change to hand cursor over button
          • Rectangular
          • Top: 72 pt
          • Left: 432 pt
          • Bottom: 103 pt
          • Right: 535 pt
          • Anchoring: Left, Top
          Perform Script [ “Find Columns” ]

          Scripts:


          Script Hierarchy

          Find Rows
          Find Columns

          Next Script: [Find Columns]
          Script NameFind Rows
          Run script with full access privilegesOff
          Include In MenuYes
          Layouts that use this script
          Scripts that use this script
            Script Definition
            Script Steps
            • Set Variable [ $r; Value:MBS("Trace") ]
            • #Load image
            • Set Variable [ $img; Value:MBS("GMImage.NewFromContainer"; Find Pixels::InputImage) ]
            • If [ MBS("Iserror") ]
            • Show Custom Dialog [ Message: "Failed to open image!"& ¶ & $img; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
            • Exit Script [ ]
            • End If
            • #make a copy of image, so we don't read our drawings!
            • Set Variable [ $out; Value:MBS( "GMImage.Copy"; $img ) ]
            • #Find white in rows and make colorful
            • Set Variable [ $ColorToSearch; Value:"white" ]
            • Set Variable [ $y; Value:0 ]
            • Set Variable [ $width; Value:MBS("GMImage.GetWidth"; $img) ]
            • Set Variable [ $height; Value:MBS("GMImage.GetHeight"; $img) ]
            • Loop
            • Set Variable [ $x; Value:0 ]
            • Set Variable [ $r; Value:MBS("GMImage.SetStrokeColor"; $out; "random") ]
            • Set Variable [ $r; Value:MBS("GMImage.SetFillColor"; $out; "random") ]
            • // Set Variable [ $r; Value:MBS("GMImage.GetFillColor"; $img) ]
            • // Set Variable [ $r; Value:MBS("GMImage.GetPixelColor"; $img; $x; $y) ]
            • Set Variable [ $pos; Value:MBS("GMImage.FindColorInRow"; $img; $x; $y; $ColorToSearch; 1; 3) ]
            • Exit Loop If [ MBS("IsError") ]
            • If [ $pos < 0 ]
            • Set Variable [ $r; Value:MBS("GMImage.DrawLine"; $out; $x; $y; $width; $y) ]
            • Else
            • Set Variable [ $r; Value:MBS("GMImage.DrawLine"; $out; $x; $y; $pos-1; $y) ]
            • End If
            • #next
            • Set Variable [ $y; Value:$y+1 ]
            • Exit Loop If [ $y = $height ]
            • End Loop
            • # Save
            • Set Field [ Find Pixels::OutputImage; MBS( "GMImage.WriteToPNGContainer"; $out; "test.png" ) ]
            • # Cleanup
            • Set Variable [ $r; Value:MBS("GMImage.Destroy"; $out) ]
            • Set Variable [ $r; Value:MBS("GMImage.Destroy"; $img) ]
            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: [Find Rows]
                    Script NameFind Columns
                    Run script with full access privilegesOff
                    Include In MenuYes
                    Layouts that use this script
                    Scripts that use this script
                      Script Definition
                      Script Steps
                      • Set Variable [ $r; Value:MBS("Trace") ]
                      • #Load image
                      • Set Variable [ $img; Value:MBS("GMImage.NewFromContainer"; Find Pixels::InputImage) ]
                      • If [ MBS("Iserror") ]
                      • Show Custom Dialog [ Message: "Failed to open image!"& ¶ & $img; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                      • Exit Script [ ]
                      • End If
                      • #make a copy of image, so we don't read our drawings!
                      • Set Variable [ $out; Value:MBS( "GMImage.Copy"; $img ) ]
                      • #Find white in rows and make colorful
                      • Set Variable [ $ColorToSearch; Value:"white" ]
                      • Set Variable [ $x; Value:0 ]
                      • Set Variable [ $width; Value:MBS("GMImage.GetWidth"; $img) ]
                      • Set Variable [ $height; Value:MBS("GMImage.GetHeight"; $img) ]
                      • Loop
                      • Set Variable [ $y; Value:0 ]
                      • Set Variable [ $r; Value:MBS("GMImage.SetStrokeColor"; $out; "random") ]
                      • Set Variable [ $r; Value:MBS("GMImage.SetFillColor"; $out; "random") ]
                      • // Set Variable [ $r; Value:MBS("GMImage.GetFillColor"; $img) ]
                      • // Set Variable [ $r; Value:MBS("GMImage.GetPixelColor"; $img; $x; $y) ]
                      • Set Variable [ $pos; Value:MBS("GMImage.FindColorInColumn"; $img; $x; $y; $ColorToSearch; 1; 3) ]
                      • Exit Loop If [ MBS("IsError") ]
                      • If [ $pos < 0 ]
                      • Set Variable [ $r; Value:MBS("GMImage.DrawLine"; $out; $x; $y; $x; $height) ]
                      • Else
                      • Set Variable [ $r; Value:MBS("GMImage.DrawLine"; $out; $x; $y; $x; $pos-1) ]
                      • End If
                      • #next
                      • Set Variable [ $x; Value:$x+1 ]
                      • Exit Loop If [ $x = $width ]
                      • End Loop
                      • # Save
                      • Set Field [ Find Pixels::OutputImage; MBS( "GMImage.WriteToPNGContainer"; $out; "test.png" ) ]
                      • # Cleanup
                      • Set Variable [ $r; Value:MBS("GMImage.Destroy"; $out) ]
                      • Set Variable [ $r; Value:MBS("GMImage.Destroy"; $img) ]
                      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: Find Pixels

                              Used functions:




                              Links
                              MBS FileMaker tutorial videos