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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing program via script.

Status
Not open for further replies.

Curtis360it

IS-IT--Management
Nov 7, 2005
88
US
Okay, I need a way to close out an application if a user just clicks "X" instead of exiting out of the system properly. I got a answer months ago on how to do it but could not figure it out. Can someone please give me a few steps to creating something like this?
 
Precisely, I want to gracefull log them out if they try to close procomm.
 
Unfortunately, it doesn't look like there is a way to capture the closure of Procomm and act on that. If the user was running a script and tried to stop the script (but not Procomm), then there is a method to handle that.

It is possible to disable parts of Procomm's user interface to disable menu items and I believe the 'X' as well if that would do the trick.

 
depending on how complex of a setup you are willing to deal with, one option would be to startup procomm with a windows batch file initially, the batch file will not execute the next command in it's file until the procomm windows totally exits itself. It takes about 4 seconds for me on a windows 2000 Pro machine for this to happen.

If your logout procedure is adaptable, then have the next line of your batch file specify the path to your procomm executable, so something like "%PROGRAMFILES%\Symantec\Procomm Plus\PROGRAMS\pw5.exe" (include the quotes) followed by the path and name to your .wax file

So taking into consideration if the user had logged out of the system, then closed it, I'd think your system could take the garbage characters that the logout procedure would throw at it.

I use wyse 50 emulation on a Hollander yard management system (ancient stuff), so for me I can close procomm and open it back up and start typing as if nothing had happened (however a screen refresh would be nice).

hope it helps,
dan
 
Well it looks like I remembered incorrectly about what UI can be disabled. Procomm's various menu items can be greyed out but not the 'X' itself.

Do you recall if you previously asked this question in this forum so we can look up your old thread and see if there is something I am forgetting?

 
Hey knob,

I had, the problem was that I have never dealt with ProComm and am completely lost on the answer in the previous thread said to do.
 
I was able to find the previous thread (didn't realize that clicking on your name would bring up your profile and previous posts), but it doesn't look like that will work. What I thought could be done in that thread is use the when userexit command to catch when the user closed Procomm, but that only catches if they tried to stop a running script.

I'll keep playing around with this, seems like there should be some way of catching that.

 
I appreciate it knob.

It comes down to this:

We use a system called ProMed that runs from ProComm. We only have so many licenses and the users are just hitting "X" instead of backing out of the system with the correct keyboard steps. This is also leaving "live" connections that are overloading the antique system.

You can see why I really want a strategy for ending the problem and I truly appreciate your thoughts!!!!
 
Looks like the best one can do is run the below script which keeps Procomm from being closed unless they kill Procomm from the Task Manager or shut down Windows:

proc main
set aspect control ON

while 1
yield
endwhile
endproc

This can be included at the end of the startup.was script that Procomm runs on execution or launched via the chain command from startup.was so it runs automatically.

This doesn't force the graceful logout that you are seeking though, so I'm not certain it meets your need.

Another option would be remove the set aspect control ON line and then when the users try to close Procomm, they will get a prompt asking if they want to stop all active scripts. If they answered no, the script would keep running, keeping Procomm active and letting them logout as desired. If there were a unique string that indicated the user had logged out, the script could look for that message and stop the script before the user tried to exit. This would mean they would only see the prompt if they had not logged out cleanly.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top