As we discovered today, we can have a script open the debugger. We can check the menu in FileMaker and if the debugger is not visible, we show it:
#The menu command as we got it from Menubar.ListMenuCommands
Set Variable [$DebuggerMenuID; Value:49260]
#Do we have a debugger?
If [MBS( "Menubar.HasMenuCommand"; $DebuggerMenuID ) = 1]
#Is it activate already?
If [MBS( "Menubar.IsMenuCommandChecked"; $DebuggerMenuID ) = 1]
#debugger already visible
Set Variable [$r; Value:MBS( "Menubar.RunMenuCommand"; $DebuggerMenuID )]
Pause/Resume Script [Duration (seconds): ,1]
#now follows your script that should always run in debugger