Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[COLOR=#804040][b]package[/b][/color] require tcom
[COLOR=#804040][b]puts[/b][/color] [COLOR=#ff00ff]"Begin of Tcl"[/color]
[COLOR=#804040][b]set[/b][/color] wsh [::tcom::ref createobject [COLOR=#ff00ff]"WScript.Shell"[/color]]
[COLOR=#804040][b]puts[/b][/color] [COLOR=#ff00ff]"Now calling JScript example:"[/color]
[COLOR=#008080]$wsh[/color] Run example.js [COLOR=#ff00ff]3[/color] [COLOR=#ff00ff]1[/color]
[COLOR=#0000ff]# calling JScript without waiting:[/color]
[COLOR=#0000ff]# $wsh Run example.js[/color]
[COLOR=#804040][b]puts[/b][/color] [COLOR=#ff00ff]"End of Tcl."[/color]
[COLOR=#008080]function[/color] addTwo(x, y) [COLOR=#008080]{[/color]
[COLOR=#804040][b]try[/b][/color] [COLOR=#008080]{[/color]
[COLOR=#804040][b]return[/b][/color](x + y);
[COLOR=#008080]}[/color]
[COLOR=#804040][b]catch[/b][/color]( e ) [COLOR=#008080]{[/color]
[COLOR=#804040][b]return[/b][/color]( [COLOR=#ff00ff]"Error: "[/color] + e.description );
[COLOR=#008080]}[/color]
[COLOR=#008080]}[/color];
[COLOR=#0000ff]// main[/color]
text = [COLOR=#ff00ff]"result of addTwo(3, 5) = "[/color] + addTwo(3, 5)
WScript.Echo(text);
WScript.Quit();
C:\_mikrom\Work>tclsh wsh.tcl
Begin of Tcl
Now calling JScript example:
result of addTwo(3, 5) = 8
End of Tcl.
$wsh Run example.js 3 1
$wsh Run example.js