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

MBS FileMaker Plugin Example Databases

Find Pixels

All examples are included with download of MBS FileMaker Plugin.

Find Pixels.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 2
Value Lists 0
Custom Functions 0
Custom Menus 33
File Options
Default custom menu set [Standard FileMaker Menus]
Default theme Enlightened
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password On
Require iOS passcode Off
Show Sign-in fields Off
Switch to layout Off
Hide all toolbars Off
Script triggers
OnFirstWindowOpen Off
OnLastWindowClose Off
OnWindowOpen Off
OnWindowClose Off
OnFileAVPlayerChange Off
OnWindowTransaction Off
Thumbnail Settings
Generate Thumbnails On; Temporary

 

Tables

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

Fields

Table Name: Find Pixels - 2 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
InputImage Normal, Binary Auto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
      OutputImage Normal, Binary Auto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1

          Layout Objects: Find Pixels

          Regular Fields

          Field Name: Find Pixels::InputImage
          Field Properties Coordinates Field Format Field Behavior Quick Find
          • Top: 81 pt
          • Left: 138 pt
          • Bottom: 266 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 Properties Coordinates Field Format Field Behavior Quick Find
          • Top: 273 pt
          • Left: 138 pt
          • Bottom: 494 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

          Buttons

          Button Properties Coordinates Script/Script Step
            Type:
          • Text: Color Rows
          • Top: 101 pt
          • Left: 412 pt
          • Bottom: 132 pt
          • Right: 515 pt
          • Anchoring: Left, Top
          Perform Script [ “Find Rows” ]

          Scripts:


          Button Properties Coordinates Script/Script Step
            Type:
          • Text: Color Columns
          • Top: 139 pt
          • Left: 412 pt
          • Bottom: 170 pt
          • Right: 515 pt
          • Anchoring: Left, Top
          Perform Script [ “Find Columns” ]

          Scripts:


          Script Hierarchy

          Find Rows
          Find Columns

          Next Script: [Find Columns]
          Script Name Find Rows
          Run script with full access privileges Off
          Siri Shortcut Visible Off
          Include In Menu Yes
          Layouts that use this script
          Scripts that use this script
            Script Definition
            Script Steps
            • #We color the rows left/right with random colors, till we hit an other color than white
            • #Starts logging all plugin calls to a text file.
            • Set Variable [ $r; Value:MBS("Trace") ]
            • #Load image
            • Set Variable [ $img; Value:MBS("GMImage.NewFromContainer"; Find Pixels::InputImage) ]
            • #If an error occurred while loading the image, exit script and show dialoge
            • 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 [ Flush: Always ]
            • 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 Name Find Columns
                    Run script with full access privileges Off
                    Siri Shortcut Visible Off
                    Include In Menu Yes
                    Layouts that use this script
                    Scripts that use this script
                      Script Definition
                      Script Steps
                      • #We color the colums top down with random colors, till we hit an other color than white
                      • #Starts logging all plugin calls to a text file.
                      • Set Variable [ $r; Value:MBS("Trace") ]
                      • #Load image
                      • Set Variable [ $img; Value:MBS("GMImage.NewFromContainer"; Find Pixels::InputImage) ]
                      • #If an error occurred while loading the image, exit script and show dialoge
                      • 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 [ Flush: Always ]
                      • 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" ) ]
                      • #Release images
                      • Set Variable [ $r; Value:MBS("GMImage.Free"; $out) ]
                      • Set Variable [ $r; Value:MBS("GMImage.Free"; $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: