Qball's Weblog

IfThenElse: A new file format

Tags IfThenElse 

Because of some complains I got about the file format (xml, hard to handwrite) and the extra dependency on GTK it added, I wrote my own TinyBuilder that parses ini style files.

So an example in the current version would be:

?View Code INI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
[OutputWatch]
type=OutputWatch
kill_child = true
cmd=dbus-monitor interface=org.gnome.ScreenSaver
fire_regex=.*member=ActiveChanged.*
action=CheckScreenSaver
 
[CheckScreenSaver]
type=ExternalToolCheck
cmd=gnome-screensaver-command -q
output-compare=The screensaver is inactive
compare-old-state=true
then-action=EnableGajim
else-action=WorkHourCheck1
 
[WorkHourCheck1]
type=TimeCheck
hour=8
minute=30
then-action=WorkHourCheck2
else-action=DisableGajim
 
[WorkHourCheck2]
type=TimeCheck
hour=17
minute=30
then-action=DisableGajim
else-action=AwayGajim
 
[DisableGajim]
type=ExternalToolAction
cmd=gajim-remote change_status offline
 
[AwayGajim]
type=ExternalToolAction
cmd=gajim-remote change_status away "Leave a message after the beep" 
 
 
[EnableGajim]
type=ExternalToolAction
cmd=gajim-remote change_status online