VBScript Tutorial Code

 

sdkclient.htm:

 

<HTML>

<HEAD>

<TITLE></TITLE>

<P><STRONG><FONT face="" size=5>

PI-SDK Example</FONT></STRONG></P>

</HEAD>

<BODY>

 

<P><STRONG><FONT face="" size=5></FONT></STRONG>&nbsp;</P>

<P><FONT face="" size=4>HTML Page from server using local PI-SDK object to gather server information</FONT>.</P>

 

<P>Enter Server name:&nbsp;

<INPUT id=text1 name=text1></P>

<P>

<TABLE border=0 cellPadding=1 cellSpacing=1 width=72.34% height=242 style="HEIGHT: 242px; WIDTH: 429px">

<TR><TD>

<P><INPUT id=button1 name=button1 type=button value="Get Point Classes" language="vbscript" onclick="GetPointClasses"></P></TD>

<TD><P><SELECT id=select1 name=select1 size=5

style="HEIGHT: 102px; WIDTH: 183px">

<OPTION selected></SELECT></P></TD></TR>

<TR><TD></TD><TD></TD></TR>

<TR><TD>

<P><INPUT id=button2 name=button2 type=button value="Get Attributes" language="vbscript" onclick="GetAttributes"></P></TD>

<TD><SELECT id=select2 name=select2 size=5 style="HEIGHT: 102px;

WIDTH: 186px"> <OPTION selected></SELECT>

</TD></TR> 

<TR><TD></TD><TD></TD></TR></TABLE> 

</P>

<script language="vbscript">

dim srv, PISDK1, ptclasses

Function GetPointClasses()

 err.clear

 dim ptclass,e

 

 On error resume next

 set PISDK1 = createobject ("PISDK.PISDK")

 if err.number then

    msgbox err.description

    exit function

 end if

 set srv = PISDK1.Servers.Item(CStr(text1.value))

 if err.Number then

    msgbox err.description

    exit function

 end if

 ' Clear listbox

 select1.length = 0

 set ptclasses = srv.PointClasses

 for each ptclass in ptclasses

    Set e = Document.createElement("OPTION")

    e.Text=ptclass.name

    e.Value=ptclass.name

    select1.Options.Add e

 next  

 if err.number then

    msgbox "Error retrieving PointClass" & err.description

    exit function

 end if

end function

 

Function GetAttributes()

 err.clear

 On error resume next

 dim ptclass,e

 set ptclass = ptclasses(select1.value)

 ' Clear the list box

 select2.length = 0

 dim ptatr

 for each ptatr in ptclass.PointAttributes

    Set e = Document.createElement("OPTION")

    e.Text=ptatr.name

    e.Value="ListItemValue"

    select2.Options.Add e

 next

 end function

 

</script>

</BODY>

</HTML>

Enabling Operational Intelligence