It is not enough to simply add SETOPTION('NoVarsInStrings','on') and not remove vars from strings!

$SWProgKey = KeyExist("$SWRegKey")

is a perfect example of a var in a string. Why would you put quotes around a var anyway?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.