Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Script on FormClosing

Status
Not open for further replies.

Curtis360it

IS-IT--Management
Nov 7, 2005
88
US
I would like to know if it is possible to trigger a script on the FormClosing event of the procomm window? We use ProComm to access a Unix system and our users are "x'ing" out instead of backing out. This is consuming user connections that could otherwise be used by others.

Any idea?
 
There isn't a way that I'm aware of to have a script run when a user tries to exit, but you could have a "dummy" script running at all times such that when they try to exit Procomm they will receive a popup message asking them if they want to close all active scripts. The script is below:

proc main
while 1
yield
endwhile
endproc

You could also add a when userexit command to the above script to display a dialog with a message if the above is not enough to keep users from exiting.

 
Using the above script, could I not set it up to automatically log them off when the try to exit Procomm?

Do I dump this script into the ASPECT Editor? (VB programmer, not that familiar with ProComm)
 
Yes, you could do whatever steps you needed in the procedure called by when userexit.

To compile the script, paste it into the ASPECT Editor and press the Compile button. If it looks like this will work for you, you can then copy the script to each machine and launch it from the startup script that executes when Procomm comes up. If you look at the bottom of startup.was in the ASPECT directory, you will see these lines:

;**************************************************************************
;* Insert your own startup script tasks below *
;**************************************************************************

endproc

Before the endproc command, you would add chain "scriptname" where scriptname is the .wax file that you have developed.

 
Is there a place to get the syntax of Aspect scripting?

What exactly does the code do below? :)

proc main <~~~~ begin procedure
While 1 <~~~~ looping statement, how do you get the 1?
yield <~~~~?
endwhile <~~~~part of loop statement
endproc <~~~~~ end of procedure.

Thanks!!!!
 
Scratch that previous post, I found the Reference within ProComm.

So if my users are in a Telnet session and click the X, is there a way to send keypresses or something to pull them out of the applcation they are using? (ProMed)

 
Yep, if you are using the when userexit syntax mentioned above, you can add any necessary commands in the procedure that is called when the user tries to exit Procomm. The easiest way to do this is to record the keystrokes necessary to logout of the system gracefully and then copy that short script into your script. Below is some more information on recording scripts I copied from my site:

If you are trying to create a script that automates communications with a remote system and the text is relatively constant, you can make the task easier by using the Script Recorder to create your script. To enable the Script Recorder, select the Tools | Scripts | Start Recorder menu item. Procomm Plus will now monitor all incoming data and your outgoing responses to that data. Start performing the tasks (keyboard-based only!) that you want Procomm Plus to record. Once done, select the Tools | Scripts | Stop Recorder menu item. You will be prompted to save your recorded script; some editing of the script may be necessary. Be aware that if you dialed an entry from the Connection Directory, then your recorded script will be attached to that entry unless you change the value at the bottom of the Save As dialog. When you view your script, you will see that it is composed of waitfor/transmit commands. If all looks well, compile your script and see if it executes as expected. To make a recorded script more extensible, you can take a recorded script and replace some of the recorded strings with variables so that a more general script can be created.

 
Absolutely awesome information!!!

Last question I promise:
With the script below, where do I add the "userexit" command?

proc main
while 1
yield
endwhile
endproc

I hate to keep making you spoon feed me, but if I can get this figured out I can really use it as a foundation.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top