The logic is quite simple:
rule "Window state changed"
when
Item MyWindow changed
then
if(MyWindow.state ==OPEN) MyRollerShutter.sendCommand(UP)
else MyRollerShutter.sendCommand(DOWN)
end
By applying the design patterns you can make this generic for lots of windows.
rule "A window state changed"
when
Item Window_1 changed or
Item Window_2 changed or
...
then
val winNum = triggeringItem.name.split("_").get(1)
var cmd = if(triggeringItem.state == OPEN) ON else OFF
sendCommand("Rollershutter_"+winNum, cmd)
end