|
Getting Started - part 2VBA has a feature called intellisense which will give a list of options as you type in code. For example type in some code. To do this choose "Module" from the "Insert" to insert a page which you can write code. Then write the code below:
As you type in "ToolsackBaseline." a list of all the objects in the ToolsackBaseline library are shown for you to choose from. (You may have noticed that you get a list as soon as you type "new ", the "ToolsackBaseline" is just to restrict the list to that library, you don't usually have to add it). Similarly, method names and parameters are suggested:
Now that you are familiar with using the library in VBA have a look at the Object Reference to see a full list of all the objects and their descriptions. Windows Scripting HostA ".vbs" file is a simple text file with VBScript in it. Similarly ".js" files use JScript, the whole technology is part of the "Windows Scripting Host". If you haven't used it before, the Windows Scripting Host is a very useful scripting system for Windows. It is now standard on Windows 2000 and Windows ME and is on most other Windows platforms installed with IE. VBScript is almost the same as VBA, with a notable exception that it is typeless which means you can't "Dim As" or use the "new" keyword. Here is a simple script, cut and paste it into a text file then rename it as "test.vbs". Double click the file to run it and see what happens. set b = CreateObject("Toolsack.Beeper")
b.beep
msgbox "You should have heard a beep. (On Windows 98/ME it sounds more like a click"
Likewise you can use all the Baseline objects from WSH files. Instead of using Dim o as new objectname
As you would have in VBA, you have to create the object with the CreateObject keyword. (You can use CreateObject in VBA too) set o = CreateObject("Toolsack.ObjectName")
When using the CreateObject keyword, you need to use the ProgID to specify the name of the object to create. For example use "Toolsack.DoubleList" to create the DoubleList. Active Server PagesIf you haven't used Active Server Pages before, they are dynamic web pages that include script to run on the web server. The script is VBScript, JScript or others and is used to change the output of that page. To use them you need IIS installed, which is outside the scope of this document. Once installed you can use the objects from script embedded in the file like this: <html>
<h1>Beeper</h1>
<%
set b = CreateObject("Toolsack.Beeper")
b.beep
response.write "the server should have beeped by now"
%>
</html>
When requested IIS will load the page, send the initial html directly to the client, run the script, then send the remaining html. The script embedded between the <% %> is VBScript just the same as in VBS files above. Using from Delphi, C++, DotNet etcCOM Objects can be used from just about every programming language on windows. Toolsack Baseline should work with all of them, we designed the interfaces to be very simple. One thing that you might notice is that interfaces begin with an underscore(_) instead of and I which is often used as a standard. We did this to make intellisense hide the interface names. ReviewBy now you should be comfortable with using the component objects in Toolsack Baseline in a number of environments. For more resources look at: Object Reference - http://www.toolsack.com/documentation/objectref/ Samples - http://www.toolsack.com/documentation/samples/ Articles - http://www.toolsack.com/documentation/articles/ |