Close Service if programm is closed
-
- Posts: 9
- Joined: Thu Oct 18, 2012 8:58 am
Close Service if programm is closed
What I like to do is that RoboTask checks if an application ( in this case Cisco AnyConnect) is still running (symbol is shown besides the clock) and if it isn't running anymore the service should be shut down. How can i realise that?
Close Service if programm is closed
You can check process existence and do something in compliance with result.
Look at {IsProcessExists()} variable
Usage:
{IsProcessExists(<Program_EXE_File>)}
This returns TRUE or FALSE
Algorithm will be similar:
if {IsProcessExists(MyApp.exe)}= true then
...
Do something
...
Else
...
Do something else
...
End If
Look at {IsProcessExists()} variable
Usage:
{IsProcessExists(<Program_EXE_File>)}
This returns TRUE or FALSE
Algorithm will be similar:
if {IsProcessExists(MyApp.exe)}= true then
...
Do something
...
Else
...
Do something else
...
End If
-
- Posts: 9
- Joined: Thu Oct 18, 2012 8:58 am
Close Service if programm is closed
I managed to first start the service and then start the programm.I know a bit about programming (java) but i dont know where to add the code which you wrote.
Close Service if programm is closed
I see that you start service and then you start some application....
What next? What your goal?
In this case create new task with the following algorithm:
if {IsProcessExists(MyApp.exe)}= False then
Stop service vpnagent
End If
You can attach Cyclic trigger to the task.
This task will stop service when vpnui.exe will be finished.
What next? What your goal?
It seems you want to stop the service when the program vpnui.exe will be done. This is correct?What I like to do is that RoboTask checks if an application ( in this case Cisco AnyConnect) is still running (symbol is shown
besides the clock) and if it isn't running anymore the service should be shut down.
In this case create new task with the following algorithm:
if {IsProcessExists(MyApp.exe)}= False then
Stop service vpnagent
End If
You can attach Cyclic trigger to the task.
This task will stop service when vpnui.exe will be finished.
-
- Posts: 9
- Joined: Thu Oct 18, 2012 8:58 am
Close Service if programm is closed
Yes you got it right.So I can't integrate this function in the already running task?The question sounds stupid but where can I add the code?
Close Service if programm is closed
Why do you want to put ALL functions into ONE task???
Sometimes this is VERY unhandy.
Let one task will start service and necessary program
Another task checks status of your program periodically and closes service when program will be finished.
Sometimes this is VERY unhandy.
Let one task will start service and necessary program
Another task checks status of your program periodically and closes service when program will be finished.
Last edited by Oleg on Fri Oct 19, 2012 10:42 am, edited 1 time in total.
-
- Posts: 9
- Joined: Thu Oct 18, 2012 8:58 am
Close Service if programm is closed
Ok but still the question:where to put the code?And how to start both tasks with one click?
Last edited by datroubler on Fri Oct 19, 2012 11:00 am, edited 1 time in total.
Close Service if programm is closed
There are two tasks. Download here:
1-st task.tsk
2-nd task.tsk
Save tasks to files and use menu Task->Import in order to import into RoboTask. Don't forget to enable both tasks after importing.
2-nd task will run automatically. You don't need start it manually at all
1-st task.tsk
2-nd task.tsk
Save tasks to files and use menu Task->Import in order to import into RoboTask. Don't forget to enable both tasks after importing.
2-nd task will run automatically. You don't need start it manually at all
-
- Posts: 9
- Joined: Thu Oct 18, 2012 8:58 am
Close Service if programm is closed
Wow thanks a lot, works fine. But one question to the second task: Is it running since windows started? I have several programms in which i would like to use this algorithm. Isn't it a prolem for the performance if it checks every 15 seconds if the process is running?Wouldn't it be better so start the second task after the first task?edit:next question:is it possible to (de)activate network adapters?
Last edited by datroubler on Fri Oct 19, 2012 3:44 pm, edited 1 time in total.
Close Service if programm is closed
You don't need to start 2-nd task. Just enable it like this:
Start service
Run program
Enable "2-nd task"
at 2-nd task:
if {IsProcessExists(vpnui.exe)} = False then
Disable "2-nd task"
Stop service vpnagent
End If
When you enable task the trigger begin to work and start the task automatically.
BTW: you can set any period: 1 min or 15 min, as you wish.
You may download examples again. I have updated them:
1-st task.tsk
2-nd task.tsk
Start service
Run program
Enable "2-nd task"
at 2-nd task:
if {IsProcessExists(vpnui.exe)} = False then
Disable "2-nd task"
Stop service vpnagent
End If
When you enable task the trigger begin to work and start the task automatically.
BTW: you can set any period: 1 min or 15 min, as you wish.
You may download examples again. I have updated them:
1-st task.tsk
2-nd task.tsk