Jump to content

Completely close everything from the tray


Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

@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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

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 ;)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@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.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

  • Developers
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

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

Link to comment
Share on other sites

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.

 

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...