Jump to content
mentosan

Completely close everything from the tray

Recommended Posts

mentosan

Hi there !

I have a script which at certain point will open a Windows cmd prompt terminal.

How can I close the opened cmd window just using the Exit option from the tray? Selecting Exit from the tray will only stop the execution of the script but will not close the cmd window.

 

Thx

Share this post


Link to post
Share on other sites
JLogan3o13

@mentosan since AutoIt can do anything the cmd prompt can do, why not just skip the window altogether? Then you can control the stop and start of that specific action in your script. It would also be easier to assist if you posted an example of what you're trying to accomplish.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
mentosan

@JLogan3o13 Thank you for reply. I would prefer to stick with cmd because it will connect to a linux server and from there sending commands, using autocomplete and so on.

Share this post


Link to post
Share on other sites
JLogan3o13

So it sounds like you're trying to manage an SSH connection, not a cmd prompt, correct? Again, the more information you provide about what you are trying to accomplish, the less teeth we have to pull to help ;)

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
orbs

@mentosan, accepting your will to work manually in the spawned process, your solutions would be:

1) to introduce your own custom "Exit" tray menu item to replace the default "Exit" with a function that will close the spawned process and then exit the script. see the help file for TrayCreateItem() function.

2) to register an "on exit" function in your script to do that. see the help file for OnAutoItExitRegister() function.

that said, and as posted above, if your spawned process is doing repetitive and standard actions, you can consider automate it all together.

Share this post


Link to post
Share on other sites
mentosan

This would achieve my goal, I think. @orbs Could you please post a short example on what you have suggested ?

Basically, a part of the script is like this:

If @error Then
        MsgBox( "Error: ".....)
Else
        RunWait(cmd....

 

When I exit the script I want that cmd window will close too.

 

Thank you

Share this post


Link to post
Share on other sites
orbs

any particular reason for using RunWait() rather than Run()?

Share this post


Link to post
Share on other sites
mentosan

That's because the script must wait until return of the DOS commands or Linux commands.

Share this post


Link to post
Share on other sites
Jos
On 6/19/2018 at 4:29 PM, JLogan3o13 said:

So it sounds like you're trying to manage an SSH connection, not a cmd prompt, correct? Again, the more information you provide about what you are trying to accomplish, the less teeth we have to pull to help ;)

 

Guess this got lost for the OP as there still isn't much information to go on... :)

Jos

  • Haha 1

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Somerset

Okay, you earned that.


 

Spoiler

 

Share this post


Link to post
Share on other sites
orbs
On 6/19/2018 at 6:12 PM, orbs said:

register an "on exit" function in your script to do that. see the help file for OnAutoItExitRegister() function.

@mentosani'd go explore the method stated above. i doubt any example i could give would serve your purpose better than you actually reading that help section and implementing it for your scenario.

i would also advise, should you post again in this topic, post a working reproducer. your entire script is not required; a small independent script performing (or failing to perform) the task is expected, so anyone wishing to lend you a hand can easily run it on their own environment, test its functionality and suggest solutions or improvements.

 

Share this post


Link to post
Share on other sites
mentosan
Posted (edited)
ok
Edited by mentosan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×