There's a far more easier way.
SysInfo provides the "Get OS version" expression (SysInfo.GetOS). It is a string containing a bunch of information, e.g.
"Windows XP (Professional), (Terminal Services in Remote Admin Mode), (Multiprocessor Free), (x86-32 Processor) v5.1 Build:2600 Service Pack: 3"
Well, of all that text, all you need is the internal version number, in this case "v5.1". You can get this converted to a number using:
float(mid(SysInfo.GetOS, find(SysInfo.GetOS, ") v") + 3, 3))
After that your conditons should compare against the version numbers. It's 5.1 for Win XP, 6.0 for Win Vista and 6.1 for Win 7
A list of the version numbering can be found here: http://www.gaijin.at/lstwinver.php
And here is an example cap, using the description above: osversion.cap