All of my issues seem to boil down to one question.
How do I enable a “wait until line is finished” type of logic into movement and non-movement commands?
Scripts occupy their own thread - distinct from and concurrent with Mach. Your SCRIPT lines ARE being executed in the order you wrote them. HOWEVER, The things your script asked Mach and the OS to do don't necessarily get started or finished in that same order. It depends on how busy Mach and the OS are and how long it takes them to do the things your script asked them to do. This is the nature of concurrent systems.
What you're wanting to do is to BLOCK until Mach and the OS signal that the things you've asked to be done have "finished" before moving on to the next line of script.
You already know how to BLOCK for Mach's completion - use isMoving() as you did in sub1.
For OS calls, specifically Shell, the Cypress Basic implementation doesn't support blocking so you'll need to use the WSript version instead).
Use it like this:
Set objShell = CreateObject("WScript.Shell")
objResult = objShell.Run("notepad.exe", 1, True)
This will BLOCK until you close Notepad.
Cheers
Ian