Page 1 of 1

Triggering Events - check windows existl

Posted: Wed Oct 05, 2011 4:46 am
by Boris
Tell, how it is possible to make in Triggering Events start if there is window exist (or not) or not no such started process (with a full patch to exe file)?




Triggering Events - check windows existl

Posted: Wed Oct 05, 2011 5:33 am
by Oleg
You can do such functionality. Create the task with Cyclic trigger.
Suppose it fired every 2 seconds.
Algorithm of the task is simple:

Check existence of window //Check for window action
If true
   do something
else
   do something else
endif

Also see the example below.
You can use similar algorithm for checking of some process existence. See {IsProcessExists()} variable.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444444824
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task1089"
Hide=INTEGER|0
ID=INTEGER|742207139
LocalVariables=STRING|"w_exists"
LogOnAsUser=INTEGER|1
Name=STRING|"Check existence of the window"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER

[Actions\Action1]
ActionID=STRING|"A_WINDOW_CHECK"
Enabled=INTEGER|-1
Name=STRING|"Check for Window"
Params=FOLDER

[Actions\Action1\Params]
abortif=STRING|"0"
action=STRING|"1"
checkfor=STRING|"0"
exact=STRING|"0"
variable=STRING|"w_exists"
wincaption=STRING|"notepad"

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

[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{w_exists}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""[{Time}, {DayOfWeek}, {Date}]"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"[{Time}, {DayOfWeek}, {Date}]"
msg1=STRING|"Notepad is working!"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action5]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action5\Params]
message=STRING|"Notepad is not exists"
type=STRING|"3"

[Actions\Action6]
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|699214014

[Events\Event1\Params]
id=STRING|"KJVEQR74"
interval=STRING|"2"

Triggering Events - check windows existl

Posted: Wed Oct 05, 2011 6:52 am
by Boris
This method works, but unfortunately, I can't add simultaneously in a condition of operation of the task any additional condition (for example, at file creation that too this condition worked).in rus: Ìåòîä ðàáîòàåò, íî íåëüçÿ äîáàâèòü äîïîëíèòåëüíîå óñëîâèå ñðàáàòûâàíèÿ, íàïðèìåð, ïî ïîÿâëåíèþ íîâîãî ôàéëà (óñëîâèå íå èìååò ñìûñëà, ò.ê â ñàìîé çàäà÷å òîæå ñîäåðæèòñÿ óñëîâèå).

Triggering Events - check windows existl

Posted: Wed Oct 05, 2011 7:17 am
by Oleg
Why not?

see such algorithm:

Task1 (with cyclic event):
Check existence of window
If true
   start task2
end if

Task2 (with file monitor trigger and other events):
...
do something
...


Also, pay attention, that you can start another task with parameters.