ccicon.gif (2066 bytes)    CoolCounter Control - Getting Started.

Hi.

Welcome to the CoolCounter "Getting Started" page. Here we try to get you going with the new CoolCounter control.

First, lets see where we can actually use CoolCounter ?

The CoolCounter Control is an ActiveX component. Being that it can be embedded into several environments (containers). The popular containers for ActiveX controls are: Visual Basic, Delphi, Internet Explorer and other Microsoft Tools like MS Access, Excel, FoxPro etc. NOTICE: CoolCounter  can be embedded into an HTML page but can only be viewed by MS Internet Explorer (version 3.02 and above). Netscape browsers currently do not support ActiveX controls.


What can I use CoolCounter for ?

CoolCounter has two basic ways it can work. The first way allows the control to receive live Internet updates. This means that you can link any numeric data from any web site in the world to be displayed by the CoolCounter. In this mode of operation CoolCounter will periodically query a web server for a numeric value and when it receives the response it will update the counter. No script is required. The second way you can use CoolCounter is without live Internet updates. In this mode of operation the numeric value displayed by the counter is driven by user input or some script (e.g. VBScript).

To further illustrate this point lets think of two practical examples.

If we wish to display the number of hits on a web page viewed by Internet Explorer users we will use the first mode of operation (Live Internet updates). If on the other hand we just want to display the number of times a user hit a button on a web page we will use VBScript to change the value of the Counter.


How do I insert CoolCounter into an HTML page ?

The way to insert a Control into a web page depends on the HTML editor you are using. We will describe how to do that if you are using FrontPage 98. Other editors have similar ways of doing the same thing. Below you can also take a look how the HTML source code actually looks like. Go to the Insert menu item and chose the Advanced sub menu. Then choose ActiveX control. A dialog box will open. Select "CoolCounter Control" from the list of available controls and press the OK button. You should see a new CoolCounter control located on your web page.

Sample HTML:

<object id="Counter1" name="Counter1"
classid="CLSID:901EA1E3-9FA2-11D1-8950-F408B982101C"
codebase="ccounter.cab" align="baseline" border="0"
width="223" height="49">
<param name="_Version" value="65537">
<param name="_ExtentX" value="5891">
<param name="_ExtentY" value="1305">
<param name="_StockProps" value="41">
<param name="BackColor" value="0">
</object>

Another issue that you need to take care of is the location of the CoolCounter control or a cab file containing the control is located. This is done via the code source field located in the properties dialog (see below). The ccounter.ocx should be located on the web server in the same directory where the HTML page is located. You can also use a cab file to compress the CCounter.ocx and provide additional DLL's.

wpe2.jpg (25413 bytes)


How do I change the appearance of the CoolCounter Control ?

You can customize the control's color, size and font using the FrontPage property page. To view the properties of the Control right click on the control and select properties. A dialog box will open (seen above). On the dialog there is another properties button. Press this button to display the list of CoolCounter properties. You can now change specific properties (For a list of available properties take a look at the CCounter.HLP file located in your CoolCounetr directory).


How do I determine if CoolCounter receives Internet updates or not ?

The key to specifying if CoolCounter is run in Internet update mode or not is a property called WebEnable. This property has a Boolean value (TRUE/FALSE). TRUE specifies that the control will receive live Internet updates.

A section on how to use the CoolCounter without Internet updates will soon be added.


How do I set the WebEnable property ?

There are two ways to set the WebEnable property. This first way is when you design the web page. The second is in run-time. To set the property in design time use the control's property page and change the WebEnable property to TRUE (by default it is FALSE). Another way of doing the same thing is via VBScript. The following example shows how you can toggle the WebEnable property when a page is loaded or unloaded (When the user navigates in and out of this page).

VB Script for enabling live Internet updates:

<script language="VBScript">

<!--

Sub window_onLoad()

Counter1.WebEnable = True

end sub

Sub window_onUnload()

Counter1.WebEnable = False

end sub

-->

</script>


How do I determine from where the CoolCounter will receive  it's value ?

In order for the CoolCounter Control to receive live Internet updates it needs to query a remote CGI script. A sample PERL script called counter.cgi is shipped with the CoolCounter software. You need to place this script file in one of the directories of your web server. On UNIX based servers the file should have the following permissions 755. After you copy the script file to the server you need to set the web properties of the CoolCounter to point to that script. There are four web related properties that are exposed by the CoolCounter. All web related properties start with the prefix "Web...". They determine the location of the CGI script required for the operation of the counter. The four properties are:

WebEnable - Determines if the CoolCounter actually receives live Internet updates.

WebServerIP - This property specifies the location of the web server that contains the CGI script. The default value of this property is www.4developers.com which points to the 4Developers sample counter. You will need to change this property to point to your own web server.

WebCounterURL - This property specifies the full path to the CGI script that returns the counter value. e.g. : /cgi_bin/counter.cgi?GetValue

The script provided with CoolCounter (counter.cgi) uses a special keyword called "GetValue" to determine if the hit was performed by a real user or by the CoolCounter querying for the current value. (If you know a little PERL take a look at the counter.cgi file). If you already have a counter that returns a numeric value as simple text ( text/plain) you can use it instead of the counter.cgi file provided here.

WebUpdateInterval - This property specifies what is rate at which the CoolCounter queries the remote CGI script.

Sample CGI script:

#!/usr/local/bin/perl

print "Content-Type: text/plain\n\n";
$CounterFN = ".counter";

$NewValue = 0;

if (-f $CounterFN)
{
open(CNT,"<$CounterFN");
$NewValue = <CNT>;
close(CNT);
}

$qs = $ENV{'QUERY_STRING'};

if ($qs ne "GetValue")
{
$NewValue = $NewValue + 1;

open(COUNTER,">$CounterFN");
print COUNTER "$NewValue";
close(COUNTER);
}

print $NewValue;


For general questions and further technical support e-mail to:

support@4developers.com