Halt Script

Forces all scripts, sub-scripts, or external scripts running in the current FileMaker application to stop immediately.

Options 

None.

Compatibility 

Product Supported
FileMaker Pro Yes
FileMaker Go Yes
FileMaker WebDirect Yes
FileMaker Server Yes
FileMaker Cloud Yes
FileMaker Data API Yes
Custom Web Publishing Yes

Originated in version 

6.0 or earlier

Description 

Halt Script can leave your database in an unpredictable state. For example, the script might halt in an unanticipated layout, view, or mode.

Example 1 

Performs a find and prints. If no records are found, displays all records and halts the script.

Copy
Perform Find [Restore]
If [Get ( FoundCount ) = 0]
    Show All Records
    Halt Script
End If
Print [With dialog: Off]

Example 2 

The Print Unpaid Invoices script calls the Print sub-script. If the user chooses not to print invoices, the script and sub-script stop. If the user chooses to print invoices, unpaid invoices that match the Find criteria are printed. After printing, all records are displayed and sorted.

Main script: Print Unpaid Invoices

Copy
New Window [Style: Document; Name: "Invoice List"; Using layout: "Print Invoices" (Invoices)]
Perform Find [Restore]
#Calls the "Print" sub-script defined below
Perform Script [Specified: From list ; "Print" ; Parameter: ]
#Continues after the sub-script is completed if the user chose to print the invoices
Show All Records
Sort Records [Restore; With dialog: Off]

Sub-script: Print

Copy
Show Custom Dialog ["Print Unpaid Invoices"; "Do you want to print unpaid invoices?"]
If [Get ( LastMessageChoice ) = 1]
    Print [With dialog: Off]
Else
    Close Window [Current Window]
    #Halts both the sub-script and the main script
    Halt Script
End If