Everything You Want To Know About Script But Were Afraid To Ask… Mark Carroll Drew Lytle Script Technologies Microsoft Corporation
What This Presentation Is About… The core elements of Script Architecture overview Architecture overview Script Engines - new features in Microsoft ® Visual Basic ® Scripting Edition and JScript ® Script Engines - new features in Microsoft ® Visual Basic ® Scripting Edition and JScript ® Associated Script technologies Scriptlets Scriptlets Remote Scripting Remote Scripting Windows ® Scripting Host Windows ® Scripting Host Developing with Script Debugging Debugging
What This Presentation Is Not About… Hosting Script in your application See Chris Weight’s session (Win10) See Chris Weight’s session (Win10) Developing a Script Engine See Mark Hammond’s session (Tools08) See Mark Hammond’s session (Tools08)
The Core Elements Of Script
InternetExplorerInternetInformationServicesWindowsScriptingHostOtherApplications Microsoft VBScript MicrosoftJScript 3rd Party Engines ActiveX Scripting Interfaces Architecture Overview Open architecture for Script languages Microsoft provides VBScript, JScript Microsoft provides VBScript, JScript Others available - PERL, REXX, Python, etc. Others available - PERL, REXX, Python, etc. Open architecture for integrating Script into your application
Script Engines: What’s New Version 5 engines new for Windows NT ® 5.0 VBScript Classes Classes With With Eval/Execute Eval/Execute Regular Expressions Regular Expressions GetRef (Function Pointers) GetRef (Function Pointers) JScript Exception Handling Exception Handling ECMA-262 (Since V3) ECMA-262 (Since V3)
Script Engines: What’s New Performance Faster in the browser Faster in the browser Faster on the server (3x faster on Windows NT 5.0) Faster on the server (3x faster on Windows NT 5.0) DCOM Support Script Encoding Protects against prying eyes Protects against prying eyes Develop, encode, deploy Develop, encode, deploy Decoding supported in engines Decoding supported in engines Supports ASP, HTML, SCT, JScript, VBScript Supports ASP, HTML, SCT, JScript, VBScript
Let’s See Some Of These Cool New Engine Features!
Associated Script Technologies
Scriptlets COM Components written in Script and XML Any interface (e.g., automation) Any interface (e.g., automation) Can be used anywhere COM can be used Client - Internet Explorer, WSH, any COM application Client - Internet Explorer, WSH, any COM application Server - Internet Information Server, any COM application Server - Internet Information Server, any COM application Transaction (MTS) aware Runtime support in Windows NT 5.0, downloadable for Windows 95/98/ Windows NT 4.0
Scriptlets XML-based object definition Methods Use the method tag Use the method tag Properties Use property tag Use property tag <get/><put/></property> Events User Event tag User Event tag
Scriptlets Registration ProgID is the only required attribute CLSID is created at registration time if not supplied Or use a moniker “scriptlet:URL” <registration progid='MyFactorial.Scriptlet' progid='MyFactorial.Scriptlet' classid='{bb7f2d60-6dbb-11d1- 8cac-00a0c90fffc0}' classid='{bb7f2d60-6dbb-11d1- 8cac-00a0c90fffc0}' description='A simple test object' version="1.0"></registration>
Scriplets Example <scriptlet><registration progid='MyFactorial.Scriptlet' progid='MyFactorial.Scriptlet' classid='{bb7f2d60-6dbb-11d1-8cac-00a0c90fffc0}' classid='{bb7f2d60-6dbb-11d1-8cac-00a0c90fffc0}' description='A simple test object' description='A simple test object'version="1.0"></registration><public> </method></public> function myFactorial(n) { if (typeof(n) != "number") if (typeof(n) != "number") return NaN; return NaN; return (1 <= n) ? n*myFactorial(n-1) : 1; return (1 <= n) ? n*myFactorial(n-1) : 1;}</script></scriptlet>
Scriptlets Type library support Tools Support Provides auto complete in Visual InterDev ™ /Visual Basic/Delphi Provides auto complete in Visual InterDev ™ /Visual Basic/Delphi Allows Browsing of Objects Allows Browsing of Objects Eases integration with Visual J++ ® and Visual C++ ® Eases integration with Visual J++ ® and Visual C++ ® Helps with MTS integration Generate Type Library Menu option Menu option Object Model support Object Model support
Response.Write “Hello World!” </Script> Dim objCurr Dim objCurrObjCont Set objCurr = CreateObject("MTxAS.AppServer.1") Set objCurrObjCont = objCurr.GetObjectContext() GetRequest = objCurrObjCont("Response").Write(”Hello MTS”) Scriptlets Transaction specifics Use the AppServer object provided by MTS Native ASP support
How About Showing Us One Of These Scriptlets?
Scriptlet Summary COM Components in XML + Script Transaction support allows: Scalability Scalability Interoperability with any COM component Interoperability with any COM component Scriptlet Wizard makes it easy
Remote Scripting Remote Scripting provides richer Web client/server communication No need for a submit No need for a submit Call server functions asychronously Call server functions asychronously Works in Internet Explorer and Netscape Works in Internet Explorer and Netscape Combined with DHTML and Scriptlets, allows sophisticated user experience in the browser
Microsoft Internet Information Server Web browser client.htm client.htm rs_client.htm RSExecute(url,”VCC”, 4225,MyCallback); function MyCallback(co) { r = co.return_value; } server.asp <% function VCC(CC) { … return true; } RSDispatch();%> rs_server.asp server.asp true true Remote Scripting In action
Remote Scripting Provided in source form Runs cross-platform - some functions require ECMA 262 compliant engines Java proxy enables Remote Scripting to work with many browsers - so you can use it on the server without limiting reach
Pulling It All Together…
Windows Scripting Host v2 Batch files come to Windows! WSH 1.0 shipped with Windows 98 and Windows NT 4.0 Option Pack WSH 1.0 shipped with Windows 98 and Windows NT 4.0 Option Pack WSH 2.0 ships in Windows NT 5.0, downloadable for other platforms WSH 2.0 addresses top 4 user requests Includes Includes Type Library Type Library Multiple Engines Multiple Engines Tools support Tools support
WSH In Person…
Developing With Script
Debugging Script Debugging support Light-weight debugger in Windows NT 5.0 Light-weight debugger in Windows NT 5.0 Full featured debugging with Visual InterDev 6.0 Full featured debugging with Visual InterDev 6.0 Defined ways of integrating debugging Host Debugging Interfaces (smart) Host Debugging Interfaces (smart) Script Engine Interfaces (simple) Script Engine Interfaces (simple) Smart host examples Internet Explorer, Internet Information Services Internet Explorer, Internet Information Services
Debugging Script Demo
Summary Script is everywhere Script is simple Script is powerful Script is light-weight Script is integrated into Windows NT 5.0!
Where To Get More… Other PDC Sessions Hosting - Chris Weight (Win10) Hosting - Chris Weight (Win10) Developing a Script Engine - Mark Hammond (Tools08) Developing a Script Engine - Mark Hammond (Tools08) The Web… sitebuilder/magazine sitebuilder/magazine Clinick’s Clinic on Scripting Clinick’s Clinic on Scripting Feedback - msnews.microsoft.com public.scripting.* public.scripting.*
Call To Action Integrate Script Start using v5 features Use the Script technologies in Wondows NT 5.0 VBScript, JScript VBScript, JScript Scriptlets Scriptlets Windows Scripting Host Windows Scripting Host Attend other scripting sessions: Active Scripting Engines (TOOL08) Active Scripting Engines (TOOL08) Hosting Script Engines (WIN10) Hosting Script Engines (WIN10)