Up

 

  

 
Html User Interface
The user below is defined in the Label example profile. Below we will explain the different elements in the VBScript section of the  html-page.

 

The page consists of the following ActiveX controls:
  • TDVDropDownList - Mode selection
  • InternetMessenger - sends and retrieves tcp/ip message to/from Scorpion
  • SimpleStatX - show error counters
  • TDVButton - resets / zeros the operation statistics

The ActiveXes are configured using their property pages. More information on Scorpion Plugins.

All text in the user interface is maintained by Frontpage or another html-editor. On the Scorpion CD a free text-editor Notepad++ is available - with the editor one can easily edit the vbscripts on in the html-help file. Activated by right-click the windows and selecting Show Source.

A VBScript reference pages are availabe at the MSDN web site :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriVBScript.asp

Script tags

The Scripts  tags define the start and the end of the client side script in a html-page.

<SCRIPT language=vbscript>
</SCRIPT>

Sending debugmessages from the htmlpage

Debugging the client side script can be a bit hard. This function sends a text message over tcp/ip. The TInternetMessenger application can be a receiver for these messages.

sub SendDebugMessage(text)
  InternetMessenger.Send "destination=localhost:7700:" & text
end sub

Parsing Statistics from Scorpion

Scorpion sends the following response on request : Statistics;OK=12;Error=4;Total=1;
Note the ; at the end.
The ProcessStatistics parses the string and sets all elements of SimpleStatX. SimpleStatX is configured using its property pages.


sub ProcessStatistics(Command)
  SendDebugMessage(Command)
  str0 = Mid(Command,11)
  pos = InStr(str0,";")
  Do While pos ' Inner loop.
    str1 = Mid(str0,1,pos-1)
    pos1 = InStr(str1,"=")
    if (pos1) then
      name = Mid(str1,1,pos1-1)
      value = Mid(str1,pos1+1)
      SendDebugMessage(name + "-" + value)
      SimpleStatX.Set name,value
    end if
    str0 = Mid(str0,pos+1)
    pos = InStr(str0,";")
  Loop
end sub

Parsing Setup from Scorpion

Scorpion sends the following response on request : Setup;Lowtolerance=1;
Note the ; at the end.
The ProcessSetup parses the string and sets the Mode. Mode, TDVDropDownList, is configured using its property pages.


sub ProcessSetup(Command)
  str0 = Mid(Command,5)
  pos = InStr(str0,";")
  Do While pos
    str1 = Mid(str0,1,pos-1)
    pos1 = InStr(str1,"=")
    if (pos1) then
      name = Mid(str1,1,pos1-1)
      value = Mid(str1,pos1+1)
      SendDebugMessage(name & "-" & value)
      if  ( name = "Lowtolerance" ) then
        if (value=0) then
          Mode.ItemName="Sample"
        else
          Mode.ItemName="Operation"
        end if
      end if
    end if
    str0 = Mid(str0,pos+1)
    pos = InStr(str0,";")
  Loop
end sub

Executing userdefined  Actions in  Scorpion

The following methods executes userdefined actions in Scorpion.

sub SetHighTolerance()
  InternetMessenger.Send "Mode_Hightolerance"
end sub

sub SetLowTolerance()
  InternetMessenger.Send "Mode_Lowtolerance"
end sub

Receiving messages from Scorpion

The  InternetMessenger_Received is executed when Scorpion sends a tcp/ip command to the web page. When InternetMessenger receives a command the Receive events is called. This eventhandler handles the custom Setup and Statistics commands and calls the appropriate parser. Commands receives with Setup or Statistics prefix are dropped.

sub InternetMessenger_Receive(From,Command)
  SendDebugMessage(Command)
  pos = InStr(1,Command,"Setup")
  if (pos=1) then
    ProcessSetup(Command)
  end if
  pos = InStr(1,Command,"Statistics")
  if (pos=1) then
    ProcessStatistics(Command)
  end if
end sub

Resetting Statistics

The Zero_OnClick eventhandler calls the Zero function that sends a Zero Statistics command to Scorpion.

sub Zero_OnClick()
  Zero()
end sub

sub Zero()
  Interne tMessenger.Send "Zero Statistics"
end sub

Change operation mode

The user changes the the mode of operation by sending the appropriate commands to the Scorpion profile.

sub Mode_OnChange(ItemName)
  if (ItemName = "Operation") then
    SetLowTolerance()
    Zero()
  else
    SetHighTolerance()
    Zero()
  end if
end sub


On page load

When the web page loads it requests Scorpipn to send the  current configuration. Scorpion is responsible for persistence.

sub init_web_page()
  InternetMessenger.Send "SendSetup"
end sub
 

Note: The following body tag is needed to get init_web_page to be call at startup

<BODY onload=init_web_page bgproperties="fixed">

 

 

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.