Startting/stopping programs

Discuss RoboTask here
Post Reply
Dimsok
Posts: 6
Joined: Tue Aug 26, 2014 6:14 am

Startting/stopping programs

Post by Dimsok »

I need simple thing - to start some programs when i start some soft and close when close it. I can't see in triggering even "wait for process start" and "wait for process finish" which exist in action tab of robotask. I tried to use start/stop exe with help of windows watcher, but have problem with it. I did try all options of windows watcher but all the time when program in focus (that one, which should start other by launching), second program start agai or switch on foreground. I just want that it start only one time. For example when i start Skype i need launch program for checking spelling and "onair" and when i switch on skype window again nothing should happen with them. Maybe some variables?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Startting/stopping programs

Post by Oleg »

I can't see in triggering even "wait for process start" and "wait for process finish"...
You can make a simple simulation. Use Cyclic trigger. You can use interval 2-5 sec.
The task will be such:

Code: Select all

if {IsProcessExists(myprogram.exe)} = true then
  Do Something
end if
or

Code: Select all

if {IsProcessExists(myprogram.exe)} = false then
  Do Something
end if
Use the {IsProcessExists()} variable too to avoid the repeated launching of some program.

See Full list of system variables here.
Oleg Yershov
Dimsok
Posts: 6
Joined: Tue Aug 26, 2014 6:14 am

Re: Startting/stopping programs

Post by Dimsok »

But terminate process if forced only? Can i close program just as i click "quit" on it? Likw "winclose" command in ahk?
Dimsok
Posts: 6
Joined: Tue Aug 26, 2014 6:14 am

Re: Startting/stopping programs

Post by Dimsok »

i have found how to close windows
Dimsok
Posts: 6
Joined: Tue Aug 26, 2014 6:14 am

Re: Startting/stopping programs

Post by Dimsok »

I have that command, that start app when skype launch

{IsProcessExists(Skype.exe)} = true then
Do Something
end if

And i use monitoring of windows to close that app, but when skype close and that other app close too, it's start again one time. I guess it's cause skype process don't close instantly and command "isprocessexist" launch that prog agai. So my question is - how to delay that variable, that it can start my app after starting skype for example with 30 sec delaying?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Startting/stopping programs

Post by Oleg »

See the example below. This task opens Notepad when Skype is running and closes notepad when Skype is being closed.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task413"
Hide=INTEGER|0
ID=INTEGER|96418378
LogOnAsUser=INTEGER|1
Name=STRING|"Open Notepad when skype is running"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action1\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsProcessExists(skype.exe)}"

[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{IsProcessExists(notepad.exe)}"

[Actions\Action3]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""notepad.exe """
Params=FOLDER

[Actions\Action3\Params]
ifnonzero=STRING|"0"
program=STRING|"notepad.exe"
runas=STRING|"0"
wait=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action5]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action6]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action6\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsProcessExists(notepad.exe)}"

[Actions\Action7]
ActionID=STRING|"A_WINDOW_COMMAND"
Enabled=INTEGER|-1
Name=STRING|"Close window ""notepad"""
Params=FOLDER

[Actions\Action7\Params]
action=STRING|"4"
caption=STRING|"1"
child=STRING|"0"
class=STRING|"0"
classexact=STRING|"0"
exact=STRING|"0"
findmode=STRING|"0"
hidden=STRING|"0"
processall=STRING|"0"
wincaption=STRING|"notepad"

[Actions\Action8]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action9]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_CYCLIC"
Params=FOLDER
UnigueID=INTEGER|16445953

[Events\Event1\Params]
interval=STRING|"5"
notsatrtatactivation=STRING|"0"

Oleg Yershov
Dimsok
Posts: 6
Joined: Tue Aug 26, 2014 6:14 am

Re: Startting/stopping programs

Post by Dimsok »

Thanks, but how can i manually unload those apps which launch with skype? I just want they will start once when skype starts, not every ... seconds, with ability of manual closing.
Post Reply