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

MBS FileMaker Plugin Example Databases

Crop with Clicks

All examples are included with download of MBS FileMaker Plugin.

Crop with Clicks.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts6
Value Lists0
Custom Functions0
Custom Menus24
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
Crop with Clicks
12 fields defined, 0 record
Crop with Clicks

Fields

Table Name: Crop with Clicks - 12 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
PrimärschlüsselNormal, TextAuto-Enter: Validation:
  • Only during data entry
  • Not empty
  • Unique
  • Strict validation
Storage:
  • Repetitions: 1
  • Indexing: Minimal
  • Automatically create indexes as needed
  • Index Language: Unicode Raw
Eindeutige ID für jeden Datensatz in dieser Tabelle
          ErstellungszeitstempelNormal, TimestampAuto-Enter:
          • Creation timestamp
          Validation:
          • Only during data entry
          • Strict data type: 4 digit year
          • Not empty
          • Strict validation
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
          Datum und Uhrzeit der Erstellung der einzelnen Datensätze
                  ErstelltVonNormal, TextAuto-Enter:
                  • Creation account name
                  Validation:
                  • Only during data entry
                  • Not empty
                  • Strict validation
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                  Kontoname des Benutzers, der die einzelnen Datensätze erstellt hat
                          ÄnderungszeitstempelNormal, TimestampAuto-Enter:
                          • Modification timestamp
                          Validation:
                          • Only during data entry
                          • Strict data type: 4 digit year
                          • Not empty
                          • Strict validation
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                          Datum und Uhrzeit der letzten Änderung der einzelnen Datensätze
                                  GeändertVonNormal, TextAuto-Enter:
                                  • Modification account name
                                  Validation:
                                  • Only during data entry
                                  • Not empty
                                  • Strict validation
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                  Kontoname des Benutzers, der die einzelnen Datensätze zuletzt geändert hat
                                          Input ImageNormal, BinaryAuto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                              Output ImageNormal, BinaryAuto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                                  ImageNormal, BinaryAuto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                      X1Normal, NumberAuto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: German
                                                          X2Normal, NumberAuto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Repetitions: 1
                                                          • Indexing: None
                                                          • Automatically create indexes as needed
                                                          • Index Language: German
                                                              Y1Normal, NumberAuto-Enter:
                                                              • Allow editing
                                                              Validation:
                                                              • Only during data entry
                                                              Storage:
                                                              • Repetitions: 1
                                                              • Indexing: None
                                                              • Automatically create indexes as needed
                                                              • Index Language: German
                                                                  Y2Normal, NumberAuto-Enter:
                                                                  • Allow editing
                                                                  Validation:
                                                                  • Only during data entry
                                                                  Storage:
                                                                  • Repetitions: 1
                                                                  • Indexing: None
                                                                  • Automatically create indexes as needed
                                                                  • Index Language: German

                                                                      Layout Objects: Crop with Clicks

                                                                      Regular Fields

                                                                      Field Name: Crop with Clicks::Input Image
                                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                      • Top: 113 pt
                                                                      • Left: 123 pt
                                                                      • Bottom: 238 pt
                                                                      • Right: 376 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

                                                                      Field Name: Crop with Clicks::Output Image
                                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                      • Top: 113 pt
                                                                      • Left: 510 pt
                                                                      • Bottom: 238 pt
                                                                      • Right: 763 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

                                                                      Field Name: Crop with Clicks::Image
                                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                      • Top: 248 pt
                                                                      • Left: 10 pt
                                                                      • Bottom: 759 pt
                                                                      • Right: 763 pt
                                                                      • Anchoring: Left and Right, Top and 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
                                                                      No

                                                                      Field Name: Crop with Clicks::X1
                                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                      • Top: 248 pt
                                                                      • Left: 847 pt
                                                                      • Bottom: 279 pt
                                                                      • Right: 1006 pt
                                                                      • Anchoring: Right, 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: Crop with Clicks::X2
                                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                      • Top: 324 pt
                                                                      • Left: 847 pt
                                                                      • Bottom: 355 pt
                                                                      • Right: 1006 pt
                                                                      • Anchoring: Right, 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: Crop with Clicks::Y1
                                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                      • Top: 286 pt
                                                                      • Left: 847 pt
                                                                      • Bottom: 317 pt
                                                                      • Right: 1006 pt
                                                                      • Anchoring: Right, 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: Crop with Clicks::Y2
                                                                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                      • Top: 362 pt
                                                                      • Left: 847 pt
                                                                      • Bottom: 393 pt
                                                                      • Right: 1006 pt
                                                                      • Anchoring: Right, 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

                                                                      Group Buttons

                                                                      Button PropertiesCoordinatesScript/Script Step
                                                                      • Top: 248 pt
                                                                      • Left: 10 pt
                                                                      • Bottom: 759 pt
                                                                      • Right: 763 pt
                                                                      • Anchoring: Left and Right, Top and Bottom
                                                                      Perform Script [ “Click Image” ]

                                                                      Scripts:


                                                                      Buttons

                                                                      Button PropertiesCoordinatesScript/Script Step
                                                                        Type:
                                                                      • Text: Insert Image
                                                                      • Top: 155 pt
                                                                      • Left: 10 pt
                                                                      • Bottom: 201 pt
                                                                      • Right: 112 pt
                                                                      • Anchoring: Left, Top
                                                                      Perform Script [ “Load Image” ]

                                                                      Scripts:


                                                                      Button PropertiesCoordinatesScript/Script Step
                                                                        Type:
                                                                      • Text: Export Image
                                                                      • Top: 155 pt
                                                                      • Left: 387 pt
                                                                      • Bottom: 201 pt
                                                                      • Right: 489 pt
                                                                      • Anchoring: Left, Top
                                                                      Perform Script [ “Export Image” ]

                                                                      Scripts:


                                                                      Button PropertiesCoordinatesScript/Script Step
                                                                        Type:
                                                                      • Text: Crop Image
                                                                      • Top: 414 pt
                                                                      • Left: 826 pt
                                                                      • Bottom: 445 pt
                                                                      • Right: 996 pt
                                                                      • Anchoring: Left, Top
                                                                      Perform Script [ “Crop Image” ]

                                                                      Scripts:


                                                                      Script Hierarchy

                                                                      Load Image
                                                                      Export Image
                                                                      Update Image
                                                                      Crop Image
                                                                      Click Image
                                                                      Clear

                                                                      Next Script: [Export Image]
                                                                      Script NameLoad Image
                                                                      Run script with full access privilegesOff
                                                                      Include In MenuYes
                                                                      Layouts that use this script
                                                                      Scripts that use this script
                                                                        Script Definition
                                                                        Script Steps
                                                                        • #Let user pick a new picture
                                                                        • If [ Get(FoundCount) = 0 ]
                                                                        • New Record/Request
                                                                        • End If
                                                                        • Go to Field [ Crop with Clicks::Input Image ]
                                                                        • Insert Picture [ ]
                                                                        • If [ Get(LastError) = 0 ]
                                                                        • #Reset our points
                                                                        • Set Field [ Crop with Clicks::X1; "" ]
                                                                        • Set Field [ Crop with Clicks::X2; "" ]
                                                                        • Set Field [ Crop with Clicks::Y1; "" ]
                                                                        • Set Field [ Crop with Clicks::Y2; "" ]
                                                                        • Set Variable [ $$currentPoint; Value:0 ]
                                                                        • Perform Script [ “Update Image” ]
                                                                        • 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: [Load Image]Next Script: [Update Image]
                                                                              Script NameExport Image
                                                                              Run script with full access privilegesOff
                                                                              Include In MenuYes
                                                                              Layouts that use this script
                                                                              Scripts that use this script
                                                                                Script Definition
                                                                                Script Steps
                                                                                • Export Field Contents [ Crop with Clicks::Output Image; Create directories:No ]
                                                                                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: [Export Image]Next Script: [Crop Image]
                                                                                        Script NameUpdate Image
                                                                                        Run script with full access privilegesOff
                                                                                        Include In MenuYes
                                                                                        Layouts that use this script
                                                                                          Scripts that use this script
                                                                                          Script Definition
                                                                                          Script Steps
                                                                                          • #do we have points?
                                                                                          • Set Variable [ $HasP1; Value:IsEmpty(Crop with Clicks::X1) = False or IsEmpty(Crop with Clicks::Y1) = False ]
                                                                                          • Set Variable [ $HasP2; Value:IsEmpty(Crop with Clicks::X2) = False or IsEmpty(Crop with Clicks::Y2) = False ]
                                                                                          • If [ $HasP1 or $HasP2 ]
                                                                                          • Set Variable [ $img; Value:MBS("GMImage.NewFromContainer"; Crop with Clicks::Input Image) ]
                                                                                          • Set Variable [ $pw; Value:MBS("GMImage.GetWidth"; $img) ]
                                                                                          • Set Variable [ $ph; Value:MBS("GMImage.GetHeight"; $img) ]
                                                                                          • Set Variable [ $r; Value:MBS("GMImage.SetStrokeColor"; $img; "#FF0000") ]
                                                                                          • Set Variable [ $r; Value:MBS("GMImage.SetFillColor"; $img; "#FF0000") ]
                                                                                          • Set Variable [ $r; Value:MBS("GMImage.SetLineWidth"; $img; 3) ]
                                                                                          • #draw the 4 lines to highlight the cut points
                                                                                          • If [ not IsEmpty(Crop with Clicks::X1) ]
                                                                                          • Set Variable [ $r; Value:MBS("GMImage.drawLine"; $img; Crop with Clicks::X1; 0; Crop with Clicks::X1; $ph ) ]
                                                                                          • End If
                                                                                          • If [ not IsEmpty(Crop with Clicks::Y1) ]
                                                                                          • Set Variable [ $r; Value:MBS("GMImage.drawLine"; $img; 0; Crop with Clicks::Y1; $pw;Crop with Clicks::Y1 ) ]
                                                                                          • End If
                                                                                          • If [ not IsEmpty(Crop with Clicks::X2) ]
                                                                                          • Set Variable [ $r; Value:MBS("GMImage.drawLine"; $img; Crop with Clicks::X2; 0; Crop with Clicks::X2; $ph ) ]
                                                                                          • End If
                                                                                          • If [ not IsEmpty(Crop with Clicks::Y2) ]
                                                                                          • Set Variable [ $r; Value:MBS("GMImage.drawLine"; $img; 0; Crop with Clicks::Y2; $pw;Crop with Clicks::Y2 ) ]
                                                                                          • End If
                                                                                          • #Save and show result
                                                                                          • Set Field [ Crop with Clicks::Image; MBS("GMImage.WriteToJPEGContainer"; $img; "test.jpg") ]
                                                                                          • Set Variable [ $r; Value:MBS("GMImage.Destroy"; $img) ]
                                                                                          • Else
                                                                                          • #no points yet
                                                                                          • Set Field [ Crop with Clicks::Image; Crop with Clicks::Input Image ]
                                                                                          • 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: [Update Image]Next Script: [Click Image]
                                                                                                  Script NameCrop Image
                                                                                                  Run script with full access privilegesOff
                                                                                                  Include In MenuYes
                                                                                                  Layouts that use this script
                                                                                                  Scripts that use this script
                                                                                                    Script Definition
                                                                                                    Script Steps
                                                                                                    • #do we have points?
                                                                                                    • Set Variable [ $HasP1; Value:IsEmpty(Crop with Clicks::X1) = False or IsEmpty(Crop with Clicks::Y1) = False ]
                                                                                                    • Set Variable [ $HasP2; Value:IsEmpty(Crop with Clicks::X2) = False or IsEmpty(Crop with Clicks::Y2) = False ]
                                                                                                    • If [ $HasP1 or $HasP2 ]
                                                                                                    • #load image
                                                                                                    • Set Variable [ $img; Value:MBS("GMImage.NewFromContainer"; Crop with Clicks::Input Image) ]
                                                                                                    • #get pixel size
                                                                                                    • Set Variable [ $pw; Value:MBS("GMImage.GetWidth"; $img) ]
                                                                                                    • Set Variable [ $ph; Value:MBS("GMImage.GetHeight"; $img) ]
                                                                                                    • #this is where to crop
                                                                                                    • Set Variable [ $cropLeft; Value:0 ]
                                                                                                    • Set Variable [ $cropTop; Value:0 ]
                                                                                                    • Set Variable [ $cropWidth; Value:$pw ]
                                                                                                    • Set Variable [ $cropHeight; Value:$ph ]
                                                                                                    • #now we look which points we have
                                                                                                    • If [ IsEmpty ( Crop with Clicks::X1 ) ]
                                                                                                    • If [ IsEmpty ( Crop with Clicks::X2 ) ]
                                                                                                    • #no x points
                                                                                                    • Else
                                                                                                    • #crop left at X2
                                                                                                    • Set Variable [ $cropLeft; Value:Crop with Clicks::X2 ]
                                                                                                    • End If
                                                                                                    • Else If [ IsEmpty ( Crop with Clicks::X2 ) ]
                                                                                                    • #crop left at X1
                                                                                                    • Set Variable [ $cropLeft; Value:Crop with Clicks::X1 ]
                                                                                                    • Else
                                                                                                    • #got x1 and x2
                                                                                                    • If [ Crop with Clicks::X1 < Crop with Clicks::X2 ]
                                                                                                    • Set Variable [ $cropLeft; Value:Crop with Clicks::X1 ]
                                                                                                    • Set Variable [ $cropWidth; Value:Crop with Clicks::X2 - Crop with Clicks::X1 ]
                                                                                                    • Else If [ Crop with Clicks::X1 > Crop with Clicks::X2 ]
                                                                                                    • Set Variable [ $cropLeft; Value:Crop with Clicks::X2 ]
                                                                                                    • Set Variable [ $cropWidth; Value:Crop with Clicks::X1 - Crop with Clicks::X2 ]
                                                                                                    • Else
                                                                                                    • #equal points?
                                                                                                    • Set Variable [ $cropLeft; Value:Crop with Clicks::X1 ]
                                                                                                    • End If
                                                                                                    • End If
                                                                                                    • If [ IsEmpty ( Crop with Clicks::Y1 ) ]
                                                                                                    • If [ IsEmpty ( Crop with Clicks::Y2 ) ]
                                                                                                    • #no y points
                                                                                                    • Else
                                                                                                    • #crop left at Y2
                                                                                                    • Set Variable [ $cropTop; Value:Crop with Clicks::Y2 ]
                                                                                                    • End If
                                                                                                    • Else If [ IsEmpty ( Crop with Clicks::Y2 ) ]
                                                                                                    • #crop top at Y1
                                                                                                    • Set Variable [ $cropTop; Value:Crop with Clicks::Y1 ]
                                                                                                    • Else
                                                                                                    • #got y1 and y2
                                                                                                    • If [ Crop with Clicks::Y1 < Crop with Clicks::Y2 ]
                                                                                                    • Set Variable [ $cropTop; Value:Crop with Clicks::Y1 ]
                                                                                                    • Set Variable [ $cropHeight; Value:Crop with Clicks::Y2 - Crop with Clicks::Y1 ]
                                                                                                    • Else If [ Crop with Clicks::Y1 > Crop with Clicks::Y2 ]
                                                                                                    • Set Variable [ $cropTop; Value:Crop with Clicks::Y2 ]
                                                                                                    • Set Variable [ $cropHeight; Value:Crop with Clicks::Y1 - Crop with Clicks::Y2 ]
                                                                                                    • Else
                                                                                                    • #equal points?
                                                                                                    • Set Variable [ $cropTop; Value:Crop with Clicks::Y1 ]
                                                                                                    • End If
                                                                                                    • End If
                                                                                                    • #Save result
                                                                                                    • Set Variable [ $r; Value:MBS("GMImage.crop"; $img; $cropWidth & "x" & $cropHeight & "+" & $cropLeft & "+" & $cropTop) ]
                                                                                                    • Set Field [ Crop with Clicks::Output Image; MBS("GMImage.WriteToPNGContainer"; $img; "test.png") ]
                                                                                                    • Set Variable [ $r; Value:MBS("GMImage.Destroy"; $img) ]
                                                                                                    • Else
                                                                                                    • #no points yet
                                                                                                    • Set Field [ Crop with Clicks::Output Image; Crop with Clicks::Input Image ]
                                                                                                    • 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: [Crop Image]Next Script: [Clear]
                                                                                                            Script NameClick Image
                                                                                                            Run script with full access privilegesOff
                                                                                                            Include In MenuNo
                                                                                                            Layouts that use this script
                                                                                                            Scripts that use this script
                                                                                                              Script Definition
                                                                                                              Script Steps
                                                                                                              • #Find position of container on layout
                                                                                                              • Set Variable [ $pos; Value:FieldBounds ( Get(FileName) ; Get(LayoutName) ; "Image" ) ]
                                                                                                              • Set Variable [ $ContainerLeft; Value:GetAsNumber(MiddleWords($pos; 1;1)) ]
                                                                                                              • Set Variable [ $ContainerTop; Value:GetAsNumber(MiddleWords($pos; 2;1)) ]
                                                                                                              • Set Variable [ $ContainerRight; Value:GetAsNumber(MiddleWords($pos; 3;1)) ]
                                                                                                              • Set Variable [ $ContainerBottom; Value:GetAsNumber(MiddleWords($pos; 4;1)) ]
                                                                                                              • Set Variable [ $ContainerWidth; Value:$ContainerRight - $ContainerLeft ]
                                                                                                              • Set Variable [ $ContainerHeight; Value:$ContainerBottom - $ContainerTop ]
                                                                                                              • #The container has a border, so we need to be a bit smaller
                                                                                                              • Set Variable [ $ContainerInset; Value:9 // may be theme dependent? ]
                                                                                                              • Set Variable [ $ContainerInnerWidth; Value:$ContainerWidth - $ContainerInset * 2 ]
                                                                                                              • Set Variable [ $ContainerInnerHeight; Value:$ContainerHeight - $ContainerInset * 2 ]
                                                                                                              • Set Variable [ $ContainerInnerLeft; Value:0 ]
                                                                                                              • Set Variable [ $ContainerInnerTop; Value:0 ]
                                                                                                              • #now ask for image width. This could be cached
                                                                                                              • Set Variable [ $ImageWidth; Value:GetContainerAttribute ( Crop with Clicks::Image ; "width" ) ]
                                                                                                              • Set Variable [ $ImageHeight; Value:GetContainerAttribute ( Crop with Clicks::Image ; "height" ) ]
                                                                                                              • #position of window
                                                                                                              • Set Variable [ $WindowLeft; Value:Get ( WindowLeft ) ]
                                                                                                              • Set Variable [ $WindowTop; Value:Get ( WindowTop ) + 130 // 130 = height of toolbar with menubar ]
                                                                                                              • #now see how we need to scale down the image
                                                                                                              • Set Variable [ $ContainerAspectRatio; Value:$ContainerInnerWidth / $ContainerInnerHeight ]
                                                                                                              • Set Variable [ $ImageAspectRatio; Value:$ImageWidth / $ImageHeight ]
                                                                                                              • If [ $ImageWidth < $ContainerInnerWidth and $ImageHeight < $ContainerInnerHeight ]
                                                                                                              • #small image in the center
                                                                                                              • Set Variable [ $ContainerImageWidth; Value:$ImageWidth ]
                                                                                                              • Set Variable [ $ContainerImageHeight; Value:$ImageHeight ]
                                                                                                              • Set Variable [ $ContainerInnerLeft; Value:($ContainerInnerWidth - $ContainerImageWidth) / 2 ]
                                                                                                              • Set Variable [ $ContainerInnerTop; Value:($ContainerInnerHeight - $ContainerImageHeight) / 2 ]
                                                                                                              • Else If [ $ContainerAspectRatio > $ImageAspectRatio ]
                                                                                                              • #scale to height
                                                                                                              • Set Variable [ $ContainerImageWidth; Value:$ContainerInnerHeight * $ImageWidth / $ImageHeight ]
                                                                                                              • Set Variable [ $ContainerImageHeight; Value:$ContainerInnerHeight ]
                                                                                                              • Set Variable [ $ContainerInnerLeft; Value:($ContainerInnerWidth - $ContainerImageWidth) / 2 ]
                                                                                                              • Else
                                                                                                              • #scale to width
                                                                                                              • Set Variable [ $ContainerImageWidth; Value:$ContainerInnerWidth ]
                                                                                                              • Set Variable [ $ContainerImageHeight; Value:$ContainerInnerWidth * $ImageHeight / $ImageWidth ]
                                                                                                              • Set Variable [ $ContainerInnerTop; Value:($ContainerInnerHeight - $ContainerImageHeight) / 2 ]
                                                                                                              • End If
                                                                                                              • #now we have the delta for the mouse. That is top/left distance between screen and container image
                                                                                                              • Set Variable [ $ContainerDeltaX; Value:$ContainerLeft + $WindowLeft + $ContainerInset + $ContainerInnerLeft ]
                                                                                                              • Set Variable [ $ContainerDeltaY; Value:$ContainerTop + $WindowTop + $ContainerInset + $ContainerInnerTop ]
                                                                                                              • #Calculate position of mouse on screen relative to display
                                                                                                              • If [ MBS("IsWindows") ]
                                                                                                              • #window is special: Mouse coordinates are in pixel and we need points. And also we need to move everything 7 pixel to top left
                                                                                                              • Set Variable [ $ScreenScale; Value:MBS( "Screen.Scale"; 0) ]
                                                                                                              • Set Variable [ $MouseX; Value:MBS("RemoteControl.MouseX") / $ScreenScale - $ContainerDeltaX - 7 ]
                                                                                                              • Set Variable [ $MouseY; Value:MBS("RemoteControl.MouseY") / $ScreenScale - $ContainerDeltaY - 7 ]
                                                                                                              • Else
                                                                                                              • Set Variable [ $MouseX; Value:MBS("RemoteControl.MouseX") - $ContainerDeltaX ]
                                                                                                              • Set Variable [ $MouseY; Value:MBS("RemoteControl.MouseY") - $ContainerDeltaY ]
                                                                                                              • End If
                                                                                                              • #scale mouse to pixels in our source image
                                                                                                              • Set Variable [ $x; Value:$MouseX * $ImageWidth / $ContainerImageWidth ]
                                                                                                              • Set Variable [ $y; Value:$MouseY * $ImageHeight / $ContainerImageHeight ]
                                                                                                              • #store points switching between first and second
                                                                                                              • If [ $$currentPoint = 2 ]
                                                                                                              • Set Field [ Crop with Clicks::X2; Round ( $x; 0 ) ]
                                                                                                              • Set Field [ Crop with Clicks::Y2; Round ( $y ; 0 ) ]
                                                                                                              • Set Variable [ $$currentPoint; Value:1 ]
                                                                                                              • Else
                                                                                                              • Set Field [ Crop with Clicks::X1; Round ( $x; 0 ) ]
                                                                                                              • Set Field [ Crop with Clicks::Y1; Round ( $y ; 0 ) ]
                                                                                                              • Set Variable [ $$currentPoint; Value:2 ]
                                                                                                              • End If
                                                                                                              • Perform Script [ “Update Image” ]
                                                                                                              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: [Click Image]
                                                                                                                    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
                                                                                                                        • Delete All Records [ No dialog ]
                                                                                                                        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: Crop with Clicks

                                                                                                                                      Used functions: