Jump to content
Sign in to follow this  

save and close when the program won't ask to save

Recommended Posts

hello everyone

i am very new at this, i have a few scripts i am working on or getting help or trying to get help with.

one script that i have complete (the rest either work but require some fine tuning or i've asked or looking for more to be added but those are other posts).

the one script i have completed which is a very very basic script i am sure

what it does is terminates or closes a program. for most of the network machines this is fine as is, however the main one that is the source i can't have it just terminate it without saving the file or i might lose data.

most of the time it will be closed but occasional i forget to close it and in order to get everything to copy right i need it closed.

but the program does not ask if you want to save it if you chose to close or exit it just does it, so i've seen example on saving a file if it asks but not on how to do it this way.

so what i would need or need to figure out is this.

if the program is open, cause if its not then its already done, i assume the script will just cancel or error out if you tell it to save a file in a program thats not running.

so assuming the program is open i need it to save the file, but unsure on how to get it to do that,

then i need it so exit the program.

those two things are it.

while this is running the other script will run on the other pc's to terminate the same program to avoid any errors in the file copying.



Share this post

Link to post
Share on other sites

You can (hopefully) use Winexists to check if the program is running (if it has a window) or you can check ProcessExists for the exe.

If there is a hotkey that will 'save and exit' than you can send, or better ControlSend the hotkey to the program.



My Android cat and mouse game

We're gonna need another Timmy!

Share this post

Link to post
Share on other sites

the current script that closes it, if the program isn't running just i guess runs and exits, does not notice or anything which is fine becasue if its shut down already then the file is saved

what i can't figure out is how to save the file, like most programs i can do file save or file saveas, file save is fine as it will just save it, no need to create a new file or file name.

i just can't or don't know how to get it to do it if the programs open, i guess we can assume its open and the script don't need to check since it don't do anything if its not open.

below is the script info for just closing it


$PID = ProcessExists("notepad.exe") ; Will return the PID or 0 if the process isn't found.

If $PID Then ProcessClose($PID)

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...