If ( Get ( TotalRecordCount ) > Get ( FoundCount ) ; "Show All" ; "Find" )
Does not exist in the script that you posted.
The Set Error capture step should be moved up to precede the Perform FInd step. Otherwise, your script will be interrupted with a "no records found" dialog from FIleMaker if no records are found.
As written, get ( LastError ) is always returning a 0 because the set error capture statement is always executing without generating an error code. Get ( LastError ) returns any error codes generated only by the script step that immediately precedes it.
You may also find some of the script examples in this thread on scripted finds of interest: Scripted Find Examples