Custom
ASP Page
This section presents an example
of an Active Service Page (ASP) that uses iNetGrowX to compose web pages. For more information about this page
see the discussion on ASP.
<% option explicit
%>
<html>
<head>
<link
rel="SHORTCUT ICON" HREF="favicon.ico">
<title>Sprinkler
Controller</title>
<style>
td{width:150px; font-family:Verdana; font-size:12px;}
body{font-family:Verdana;
font-size:12px;}
</style>
</head>
<body
bgcolor="#ffffff">
<p>
<b> Sprinkler
Controller
<%
Dim oGrow, n, nNumInputs, nNumOutputs,
nNumVariables, nNumParameters
Dim nValue, nMode, txtValue, nMinute,
txtMinute
set oGrow =
Server.CreateObject("INETGROWX.iNetGrowXCtrl.1")
n =
oGrow.Connect("192.168.0.65" , 8449)
if n=0 then Response.Write " (not
connected!)</b>" : Response.End
if n=1 then Response.Write "
(connected)</b><br><br>"
nNumInputs = oGrow.GetNumInputs(1)
nNumOutputs = oGrow.GetNumOutputs(0)
nNumVariables =
oGrow.GetNumVariables(0)
nNumParameters =
oGrow.GetNumParameters(0)
if Request.Form("PbUpdate")
= "Save Changes" then
nMode=0
if
Request.Form("selMode_1")=1 then nMode = nMode + 1
if
Request.Form("selMode_1")=2 then nMode = nMode + &H10
if Request.Form("selMode_2")=1 then nMode = nMode + 2
if Request.Form("selMode_2")=2 then nMode = nMode + &H20
if Request.Form("selMode_3")=1 then nMode = nMode + 4
if Request.Form("selMode_3")=2 then nMode = nMode + &H40
if Request.Form("selMode_4")=1 then nMode = nMode + 8
if Request.Form("selMode_4")=2 then nMode = nMode + &H80
call
oGrow.SetParameterValue(0, nMode)
call oGrow.SetParameterValue(3,
Request.Form("selDay_1"))
call
oGrow.SetParameterValue(4, Request.Form("selDay_2"))
call
oGrow.SetParameterValue(5, Request.Form("selDay_3"))
nValue=60*Request.Form("selStartHour_1")+Request.Form("selStartMinute_1")
call
oGrow.SetParameterValue(6, nValue)
nValue=60*Request.Form("selStartHour_2")+Request.Form("selStartMinute_2")
call
oGrow.SetParameterValue(7, nValue)
nValue=60*Request.Form("selStartHour_3")+Request.Form("selStartMinute_3")
call
oGrow.SetParameterValue(8, nValue)
call
oGrow.SetParameterValue( 9, Request.Form("txtDuration_11"))
call
oGrow.SetParameterValue(10, Request.Form("txtDuration_12"))
call
oGrow.SetParameterValue(11, Request.Form("txtDuration_13"))
call
oGrow.SetParameterValue(12, Request.Form("txtDuration_21"))
call
oGrow.SetParameterValue(13, Request.Form("txtDuration_22"))
call
oGrow.SetParameterValue(14, Request.Form("txtDuration_23"))
call
oGrow.SetParameterValue(15, Request.Form("txtDuration_31"))
call
oGrow.SetParameterValue(16, Request.Form("txtDuration_32"))
call
oGrow.SetParameterValue(17, Request.Form("txtDuration_33"))
call
oGrow.SetParameterValue(18, Request.Form("txtDuration_41"))
call
oGrow.SetParameterValue(19, Request.Form("txtDuration_42"))
call
oGrow.SetParameterValue(20, Request.Form("txtDuration_43"))
end if
%>
<form
name="iNetGrowForm" method="POST"
action="pejm.asp">
<p>
<p>
<p>
<table
border="0">
<tr> <td
width="50"><b>Zone</b></td><td
width="100"><b>Current state</b></td><td
width="100"><b>Operating
mode</b></td></tr>
<%
nValue=oGrow.GetParameterValue(0) %>
<tr>
<td><b>1</b></td>
<td><b><% if oGrow.GetOutputValue(0)
<> 0 then response.write("on") else
response.write("off") %></b></td>
<% nMode=0
if (nValue And 1) <> 0 then
nMode=1
if (nValue And &H10) <> 0
then nMode=2
%>
<td> <SELECT NAME="selMode_1">
<OPTION <% if
nMode=0 then response.write("selected") %>
VALUE="0">Automatic 
<OPTION <%
if nMode=1 then response.write("selected") %>
VALUE="1">Force ON
<OPTION <%
if nMode=2 then response.write("selected") %>
VALUE="2">Force OFF
</SELECT>
</td>
</tr>
<tr>
<td><b>2</b></td>
<td><b><% if oGrow.GetOutputValue(1)
<> 0 then response.write("on") else
response.write("off") %></b></td>
<% nMode=0
if (nValue And 2) <> 0 then
nMode=1
if (nValue And &H20) <> 0
then nMode=2
%>
<td> <SELECT NAME="selMode_2">
<OPTION <%
if nMode=0 then response.write("selected") %>
VALUE="0">Automatic 
<OPTION <%
if nMode=1 then response.write("selected") %>
VALUE="1">Force ON
<OPTION <%
if nMode=2 then response.write("selected") %>
VALUE="2">Force OFF
</SELECT>
</td>
</tr>
<tr>
<td><b>3</b></td>
<td><b><% if oGrow.GetOutputValue(2)
<> 0 then response.write("on") else
response.write("off") %></b></td>
<% nMode=0
if (nValue And 4) <> 0 then nMode=1
if (nValue And &H40) <> 0
then nMode=2
%>
<td> <SELECT NAME="selMode_3">
<OPTION <%
if nMode=0 then response.write("selected") %>
VALUE="0">Automatic 
<OPTION <%
if nMode=1 then response.write("selected") %>
VALUE="1">Force ON
<OPTION <%
if nMode=2 then response.write("selected") %>
VALUE="2">Force OFF
</SELECT>
</td>
</tr>
<tr>
<td><b>4</b></td>
<td><b><% if oGrow.GetOutputValue(3)
<> 0 then response.write("on") else
response.write("off") %></b></td>
<% nMode=0
if (nValue And 8) <> 0 then
nMode=1
if (nValue And &H80) <> 0
then nMode=2
%>
<td> <SELECT NAME="selMode_4">
<OPTION <%
if nMode=0 then response.write("selected") %> VALUE="0">Automatic 
<OPTION <%
if nMode=1 then response.write("selected") %>
VALUE="1">Force ON
<OPTION <%
if nMode=2 then response.write("selected") %>
VALUE="2">Force OFF
</SELECT>
</td>
</tr>
</table>
<p>
<p>
<table border="0">
<tr>
<td
width="250"><b>Schedules</b></td> <td
width="250"><b>Weekly (1)</b></td> <td
width="250"><b>Weekly (2)</b></td> <td
width="250"><b>Special</b></td>
</tr>
<tr>
<td> Day of week </td>
<% nValue=oGrow.GetParameterValue(3) %>
<td> <SELECT NAME="selDay_1">
<OPTION <%
if nValue=0 then response.write("selected") %>
VALUE="0">(disabled)
<OPTION <%
if nValue=1 then response.write("selected") %>
VALUE="1">Sunday
<OPTION <%
if nValue=2 then response.write("selected") %>
VALUE="2">Monday
<OPTION <%
if nValue=3 then response.write("selected") %>
VALUE="3">Tuesday
<OPTION <%
if nValue=4 then response.write("selected") %>
VALUE="4">Wednesday
<OPTION <%
if nValue=5 then response.write("selected") %>
VALUE="5">Thursday
<OPTION <%
if nValue=6 then response.write("selected") %>
VALUE="6">Friday
<OPTION <%
if nValue=7 then response.write("selected") %>
VALUE="7">Saturday
</SELECT>
</td>
<% nValue=oGrow.GetParameterValue(4) %>
<td> <SELECT NAME="selDay_2">
<OPTION <%
if nValue=0 then response.write("selected") %>
VALUE="0">(disabled)
<OPTION <%
if nValue=1 then response.write("selected") %>
VALUE="1">Sunday
<OPTION <%
if nValue=2 then response.write("selected") %>
VALUE="2">Monday
<OPTION <%
if nValue=3 then response.write("selected") %>
VALUE="3">Tuesday
<OPTION <%
if nValue=4 then response.write("selected") %>
VALUE="4">Wednesday
<OPTION <%
if nValue=5 then response.write("selected") %>
VALUE="5">Thursday
<OPTION <%
if nValue=6 then response.write("selected") %>
VALUE="6">Friday
<OPTION <%
if nValue=7 then response.write("selected") %>
VALUE="7">Saturday
</SELECT>
</td>
<% nValue=oGrow.GetParameterValue(5) %>
<td> <SELECT NAME="selDay_3">
<OPTION <%
if nValue=0 then response.write("selected") %>
VALUE="0">(disabled)
<OPTION <%
if nValue=1 then response.write("selected") %>
VALUE="1">Sunday
<OPTION <%
if nValue=2 then response.write("selected") %>
VALUE="2">Monday
<OPTION <%
if nValue=3 then response.write("selected") %>
VALUE="3">Tuesday
<OPTION <%
if nValue=4 then response.write("selected") %>
VALUE="4">Wednesday
<OPTION <%
if nValue=5 then response.write("selected") %>
VALUE="5">Thursday
<OPTION <%
if nValue=6 then response.write("selected") %>
VALUE="6">Friday
<OPTION <%
if nValue=7 then response.write("selected") %>
VALUE="7">Saturday
</SELECT>
</td>
</tr>
<tr>
<td> Start time </td>
<% nValue=Int(oGrow.GetParameterValue(6)/60) %>
<td> <SELECT
NAME="selStartHour_1">
<OPTION <%
if nValue= 0 then response.write("selected") %>
VALUE="0">Midnight
<OPTION <% if nValue= 1 then
response.write("selected") %> VALUE="1">1 AM
<OPTION <%
if nValue= 2 then response.write("selected") %>
VALUE="2">2 AM
<OPTION <%
if nValue= 3 then response.write("selected") %>
VALUE="3">3 AM
<OPTION <%
if nValue= 4 then response.write("selected") %>
VALUE="4">4 AM
<OPTION <%
if nValue= 5 then response.write("selected") %>
VALUE="5">5 AM
<OPTION <%
if nValue= 6 then response.write("selected") %>
VALUE="6">6 AM
<OPTION <%
if nValue= 7 then response.write("selected") %>
VALUE="7">7 AM
<OPTION <%
if nValue= 8 then response.write("selected") %>
VALUE="8">8 AM
<OPTION <%
if nValue= 9 then response.write("selected") %>
VALUE="9">9 AM
<OPTION <%
if nValue=10 then response.write("selected") %>
VALUE="10">10 AM
<OPTION <%
if nValue=11 then response.write("selected") %>
VALUE="11">11 AM
<OPTION <%
if nValue=12 then response.write("selected") %>
VALUE="12">Noon
<OPTION <%
if nValue=13 then response.write("selected") %>
VALUE="13">1 PM
<OPTION <%
if nValue=14 then response.write("selected") %>
VALUE="14">2 PM
<OPTION <%
if nValue=15 then response.write("selected") %>
VALUE="15">3 PM
<OPTION <%
if nValue=16 then response.write("selected") %>
VALUE="16">4 PM
<OPTION <%
if nValue=17 then response.write("selected") %>
VALUE="17">5 PM
<OPTION <%
if nValue=18 then response.write("selected") %>
VALUE="18">6 PM
<OPTION <%
if nValue=19 then response.write("selected") %>
VALUE="19">7 PM
<OPTION <%
if nValue=20 then response.write("selected") %>
VALUE="20">8 PM
<OPTION <%
if nValue=21 then response.write("selected") %>
VALUE="21">9 PM
<OPTION <%
if nValue=22 then response.write("selected") %>
VALUE="22">10 PM
<OPTION <%
if nValue=23 then response.write("selected") %>
VALUE="23">11 PM
</SELECT>
<% nValue=5*Int((oGrow.GetParameterValue(6) Mod
60)/5)%>
<SELECT
NAME="selStartMinute_1">
<OPTION <%
if nValue= 0 then response.write("selected") %>
VALUE="0">00
<OPTION <%
if nValue= 5 then response.write("selected") %>
VALUE="5">05
<OPTION <%
if nValue=10 then response.write("selected") %>
VALUE="10">10
<OPTION <% if
nValue=15 then response.write("selected") %>
VALUE="15">15
<OPTION <%
if nValue=20 then response.write("selected") %>
VALUE="20">20
<OPTION <%
if nValue=25 then response.write("selected") %>
VALUE="25">25
<OPTION <%
if nValue=30 then response.write("selected") %>
VALUE="30">30
<OPTION <%
if nValue=35 then response.write("selected") %>
VALUE="35">35
<OPTION <%
if nValue=40 then response.write("selected") %>
VALUE="40">40
<OPTION <%
if nValue=45 then response.write("selected") %>
VALUE="45">45
<OPTION <%
if nValue=50 then response.write("selected") %>
VALUE="50">50
<OPTION <%
if nValue=55 then response.write("selected") %>
VALUE="55">55
</SELECT>
</td>
<% nValue=Int(oGrow.GetParameterValue(7)/60) %>
<td> <SELECT
NAME="selStartHour_2">
<OPTION <%
if nValue= 0 then response.write("selected") %>
VALUE="0">Midnight
<OPTION <%
if nValue= 1 then response.write("selected") %>
VALUE="1">1 AM
<OPTION <%
if nValue= 2 then response.write("selected") %>
VALUE="2">2 AM
<OPTION <%
if nValue= 3 then response.write("selected") %>
VALUE="3">3 AM
<OPTION <%
if nValue= 4 then response.write("selected") %>
VALUE="4">4 AM
<OPTION <%
if nValue= 5 then response.write("selected") %>
VALUE="5">5 AM
<OPTION <%
if nValue= 6 then response.write("selected") %>
VALUE="6">6 AM
<OPTION <%
if nValue= 7 then response.write("selected") %>
VALUE="7">7 AM
<OPTION <% if
nValue= 8 then response.write("selected") %>
VALUE="8">8 AM
<OPTION <%
if nValue= 9 then response.write("selected") %>
VALUE="9">9 AM
<OPTION <%
if nValue=10 then response.write("selected") %>
VALUE="10">10 AM
<OPTION <%
if nValue=11 then response.write("selected") %>
VALUE="11">11 AM
<OPTION <%
if nValue=12 then response.write("selected") %>
VALUE="12">Noon
<OPTION <%
if nValue=13 then response.write("selected") %>
VALUE="13">1 PM
<OPTION <%
if nValue=14 then response.write("selected") %>
VALUE="14">2 PM
<OPTION <%
if nValue=15 then response.write("selected") %>
VALUE="15">3 PM
<OPTION <%
if nValue=16 then response.write("selected") %>
VALUE="16">4 PM
<OPTION <%
if nValue=17 then response.write("selected") %>
VALUE="17">5 PM
<OPTION <%
if nValue=18 then response.write("selected") %>
VALUE="18">6 PM
<OPTION <%
if nValue=19 then response.write("selected") %>
VALUE="19">7 PM
<OPTION <%
if nValue=20 then response.write("selected") %>
VALUE="20">8 PM
<OPTION <%
if nValue=21 then response.write("selected") %>
VALUE="21">9 PM
<OPTION <%
if nValue=22 then response.write("selected") %>
VALUE="22">10 PM
<OPTION <%
if nValue=23 then response.write("selected") %>
VALUE="23">11 PM
</SELECT>
<% nValue=5*Int((oGrow.GetParameterValue(7) Mod
60)/5)%>
<SELECT
NAME="selStartMinute_2">
<OPTION <%
if nValue= 0 then response.write("selected") %>
VALUE="0">00
<OPTION <%
if nValue= 5 then response.write("selected") %>
VALUE="5">05
<OPTION <%
if nValue=10 then response.write("selected") %>
VALUE="10">10
<OPTION <%
if nValue=15 then response.write("selected") %>
VALUE="15">15
<OPTION <% if
nValue=20 then response.write("selected") %>
VALUE="20">20
<OPTION <%
if nValue=25 then response.write("selected") %>
VALUE="25">25
<OPTION <%
if nValue=30 then response.write("selected") %>
VALUE="30">30
<OPTION <% if
nValue=35 then response.write("selected") %>
VALUE="35">35
<OPTION <%
if nValue=40 then response.write("selected") %>
VALUE="40">40
<OPTION <%
if nValue=45 then response.write("selected") %>
VALUE="45">45
<OPTION <%
if nValue=50 then response.write("selected") %>
VALUE="50">50
<OPTION <%
if nValue=55 then response.write("selected") %>
VALUE="55">55
</SELECT>
</td>
<% nValue=Int(oGrow.GetParameterValue(8)/60) %>
<td> <SELECT
NAME="selStartHour_3">
<OPTION <% if nValue= 0 then
response.write("selected") %> VALUE="0">Midnight
<OPTION <%
if nValue= 1 then response.write("selected") %>
VALUE="1">1 AM
<OPTION <%
if nValue= 2 then response.write("selected") %>
VALUE="2">2 AM
<OPTION <% if nValue= 3 then
response.write("selected") %> VALUE="3">3 AM
<OPTION <%
if nValue= 4 then response.write("selected") %>
VALUE="4">4 AM
<OPTION <%
if nValue= 5 then response.write("selected") %>
VALUE="5">5 AM
<OPTION <%
if nValue= 6 then response.write("selected") %>
VALUE="6">6 AM
<OPTION <%
if nValue= 7 then response.write("selected") %>
VALUE="7">7 AM
<OPTION <%
if nValue= 8 then response.write("selected") %>
VALUE="8">8 AM
<OPTION <% if
nValue= 9 then response.write("selected") %>
VALUE="9">9 AM
<OPTION <%
if nValue=10 then response.write("selected") %>
VALUE="10">10 AM
<OPTION <%
if nValue=11 then response.write("selected") %>
VALUE="11">11 AM
<OPTION <%
if nValue=12 then response.write("selected") %>
VALUE="12">Noon
<OPTION <%
if nValue=13 then response.write("selected") %>
VALUE="13">1 PM
<OPTION <%
if nValue=14 then response.write("selected") %>
VALUE="14">2 PM
<OPTION <%
if nValue=15 then response.write("selected") %>
VALUE="15">3 PM
<OPTION <%
if nValue=16 then response.write("selected") %>
VALUE="16">4 PM
<OPTION <%
if nValue=17 then response.write("selected") %>
VALUE="17">5 PM
<OPTION <% if
nValue=18 then response.write("selected") %>
VALUE="18">6 PM
<OPTION <%
if nValue=19 then response.write("selected") %>
VALUE="19">7 PM
<OPTION <%
if nValue=20 then response.write("selected") %>
VALUE="20">8 PM
<OPTION <%
if nValue=21 then response.write("selected") %>
VALUE="21">9 PM
<OPTION <%
if nValue=22 then response.write("selected") %>
VALUE="22">10 PM
<OPTION <%
if nValue=23 then response.write("selected") %>
VALUE="23">11 PM
</SELECT>
<% nValue=5*Int((oGrow.GetParameterValue(8) Mod
60)/5)%>
<SELECT
NAME="selStartMinute_3">
<OPTION <%
if nValue= 0 then response.write("selected") %>
VALUE="0">00
<OPTION <%
if nValue= 5 then response.write("selected") %>
VALUE="5">05
<OPTION <%
if nValue=10 then response.write("selected") %>
VALUE="10">10
<OPTION <%
if nValue=15 then response.write("selected") %>
VALUE="15">15
<OPTION <%
if nValue=20 then response.write("selected") %>
VALUE="20">20
<OPTION <%
if nValue=25 then response.write("selected") %>
VALUE="25">25
<OPTION <%
if nValue=30 then response.write("selected") %>
VALUE="30">30
<OPTION <%
if nValue=35 then response.write("selected") %>
VALUE="35">35
<OPTION <% if
nValue=40 then response.write("selected") %>
VALUE="40">40
<OPTION <%
if nValue=45 then response.write("selected") %>
VALUE="45">45
<OPTION <%
if nValue=50 then response.write("selected") %>
VALUE="50">50
<OPTION <%
if nValue=55 then response.write("selected") %>
VALUE="55">55
</SELECT>
</td>
</tr>
<tr>
<td> Zone 1 (minutes)</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_11"" VALUE="" " &
oGrow.GetParameterValue( 9) & " "">") %>
</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_12"" VALUE="" " &
oGrow.GetParameterValue(10) & " "">") %>
</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_13"" VALUE="" " &
oGrow.GetParameterValue(11) & " "">") %>
</td>
</tr>
<tr>
<td> Zone 2 (minutes)</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_21"" VALUE="" " &
oGrow.GetParameterValue(12) & " "">") %>
</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_22"" VALUE="" " &
oGrow.GetParameterValue(13) & " "">") %>
</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_23"" VALUE="" " &
oGrow.GetParameterValue(14) & " "">") %>
</td>
</tr>
<tr>
<td> Zone 3 (minutes)</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_31"" VALUE="" " &
oGrow.GetParameterValue(15) & " "">") %>
</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_32"" VALUE="" " &
oGrow.GetParameterValue(16) & " "">") %>
</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_33"" VALUE="" " &
oGrow.GetParameterValue(17) & " "">") %>
</td>
</tr>
<tr>
<td> Zone 4 (minutes)</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_41"" VALUE="" " &
oGrow.GetParameterValue(18) & " "">") %>
</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_42"" VALUE="" " &
oGrow.GetParameterValue(19) & " "">") %>
</td>
<td>
<% Response.Write("<INPUT TYPE=text SIZE=6
NAME=""txtDuration_43"" VALUE="" " &
oGrow.GetParameterValue(20) & " "">") %>
</td>
</tr>
</table>
<p>
<p>
<table
border="0">
<tr>
<td><b>Temperature</b></td>
<td><b><%
Response.Write(oGrow.GetInputValue(1) & " Fahrenheit")
%></b></td>
</tr>
<tr>
<td><b>Time</b></td>
<% nValue=oGrow.GetVariableValue(0)
nMinute=Int(nValue Mod 60)
if nMinute>=10 then
txtMinute=nMinute else txtMinute="0" & nMinute
if Int(nValue/60)<12 then
txtValue=Int(nValue/60)
& ":" & txtMinute & " AM"
else
nValue=Int(nValue/60)-12
if nValue=0 then
nValue=12
txtValue=nValue &
":" & txtMinute & " PM"
end if
%>
<td><b><%
Response.Write(txtValue) %></b></td>
</tr>
</table>
</font>
<br><br>
<input type="submit"
name="PbUpdate" value="Save Changes" >
<input type="submit"
name="PbRefresh" value="Retrieve Values" >
</form>
<p>
Demonstrates a web
interface to <a
href="http://www.iNetGrow.com/">iNetGrow</a> family of
agricultural controllers.
</body>
</html>
<%
Set oGrow = Nothing
%>
Also see iNetGrowX, Integrating with
Web Services, ASP
© Rigel Corporation iNetGrow 2003-2006. All rights reserved.