The ASP.NET DLL is also a COM object meaning that entire GrabzIt ASP.NET API can be used across many environments, as long as the target computer also has the full .NET Framework installed. For instance it could be used in to take a web screenshot from a macro, CScript, JScript, Classic ASP, C++ program or any other COM compatible programming language.
To start using GrabzIt as a COM object, first install the .NET Framework and then download the ASP.NET Library. Then extract the RegisterCOM.bat and GrabzIt.dll files into same directory as your app.
Next the GrabzIt COM Object must be registered this can either be done by using the regasm.exe as usual. Or you can use the RegisterCOM.bat file. Just right click on RegisterCOM.bat and select Run as administrator. Then choose to register the COM object as 64 or 32 bit component. Check that the bat file output states the COM object was successfully registered before closing the window.
Once the DLL has been registered it can no be used anywhere in the system. The methods and classes that have been made available through GrabzIt's COM component are marked with COM in the ASP.NET documentation.
Below is a simple example of a screenshot being taken of Google using JScript. Remember to ensure that the script has sufficent rights to store the screenshot in the specified directory.
var grabzit = new ActiveXObject("GrabzIt.GrabzItClient");
var options = new ActiveXObject("GrabzIt.Parameters.ImageOptions");
grabzit.ApplicationKey = "Sign in to view your Application Key";
grabzit.ApplicationSecret = "Sign in to view your Application Secret";
//do something with a exception
To execute the JScript example above, save it to a file for instance as screenshot.js and then open up a command line window. Navigate to the file location. Then run command wscript screenshot.js.
Next, the same COM object is going to be used in a more complicated example using Classic ASP. You may have noticed that the Country property, which is a enum in GrabzIt's .NET library is set to 1. This is because enums are not available in Classic ASP and the numerical values of enums, specified in the ASP.NET documentation, must be used when using GrabzIt's COM component.
set grabzit = Server.CreateObject("GrabzIt.GrabzItClient")
set options = Server.CreateObject("GrabzIt.Parameters.ImageOptions")
options.OutputWidth = 100
options.OutputHeight = 100
options.Country = 1
grabzit.ApplicationKey = "Sign in to view your Application Key"
grabzit.ApplicationSecret = "Sign in to view your Application Secret"
call grabzit.URLToImage("https://www.tesla.com", (options))
This means that the procedure is either wrong or an argument is wrong. With GrabzIt's COM object it is important to ensure all arguments are specified. This is why in the first example the ImageOptions object is passed to URLToImage method even though no options are set.