Reference > Script steps reference > Control script steps > Halt Script
 
Halt Script
Purpose 
Forces all scripts, sub-scripts, or external scripts running in the current FileMaker application to stop immediately.
See also 
Format 
Halt Script
Options 
None.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server 
Yes 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 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.
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
New Window [Style: Document; Name: "Invoice List"; Using layout: "Print Invoices" (Invoices)]
Perform Find [Restore]
#Calls the "Print" sub-script defined below
Perform Script ["Print"]
#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
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
Related topics 
Exit Script script step
Script steps reference (alphabetical list)
Script steps reference (category list)