Jump to content

Ending scripts cleanly


Recommended Posts

Hi guys and Gals,

Ok I am a newbie and I have become quite interested in creating these little scripts to help my day-to-day activities. Only problem is I usually run them from to my usb (ie saving text docos etc), this in itself is great! BUT I dont know how to close the scripts cleanly.. they seem to leave cmd.exe 'files' in the task manager.

Any help would be greatly appreciated.

PS - Most of my scripts are 'run(xyz)'

Link to comment
Share on other sites

It would help quite a loot if you provided some sample code that behaved the way you explain.

When you use the run("notepad.exe") function you start a new process. If the cmd stays around after you have finished your script it implies that the process you started has not finished. To make shure it has you could use runwait or collect the program id returned by run and use that to terminate the process you have started.

PS: Sorry about the spelling, I dont have easy access to a spell checker at the moment..:whistle:

Link to comment
Share on other sites

Hi guys and Gals,

Ok I am a newbie and I have become quite interested in creating these little scripts to help my day-to-day activities. Only problem is I usually run them from to my usb (ie saving text docos etc), this in itself is great! BUT I dont know how to close the scripts cleanly.. they seem to leave cmd.exe 'files' in the task manager.

Any help would be greatly appreciated.

PS - Most of my scripts are 'run(xyz)'

Hm.. hard to say what's going wrong without any information about your code... Maybe you should post your code and describe where you think the problem could be.

Basically, make sure the programs you start with Run() exit when they are done.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Hi guys and Gals,

Ok I am a newbie and I have become quite interested in creating these little scripts to help my day-to-day activities. Only problem is I usually run them from to my usb (ie saving text docos etc), this in itself is great! BUT I dont know how to close the scripts cleanly.. they seem to leave cmd.exe 'files' in the task manager.

Any help would be greatly appreciated.

PS - Most of my scripts are 'run(xyz)'

Task manager doesn't list "files", it lists running processes. If you have any Run() statements in your script, that's the first place to look. Those shell processes that get kicked off may not be terminating. More detailed help will require posting code to figure it out.

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...