| View previous topic :: View next topic |
| Author |
Message |
Deep-Silence
Joined: 24 Apr 2009 Posts: 87
|
Posted: Thu Dec 17, 2009 1:02 pm Post subject: close process without losing data |
|
|
Currently i am busy with this little script here
I want start a application automatically. And close it after a chosen time.
So far the script works fine, BUT:
I do not want to loose Data, caused by the brutal termination of the process. Is there a way to shut it down smoothly?
The program i am using is a process running as a Trayicon without a window. (notepad.exe is only meant as an example)
| Code: |
Label_Script_Start:
TimetoWaitInMinutes = 4
TimeToWait_Value := (TimetoWaitInMinutes * 60000)
Run, notepad.exe
Sleep, %TimeToWait_Value%
Process, Close, notepad.exe
Sleep, 10000
Goto, Label_Script_Start
|
Thanks,
Deep-Silence |
|
| Back to top |
|
 |
UncleScrooge
Joined: 14 Apr 2009 Posts: 75 Location: Italy
|
Posted: Thu Dec 17, 2009 1:11 pm Post subject: |
|
|
one way could be:
| Code: |
Label_Script_Start:
TimetoWaitInMinutes = 4
TimeToWait_Value := (TimetoWaitInMinutes * 60000)
Run, notepad.exe,,, npadID
Sleep, %TimeToWait_Value%
IfWinExist ahk_pid %npadID%
{
WinActivate, ahk_pid %npadID%
Send !{F4}
}
Sleep, 10000
Goto, Label_Script_Start |
whereas u could add some more lines to check if Notepad windows comes active or not (before sendig keystrokes I mean), etc.
the same idea could apply to a program which accepts keystrokes as a way to close it like:
_________________ Intel Centrino @ 2.8GHz
4 GB RAM
WIN XP SP3 |
|
| Back to top |
|
 |
Deep-Silence
Joined: 24 Apr 2009 Posts: 87
|
Posted: Thu Dec 17, 2009 1:28 pm Post subject: |
|
|
Thanks,
i will try this
Perhaps i can define a hotkey for the program to close itself.
Let me have a look at this...
Thanks,
Deep-Silence |
|
| Back to top |
|
 |
Deep-Silence
Joined: 24 Apr 2009 Posts: 87
|
Posted: Thu Dec 17, 2009 2:27 pm Post subject: |
|
|
Unfortunately there is no way to setup a hotkey to close my program.
i am going to observe the "lose Data behaviour"
If it does not work, i need to find another way...
Thanks for now
Deep-Silence
Last edited by Deep-Silence on Thu Dec 17, 2009 2:46 pm; edited 1 time in total |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Dec 17, 2009 2:35 pm Post subject: |
|
|
how about WinClose?
(DetectHiddenWindows might helps) |
|
| Back to top |
|
 |
Deep-Silence
Joined: 24 Apr 2009 Posts: 87
|
Posted: Thu Dec 17, 2009 2:44 pm Post subject: |
|
|
Actually this app has not Windows,
But if you perform i right-click on its trayicon there is a menu coming up,
where you can select options or exit the program.
i thought about, detecting the icon position and perform the right-click
but i think this is not the smartest solution...
Thanks,
Deep-Silence |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5043 Location: the tunnel(?=light)
|
|
| Back to top |
|
 |
Deep-Silence
Joined: 24 Apr 2009 Posts: 87
|
Posted: Thu Dec 17, 2009 5:19 pm Post subject: |
|
|
Thanks for this hint,
looks very interesting.
I guess i will get it done with it...
Thanks.
Deep-Silence |
|
| Back to top |
|
 |
|