<HTML><BODY><br><p>#lang racket/base<br>(require ffi/com)<br>(let ([com (com-create-instance "MSScriptControl.ScriptControl")])<br> (com-set-property! com "Language" "VBScript")<br> (com-invoke com "AddCode" "Function Test() \n Test=false \n End Function")<br> (com-invoke (com-get-property com "CodeObject") "Test"))<br><br>Returns #t <br>(Racket 6.0 win32)</p>If I send to COM, all is ok:<br>(let ([com (com-create-instance "MSScriptControl.ScriptControl")])<br> (com-set-property! com "Language" "VBScript")<br> (com-invoke com "AddCode" "Function Test(x) \n If x then \n Test = 1 \n else \n Test =2 \n End if \n End Function")<br> (com-invoke (com-get-property com "CodeObject") "Test" #f)) ; => 2<br><br>(let ([com (com-create-instance "MSScriptControl.ScriptControl")])<br> (com-set-property! com "Language" "VBScript")<br> (com-invoke com "AddCode" "Function Test(x) \n If x then \n Test = 1 \n else \n Test =2 \n End if \n End Function")<br> (com-invoke (com-get-property com "CodeObject") "Test" #t)) ; => 1<br><br>And even <br><br><p>(let ([com (com-create-instance "MSScriptControl.ScriptControl")])<br> (com-set-property! com "Language" "VBScript")<br> (com-invoke com "AddCode" "Function Test(x) \n If x = false then \n Test = false \n End if \n End Function")<br> (com-invoke (com-get-property com "CodeObject") "Test" #f))<br>; => #t<br><br>(let ([com (com-create-instance "MSScriptControl.ScriptControl")])<br> (com-set-property! com "Language" "VBScript")<br> (com-invoke com "AddCode" "Function Test(x) \n If x = false then \n Test = x \n End if \n End Function")<br> (com-invoke (com-get-property com "CodeObject") "Test" #f))<br>; => #f</p><br>-- <br>Roman Klochkov</BODY></HTML>