with ScriptControl1 do
begin
Language :='VBScript'; /// 设置语言,还可以为JavaScript
SitehWnd :=Handle; ///传递父窗口句柄
ExecuteStatement('msgbox("Shit!")'); /// 显示一个Message Box
ShowMessage('1+2+3*4/5^7='+FloatToStr(Eval('1+2+3*4/5^7')));
end;
procedure TForm1.Button1Click(Sender: TObject);
var xx: OLEVariant;
begin
xx := CreateOLEObject('MSScriptControl.ScriptControl');
xx.Language := 'VBScript';
xx.AddCode('Dim i');
xx.AddCode('i=2');
xx.ExecuteStatement('MsgBox i^2');
end;