Print Page | Close Window

External Program Execution Terminology

Printed From: Rocket Software
Category: AccuTerm Knowledge Base (read only)
Forum Name: Scripting & Automation
Forum Description: Customize and control AccuTerm using scripts and automation
Printed Date: January 29 2023 at 5:01am
Software Version: Web Wiz Forums 12.03 -

Topic: External Program Execution Terminology
Posted By: sbhenkel
Subject: External Program Execution Terminology
Date Posted: March 12 2021 at 11:09am
This concerns the two escape sequences that are available to execute external programs.
ESC STX <  "Executes the Windows command line command, then returns to AccuTerm..."


ESC STX > "Execute the Windows command line command and suspends the terminal session until the command completes."

I am mainly interested in the second version.  As quoted above, it says it executes the command and suspends the terminal session until...  Then right below it says "Note:  when using this function, you often need the host program to wait until the command terminates..."  It then proceeds to suggest to use the ESC STX I command followed by an INPUT statement.

I'm confused.  If the basic function of the command "executes the window command line command and suspends...", isn't it redundant to say "you often need the host program to wait until the command terminates.  If you require this functionality..."  I mean, if the terminal session is suspended utnil the command completes, why do I need to follow it by an AccuTerm command that sends out a character string (release information) that I then capture with an input statement.  The documentation even says AccuTerm will not process the ESC STX I until the command terminates."  If it doesn't execute the extra escape sequence, doesn't that mean it's not going to execute ANYTHING else until the command terminates?  It just seems unnecessary.

The reason I even bring this up is because I tried following ESC STX > with ESC STX I (and then an INPUT statement) and it works fine.  But it puts a line of needless information on the screen that will just confuse some people and quite honestly will throw certain display elements out of sequence.

Is there something I'm missing in the wording of this command?

Posted By: PSchellenbach
Date Posted: March 12 2021 at 12:26pm
Hi Steve -

Good question. Here's why you need to add the INPUT to your Pick program. There are two CPUs running comcurrently - AccuTerm on the PC and the server running your Pick program. AccuTerm cannot influence your Pick program and cause it to pause. When you send the escape sequence to launch a program from AccuTerm using ESC STX >, AccuTerm is able to pause until the executed program terminates. When paused, it stops reading data from your Pick program and stops sending keys back to the Pick program. But the Pick program is running on an entirely separate CPU, and all you did to get AccuTerm to launch an external program is PRINT some data. What should the Pick program do after PRINT? It should execute the next statement. Which it does, and there is nothing to make it pause until the external program terminates. Hence the INPUT statement. That causes the Pick program to wait for input before proceeding. It just waits until the INPUT is satisfied. The extra ESC STX I that the Pick program sends to AccuTerm is stuck in some buffer until AccuTerm is resumes, when the external program terminates. At that time AccuTerm reads this from the buffer, and processes it, sending its registration text back to the Pick program, which is waiting at INPUT.

You can prevent the screen mess by using ECHO OFF before INPUT and ECHO ON after, also a PROMPT '' will prevent the prompt character from messing the screen.

Thanks, Pete

Posted By: sbhenkel
Date Posted: March 12 2021 at 2:46pm
That makes perfect sense now.  Thank you. :-)

Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 -
Copyright ©2001-2019 Web Wiz Ltd. -