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

MBS FileMaker Plugin Example Databases

Batch Download

All examples are included with download of MBS FileMaker Plugin.

Batch Download.fmp12

Overview
Tables2
Relationships0
Layouts2
Scripts3
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
Batch Downloader
14 fields defined, 1 record
Batch Downloader
Downloads
8 fields defined, 0 record
Downloads

Fields

Table Name: Batch Downloader - 14 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
SMTP ServerNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
          SMTP UsernameNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
                  SMTP PasswordNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                          From NameNormal, TextAuto-Enter:
                          • Allow editing
                          Validation:
                          • Only during data entry
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                                  From EmailNormal, TextAuto-Enter:
                                  • Allow editing
                                  Validation:
                                  • Only during data entry
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                          BCC NameNormal, TextAuto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                          • Indexing: None
                                          • Automatically create indexes as needed
                                          • Index Language: German
                                                  BCC EmailNormal, TextAuto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                  • Indexing: None
                                                  • Automatically create indexes as needed
                                                  • Index Language: German
                                                          SMTP PortNormal, TextAuto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Repetitions: 1
                                                          • Indexing: None
                                                          • Automatically create indexes as needed
                                                          • Index Language: German
                                                                  SubjectNormal, TextAuto-Enter:
                                                                  • Allow editing
                                                                  Validation:
                                                                  • Only during data entry
                                                                  Storage:
                                                                  • Repetitions: 1
                                                                  • Indexing: None
                                                                  • Automatically create indexes as needed
                                                                  • Index Language: German
                                                                          Text ContentNormal, TextAuto-Enter:
                                                                          • Allow editing
                                                                          Validation:
                                                                          • Only during data entry
                                                                          Storage:
                                                                          • Repetitions: 1
                                                                          • Indexing: None
                                                                          • Automatically create indexes as needed
                                                                          • Index Language: German
                                                                                  HTML ContentNormal, TextAuto-Enter:
                                                                                  • Allow editing
                                                                                  Validation:
                                                                                  • Only during data entry
                                                                                  Storage:
                                                                                  • Repetitions: 1
                                                                                  • Indexing: None
                                                                                  • Automatically create indexes as needed
                                                                                  • Index Language: German
                                                                                          AttachmentNormal, BinaryAuto-Enter:
                                                                                          • Allow editing
                                                                                          Validation:
                                                                                          • Only during data entry
                                                                                          Storage:
                                                                                          • Repetitions: 1
                                                                                                  Inline GraphicsNormal, BinaryAuto-Enter:
                                                                                                  • Allow editing
                                                                                                  Validation:
                                                                                                  • Only during data entry
                                                                                                  Storage:
                                                                                                  • Repetitions: 1
                                                                                                          URL ListNormal, TextAuto-Enter:
                                                                                                          • Allow editing
                                                                                                          Validation:
                                                                                                          • Only during data entry
                                                                                                          Storage:
                                                                                                          • Repetitions: 1
                                                                                                          • Indexing: None
                                                                                                          • Automatically create indexes as needed
                                                                                                          • Index Language: German

                                                                                                              Table Name: Downloads - 8 Fields
                                                                                                              Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
                                                                                                              URLNormal, TextAuto-Enter:
                                                                                                              • Allow editing
                                                                                                              Validation:
                                                                                                              • Only during data entry
                                                                                                              Storage:
                                                                                                              • Repetitions: 1
                                                                                                              • Indexing: None
                                                                                                              • Automatically create indexes as needed
                                                                                                              • Index Language: German
                                                                                                                  ContentNormal, 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
                                                                                                                          Finished TimeStampNormal, TimestampAuto-Enter:
                                                                                                                          • Allow editing
                                                                                                                          Validation:
                                                                                                                          • Only during data entry
                                                                                                                          Storage:
                                                                                                                          • Repetitions: 1
                                                                                                                          • Indexing: None
                                                                                                                          • Automatically create indexes as needed
                                                                                                                          • Index Language: German
                                                                                                                              Started TimeStampNormal, TimestampAuto-Enter:
                                                                                                                              • Allow editing
                                                                                                                              Validation:
                                                                                                                              • Only during data entry
                                                                                                                              Storage:
                                                                                                                              • Repetitions: 1
                                                                                                                              • Indexing: None
                                                                                                                              • Automatically create indexes as needed
                                                                                                                              • Index Language: German
                                                                                                                                  ErrorLogNormal, TextAuto-Enter:
                                                                                                                                  • Allow editing
                                                                                                                                  Validation:
                                                                                                                                  • Only during data entry
                                                                                                                                  Storage:
                                                                                                                                  • Repetitions: 1
                                                                                                                                  • Indexing: None
                                                                                                                                  • Automatically create indexes as needed
                                                                                                                                  • Index Language: German
                                                                                                                                      IDNormal, NumberAuto-Enter:
                                                                                                                                      • Allow editing
                                                                                                                                      • Serial: Generate: On creation, Next value: 816, Increment: 1
                                                                                                                                      Validation:
                                                                                                                                      • Only during data entry
                                                                                                                                      Storage:
                                                                                                                                      • Repetitions: 1
                                                                                                                                      • Indexing: All
                                                                                                                                      • Index Language: German
                                                                                                                                          ResultNormal, TextAuto-Enter:
                                                                                                                                          • Allow editing
                                                                                                                                          Validation:
                                                                                                                                          • Only during data entry
                                                                                                                                          Storage:
                                                                                                                                          • Repetitions: 1
                                                                                                                                          • Indexing: None
                                                                                                                                          • Automatically create indexes as needed
                                                                                                                                          • Index Language: German

                                                                                                                                              Layout Objects: Batch Downloader

                                                                                                                                              Regular Fields

                                                                                                                                              Field Name: Batch Downloader::URL List
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 64 pt
                                                                                                                                              • Left: 78 pt
                                                                                                                                              • Bottom: 614 pt
                                                                                                                                              • Right: 991 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
                                                                                                                                              Yes

                                                                                                                                              Buttons

                                                                                                                                              Button PropertiesCoordinatesScript/Script Step
                                                                                                                                                Type:
                                                                                                                                              • Text: Download serial
                                                                                                                                              • Top: 632 pt
                                                                                                                                              • Left: 610 pt
                                                                                                                                              • Bottom: 656 pt
                                                                                                                                              • Right: 789 pt
                                                                                                                                              • Anchoring: Right, Bottom
                                                                                                                                              Perform Script [ “Download serial” ]

                                                                                                                                              Scripts:


                                                                                                                                              Button PropertiesCoordinatesScript/Script Step
                                                                                                                                                Type:
                                                                                                                                              • Text: Download parallel
                                                                                                                                              • Top: 632 pt
                                                                                                                                              • Left: 812 pt
                                                                                                                                              • Bottom: 656 pt
                                                                                                                                              • Right: 991 pt
                                                                                                                                              • Anchoring: Right, Bottom
                                                                                                                                              Perform Script [ “Download parallel” ]

                                                                                                                                              Scripts:


                                                                                                                                              Layout Objects: Downloads

                                                                                                                                              Regular Fields

                                                                                                                                              Field Name: Downloads::URL
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 52 pt
                                                                                                                                              • Left: 138 pt
                                                                                                                                              • Bottom: 73 pt
                                                                                                                                              • Right: 737 pt
                                                                                                                                              • Anchoring: Left and 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: Downloads::Content
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 75 pt
                                                                                                                                              • Left: 138 pt
                                                                                                                                              • Bottom: 96 pt
                                                                                                                                              • Right: 737 pt
                                                                                                                                              • Anchoring: Left and 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: Downloads::Status
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 126 pt
                                                                                                                                              • Left: 138 pt
                                                                                                                                              • Bottom: 147 pt
                                                                                                                                              • Right: 737 pt
                                                                                                                                              • Anchoring: Left and 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: Downloads::Finished TimeStamp
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 149 pt
                                                                                                                                              • Left: 138 pt
                                                                                                                                              • Bottom: 170 pt
                                                                                                                                              • Right: 737 pt
                                                                                                                                              • Anchoring: Left and 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: Downloads::Started TimeStamp
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 172 pt
                                                                                                                                              • Left: 138 pt
                                                                                                                                              • Bottom: 193 pt
                                                                                                                                              • Right: 737 pt
                                                                                                                                              • Anchoring: Left and 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: Downloads::ErrorLog
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 195 pt
                                                                                                                                              • Left: 138 pt
                                                                                                                                              • Bottom: 413 pt
                                                                                                                                              • Right: 737 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
                                                                                                                                              Yes

                                                                                                                                              Field Name: Downloads::ID
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 57 pt
                                                                                                                                              • Left: 931 pt
                                                                                                                                              • Bottom: 78 pt
                                                                                                                                              • Right: 1010 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: Downloads::Result
                                                                                                                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                                                                                                              • Top: 100 pt
                                                                                                                                              • Left: 138 pt
                                                                                                                                              • Bottom: 121 pt
                                                                                                                                              • Right: 737 pt
                                                                                                                                              • Anchoring: Left and 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

                                                                                                                                              Script Hierarchy

                                                                                                                                              Download serial
                                                                                                                                              Download parallel
                                                                                                                                              HandleFinishedCURL

                                                                                                                                              Next Script: [Download parallel]
                                                                                                                                              Script NameDownload serial
                                                                                                                                              Run script with full access privilegesOff
                                                                                                                                              Include In MenuYes
                                                                                                                                              Layouts that use this script
                                                                                                                                              Scripts that use this script
                                                                                                                                                Script Definition
                                                                                                                                                Script Steps
                                                                                                                                                • #This script downloads with one connection
                                                                                                                                                • #Collect all parameters in variables
                                                                                                                                                • Go to Layout [ “Batch Downloader” (Batch Downloader) ]
                                                                                                                                                • Set Variable [ $StartTime; Value:Get(CurrentHostTimestamp) ]
                                                                                                                                                • Set Variable [ $URLList; Value:Batch Downloader::URL List ]
                                                                                                                                                • Set Variable [ $URLCount; Value:ValueCount($URLList) ]
                                                                                                                                                • Go to Layout [ “Downloads” (Downloads) ]
                                                                                                                                                • #progress dialog
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.Reset") ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.SetTitle"; "Downloading URLs") ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Sending " & $URLCount & " URLs...") ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.SetButtonCaption"; "Cancel") ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; -1) ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.Show") ]
                                                                                                                                                • #Loop
                                                                                                                                                • Set Variable [ $curl; Value:"" ]
                                                                                                                                                • Set Variable [ $count; Value:0 ]
                                                                                                                                                • Set Variable [ $needNewCURL; Value:1 ]
                                                                                                                                                • Loop
                                                                                                                                                • #check progress
                                                                                                                                                • Set Variable [ $count; Value:$count + 1 ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; 100 * $count / $URLCount) ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.SetBottomText"; $count & " of " & $URLCount & ": " & Downloads::URL) ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.Update") ]
                                                                                                                                                • If [ $needNewCURL ]
                                                                                                                                                • Set Variable [ $r; Value:If(IsEmpty($curl); 0; MBS("CURL.Cleanup"; $curl)) ]
                                                                                                                                                • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                                                                                                                • End If
                                                                                                                                                • # Start Download
                                                                                                                                                • Set Variable [ $URL; Value:GetValue($URLList; $count) ]
                                                                                                                                                • If [ Length ( $URL ) > 1 ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("CURL.SetOptionURL"; $curl; $URL) ]
                                                                                                                                                • New Record/Request
                                                                                                                                                • Set Field [ Downloads::Status; "started" ]
                                                                                                                                                • Set Field [ Downloads::URL; $URL ]
                                                                                                                                                • Set Field [ Downloads::Started TimeStamp; Get ( CurrentTimestamp ) ]
                                                                                                                                                • Commit Records/Requests [ No dialog ]
                                                                                                                                                • #Run the transfer
                                                                                                                                                • Set Variable [ $result; Value:MBS("CURL.Perform"; $curl) ]
                                                                                                                                                • #get debug messages
                                                                                                                                                • Set Field [ Downloads::ErrorLog; MBS("CURL.GetDebugMessages"; $curl; "UTF-8") ]
                                                                                                                                                • Set Field [ Downloads::Result; $result ]
                                                                                                                                                • If [ $result = "OK" ]
                                                                                                                                                • Set Field [ Downloads::Status; "Success" ]
                                                                                                                                                • Set Field [ Downloads::Content; MBS("CURL.GetResultAsText"; $curl; "UTF-8") ]
                                                                                                                                                • Set Field [ Downloads::Finished TimeStamp; Get(CurrentTimestamp) ]
                                                                                                                                                • Else
                                                                                                                                                • Set Field [ Downloads::Status; "Failed" ]
                                                                                                                                                • Set Field [ Downloads::Finished TimeStamp; "" ]
                                                                                                                                                • End If
                                                                                                                                                • Commit Records/Requests [ Skip data entry validation; No dialog ]
                                                                                                                                                • End If
                                                                                                                                                • # Next download
                                                                                                                                                • Exit Loop If [ MBS("ProgressDialog.GetCancel") ]
                                                                                                                                                • Exit Loop If [ $count > $URLCount ]
                                                                                                                                                • Pause/Resume Script [ Duration (seconds): ,1 ]
                                                                                                                                                • Set Variable [ $needNewCURL; Value:Mod ( GetAsNumber ( $count ) ; 50 ) = 0 ]
                                                                                                                                                • End Loop
                                                                                                                                                • # Cleanup
                                                                                                                                                • Set Variable [ $r; Value:MBS("CURL.Release"; $curl) ]
                                                                                                                                                • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                                                                                                • Go to Layout [ original layout ]
                                                                                                                                                • Set Variable [ $EndTime; Value:Get(CurrentHostTimestamp) ]
                                                                                                                                                • Show Custom Dialog [ Title: "All Done."; Message: "Duration: " & ($EndTime-$StartTime); Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “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: [Download serial]Next Script: [HandleFinishedCURL]
                                                                                                                                                      Script NameDownload parallel
                                                                                                                                                      Run script with full access privilegesOff
                                                                                                                                                      Include In MenuYes
                                                                                                                                                      Layouts that use this script
                                                                                                                                                      Scripts that use this script
                                                                                                                                                        Script Definition
                                                                                                                                                        Script Steps
                                                                                                                                                        • #This script downloads with 8 parallel connections
                                                                                                                                                        • Set Variable [ $MaxConnections; Value:8 ]
                                                                                                                                                        • #Collect all parameters in variables
                                                                                                                                                        • Go to Layout [ “Batch Downloader” (Batch Downloader) ]
                                                                                                                                                        • Set Variable [ $StartTime; Value:Get(CurrentHostTimestamp) ]
                                                                                                                                                        • Set Variable [ $URLList; Value:Batch Downloader::URL List ]
                                                                                                                                                        • Set Variable [ $URLCount; Value:ValueCount($URLList) ]
                                                                                                                                                        • Go to Layout [ “Downloads” (Downloads) ]
                                                                                                                                                        • #progress dialog
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.Reset") ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.SetTitle"; "Downloading URLs") ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Sending " & $URLCount & " URLs...") ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.SetButtonCaption"; "Cancel") ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; -1) ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.Show") ]
                                                                                                                                                        • #Loop
                                                                                                                                                        • Set Variable [ $count; Value:0 ]
                                                                                                                                                        • Set Variable [ $curls; Value:"" ]
                                                                                                                                                        • Set Variable [ $needNewCURL; Value:1 ]
                                                                                                                                                        • Loop
                                                                                                                                                        • #check progress
                                                                                                                                                        • Set Variable [ $count; Value:$count + 1 ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; 100 * $count / $URLCount) ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.SetBottomText"; $count & " of " & $URLCount & ": " & Downloads::URL) ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.Update") ]
                                                                                                                                                        • #Find a non busy curl connection
                                                                                                                                                        • Set Variable [ $index; Value:1 ]
                                                                                                                                                        • Loop
                                                                                                                                                        • If [ $curls[$index] = "" ]
                                                                                                                                                        • #found free index, setup new CURL session
                                                                                                                                                        • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                                                                                                                        • Set Variable [ $curls[$index]; Value:$curl ]
                                                                                                                                                        • Exit Loop If [ 1 ]
                                                                                                                                                        • Else
                                                                                                                                                        • #found used index
                                                                                                                                                        • If [ MBS( "CURL.IsRunning"; $curls[$index] ) = 0 ]
                                                                                                                                                        • #found used index which is done
                                                                                                                                                        • Perform Script [ “HandleFinishedCURL”; Parameter: $curls[$index] ]
                                                                                                                                                        • Set Variable [ $curl; Value:$curls[$index] ]
                                                                                                                                                        • Exit Loop If [ 1 ]
                                                                                                                                                        • End If
                                                                                                                                                        • End If
                                                                                                                                                        • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                                                        • If [ $index > $MaxConnections ]
                                                                                                                                                        • #Wait
                                                                                                                                                        • Set Variable [ $index; Value:1 ]
                                                                                                                                                        • Pause/Resume Script [ Duration (seconds): ,01 ]
                                                                                                                                                        • End If
                                                                                                                                                        • End Loop
                                                                                                                                                        • # Start Download
                                                                                                                                                        • Set Variable [ $URL; Value:GetValue($URLList; $count) ]
                                                                                                                                                        • If [ Length ( $URL ) > 1 ]
                                                                                                                                                        • Set Variable [ $r; Value:MBS("CURL.SetOptionURL"; $curl; $URL) ]
                                                                                                                                                        • New Record/Request
                                                                                                                                                        • Set Field [ Downloads::Status; "started" ]
                                                                                                                                                        • Set Field [ Downloads::URL; $URL ]
                                                                                                                                                        • Set Field [ Downloads::Started TimeStamp; Get ( CurrentTimestamp ) ]
                                                                                                                                                        • Commit Records/Requests [ No dialog ]
                                                                                                                                                        • #Require new connection every 50 downloads
                                                                                                                                                        • Set Variable [ $r; Value:MBS("CURL.SetOptionFreshConnect"; $curl; Mod ( GetAsNumber ( $count ) ; 50 ) = 0) // new connection every around 50 downloads ]
                                                                                                                                                        • #Run the transfer
                                                                                                                                                        • Set Variable [ $result; Value:MBS("CURL.SetTag"; $curl; Downloads::ID) ]
                                                                                                                                                        • Set Variable [ $result; Value:MBS("CURL.PerformInBackground"; $curl) ]
                                                                                                                                                        • End If
                                                                                                                                                        • # Next download
                                                                                                                                                        • Exit Loop If [ $count > $URLCount ]
                                                                                                                                                        • Exit Loop If [ MBS("ProgressDialog.GetCancel") ]
                                                                                                                                                        • Pause/Resume Script [ Duration (seconds): ,01 ]
                                                                                                                                                        • End Loop
                                                                                                                                                        • #Wait for all to close
                                                                                                                                                        • Set Variable [ $index; Value:1 ]
                                                                                                                                                        • Loop
                                                                                                                                                        • If [ $curls[$index] = "" ]
                                                                                                                                                        • #found free index, no used
                                                                                                                                                        • Else
                                                                                                                                                        • #found used index, wait for finished
                                                                                                                                                        • Loop
                                                                                                                                                        • Exit Loop If [ MBS( "CURL.IsRunning"; $curls[$index] ) = 0 ]
                                                                                                                                                        • Pause/Resume Script [ Duration (seconds): ,1 ]
                                                                                                                                                        • End Loop
                                                                                                                                                        • #handle result
                                                                                                                                                        • Perform Script [ “HandleFinishedCURL”; Parameter: $curls[$index] ]
                                                                                                                                                        • End If
                                                                                                                                                        • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                                                        • Exit Loop If [ $index = 9 ]
                                                                                                                                                        • End Loop
                                                                                                                                                        • # Cleanup
                                                                                                                                                        • Set Variable [ $index; Value:1 ]
                                                                                                                                                        • Loop
                                                                                                                                                        • #clean one
                                                                                                                                                        • Set Variable [ $r; Value:If(IsEmpty($curls[$index]); 0; MBS("CURL.Release"; $curls[$index])) ]
                                                                                                                                                        • #next
                                                                                                                                                        • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                                                        • Exit Loop If [ $index > $MaxConnections ]
                                                                                                                                                        • End Loop
                                                                                                                                                        • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                                                                                                        • Go to Layout [ original layout ]
                                                                                                                                                        • Set Variable [ $EndTime; Value:Get(CurrentHostTimestamp) ]
                                                                                                                                                        • Show Custom Dialog [ Title: "Sent."; Message: "Duration: " & ($EndTime-$StartTime); Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “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: [Download parallel]
                                                                                                                                                            Script NameHandleFinishedCURL
                                                                                                                                                            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 [ $curl; Value:Get(ScriptParameter) ]
                                                                                                                                                              • Set Variable [ $DownloadID; Value:MBS("CURL.GetTag"; $curl) ]
                                                                                                                                                              • #get debug messages
                                                                                                                                                              • Set Variable [ $DebugMessages; Value:MBS("CURL.GetDebugMessages"; $curl; "UTF-8") ]
                                                                                                                                                              • Set Variable [ $Content; Value:MBS("CURL.GetResultAsText"; $curl; "UTF-8") ]
                                                                                                                                                              • Set Variable [ $Status; Value:MBS( "CURL.ErrorCode"; $curl ) ]
                                                                                                                                                              • If [ $Status = 0 ]
                                                                                                                                                              • Set Variable [ $Status; Value:"Sent" ]
                                                                                                                                                              • Else
                                                                                                                                                              • Set Variable [ $Status; Value:"Failed" ]
                                                                                                                                                              • End If
                                                                                                                                                              • Set Variable [ $r; Value:MBS( "FM.ExecuteFileSQL"; Get(FileName); "UPDATE Downloads SET \"Content\"=?, \"ErrorLog\"=?, \"Status\"=?, \"Finished TimeStamp\"=? WHERE \"ID\"=?"; 9; 13; $Content; $DebugMessages; $Status; Get(CurrentHostTimestamp); $DownloadID ) ]
                                                                                                                                                              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: Batch Download

                                                                                                                                                                            Used functions: