Get <span> values from array

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
cybersnac
Posts: 6
Last visit: Sun Jun 24, 2007 10:15 pm

Get <span> values from array

Post by cybersnac »

Hello everyone.I've posted a few times in the past on these forums, asking for help and I learned alot from the input I received. I'm still new to scripting and need your help once again, if I may.I've been working on an .hta that combines many different tools that I use on a daily basis, one of which includes a section of code that will log onto a DNS server in my domain and list zones currently configured on that server.What I'm trying to do with this part of the tool is get a list of zones and then assign the name of each zones as a value in a span. The execution of the script so far, gets me a list of the zones and outputs a span for each zone name with an html button that calls more script that will hopefully, eventually bring up the configuration for the zone I choose.I will insert the code here and highlight the area I am having trouble with. What seems to be happening is that I can not get the variable value from one sub to pass to another and properly execute the configuration part of the script for the DNS zone.Below is the code. Please bear with me, I realize this is alot and I haven't gone through and commented it completely so it makes sense.The code I'm having trouble with is inside the commented section that begins and ends with '************ DNS CODE ************I believe my problems start when I call the sub DNSGetZoneConfig from an OnClick command with the button named "zone_button". The ID for the button is "zone_button" as well.I can't seem to pass the variable strZoneConf to the sub DNSGetZoneConfig. When I use a msgbox prompt to see what the value of the variable is, it comes up blank.<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>.:|Scripted Tools|:.</title><script language="vbscript">Dim intRefreshRt: intRefreshRt = 60000 '60 Second Refresh Rate in Milliseconds' Dictionary object created to store Host/Computer names and the DateTime of ' the last successful pingDim objDict: Set objDict = CreateObject("Scripting.Dictionary")' Define the file that will be used to store the Host/Computer namesDim strFileName: strFileName = "hostslist.txt"' Define variable that will be used to automatically refresh the dataDim iTimerID' Define constants to use when accessing the text fileConst ForReading = 1Const ForWriting = 2Const ForAppending = 8Dim oRS, oRecords, sOldCatDim sMessage, iCount, aTmp, aTemp, sCategoryConst SMTP_SVR = "10.201.5.110" ' Email SMTP ServerConst LDAP_DOMAIN = "DC=tki,DC=local" ' LDAP Domain StringConst FROM_ADDR = "wtsmith@tbccorp.com" ' Email From AddressConst To_ADDR = "wtsmith@tbccorp.com; vmeglis@tbccorp.com" ' Email To AddressConst SUBJECT = " New AD Objects for " ' Email Subject LineConst LOGGING = FalseSub GetObjectsSet oRecords = CreateObject("ADODB.Recordset")With oRecords .Fields.Append "objectCategory", 200, 255 .Fields.Append "distinguishedName", 200, 255 .Fields.Append "samAccountName", 200, 255 .Fields.Append "whenCreated", 200, 255 .Fields.Append "cn", 200, 255 .OpenEnd WithSet oRS = fSearch()Do While Not oRS.EOF aTemp = Split(oRS("objectCategory"), "CN=") sCategory = Replace(aTemp(1), ",", "") aTmp = Split(oRS("distinguishedName"), "OU=") iCount = iCount + 1 If sCategory <> "Dns-Node" then oRecords.AddNew oRecords("objectCategory") = sCategory oRecords("distinguishedName") = Replace(oRS("distinguishedName"), aTmp(0), "") If oRS("samAccountName") <> "" Then oRecords("samAccountName") = oRS("samAccountName") End If oRecords("whenCreated") = FormatDateTime(oRS("whenCreated"), vbShortTime) If oRS("cn") <> "" Then oRecords("cn") = oRS("cn") End If oRecords.Update End If oRS.MoveNextLoopIf LOGGING Then WScript.Echo "Records: " & oRecords.RecordCountoRecords.Sort = "objectCategory ASC"oRecords.MoveFirstIf iCount <> 0 Then Call sBuildHTMLHeader Do While Not oRecords.EOF If oRecords("objectCategory") <> sOldCat Then Call sObjectHeader(oRecords("objectCategory")) sOldCat = oRecords("objectCategory") End If Select Case LCase(oRecords("objectCategory")) Case "person" Call sTableEntry(oRecords("cn") & " (" & oRecords("samAccountName") & ") [" & oRecords("whenCreated) & ]", oRecords("distinguishedName")) Case "dns-node" ' Do Nothing Case Else Call sTableEntry(oRecords("cn") & " [" & oRecords("whenCreated) & ]", oRecords("distinguishedName")) End Select oRecords.moveNext Loop Call sBuildFooter If LOGGING Then WScript.Echo "Message: " & vbCRLF & sMessage If sMessage <> "" Then Call sSendMail(sMessage)End IfEnd Sub' --------------------------------------------------------' SUBS AND FUNCTIONS' --------------------------------------------------------Sub sSendMail(strBody) Dim oConfig, oMessage If mailado.Checked Then set oConfig = CreateObject("CDO.Configuration") set oMessage = CreateObject("CDO.Message") oConfig.Fields.Item("http://schemas.microsoft.com/cdo/config ... /sendusing") = 2 oConfig.Fields.Item("http://schemas.microsoft.com/cdo/config ... smtpserver") = SMTP_SVR oConfig.Fields.Update oMessage.Configuration = oConfig oMessage.To = To_ADDR oMessage.From = FROM_ADDR oMessage.Subject = iCount & SUBJECT & FormatDateTime(now, vbShortDate) oMessage.HTMLBody = strBody oMessage.SendElseEnd If results.innerHTML = "<center>" & strBody & "</center>"End Sub'___________________________________________________________Function fSearch() Dim oConnection, oCommand Dim oResults Set oConnection = CreateObject("ADODB.Connection") oConnection.provider = "ADsDSOObject" oConnection.open "Active Directory Provider" Set oCommand = CreateObject("ADODB.Command") oCommand.ActiveConnection = oConnection oCommand.Properties("page size") = 100 oCommand.Properties("sort on") = "whenCreated" oCommand.CommandText = "<LDAP://" & LDAP_DOMAIN & ">;(whenCreated>=" & fGetTimeFrame & "120000.0Z);objectCategory,cn,samAccountName,whenCreated,adsPath,distinguishedName,cn;subTree" Set oResults = oCommand.Execute oResults.MoveFirst Set fSearch = oResults Set oResults = NothingEnd Function'___________________________________________________________Function fGetTimeFrame() Dim dYear, dMonth, dDay, dToday dYear = DatePart("yyyy", Now) dMonth = DatePart("m", Now) If Len(dMonth) = 1 Then dMonth = "0" & dMonth dDay = DatePart("d", Now) If Len(dDay) = 1 Then dDay = "0" & dDay fGetTimeFrame = dYear & dMonth & dDayEnd Function'___________________________________________________________Sub sTableEntry(strSection, strMessage) Dim sRecord, iCount, sColor, iCode sMessage = sMessage & vbTab & "<tr>" & VbCrLf iCount = iCount + 1 iCode = iCount Mod 2 If iCode = 0 Then sColor = "#EEEEEE" sMessage = sMessage & vbTab & vbTab & "<td width = 40% bgcolor=" & sColor & "><p><font color=""black"" size=2>" & strSection & "</font></p></td>" & VbCrLf sMessage = sMessage & vbTab & vbTab & "<td width = 60% bgcolor=" & sColor & "><p><fon
t color=""black"" size=2>" & strMessage & "</font></p></td>" & VbCrLf Else sColor = "#EEEEEE" sMessage = sMessage & vbTab & vbTab & "<td width = 40% bgcolor=" & sColor & "><p><font color=""black"" size=2>" & strSection & "</font></p></td>" & VbCrLf sMessage = sMessage & vbTab & vbTab & "<td width = 60% bgcolor=" & sColor & "><p><font color=""black"" size=2>" & strMessage & "</font></p></td>" & VbCrLf End If sMessage = sMessage & vbTab & "</tr>" & VbCrLfEnd Sub'___________________________________________________________Sub sObjectHeader(sText) sMessage = sMessage & vbTab & "<tr>" & VbCrLf sMessage = sMessage & vbTab & vbTab & "<td width = 100% align=left colSpan=2 bgcolor=""GOLD""><p><font color=""black"">" & sText & "</font></p></td>" & VbCrLf sMessage = sMessage & vbTab & "</tr>" & VbCrLfEnd Sub'___________________________________________________________Sub sBuildHTMLHeader() sMessage = sMessage & "<html>" & vbCRLF sMessage = sMessage & "<head>" & vbCRLF sMessage = sMessage & vbTab & "<title>New Objects Today</title>" & vbCRLF sMessage = sMessage & vbTab & "<style>" & vbCRLF sMessage = sMessage & vbTab & vbTab & ".blackText { margin-left:5px;margin-right:6px;margin-top:3px;margin-bottom:3px;color:black;font-family:tahoma;font-size:10pt }" & vbCRLF sMessage = sMessage & vbTab & vbTab & ".whiteText { margin-left:5px;margin-right:6px;margin-top:3px;margin-bottom:3px;color:white;font-family:tahoma;font-size:10pt }" & vbCRLF sMessage = sMessage & vbTab & "</style>" & vbCRLF sMessage = sMessage & "</head>" & vbCRLF sMessageL = sMessage & "<body>" & vbCRLF sMessage = sMessage & vbTab & "<Table>" & vbCRLF sMessage = sMessage & vbTab & "<tr>" & VbCrLf sMessage = sMessage & vbTab & vbTab & "<td width = 100% align=center colSpan=2 bgcolor=""GOLD""><p><font color=""black""><B>NEW OBJECTS for " & FormatDateTime(now, vbShortDate) & "</B></font></p></td>" & VbCrLf sMessage = sMessage & vbTab & "</tr>" & VbCrLfEnd Sub'_______________________________________________________Sub sBuildFooter() sMessage = sMessage & vbTab & vbTab & "</table>" & vbCRLF sMessage = sMessage & vbTab & "</body>" & vbCRLF sMessage = sMessage & "</html>" & vbCRLFEnd SubFunction LowDiskSpace(strFileName, intPercent) Const LineBreak = "<br>" Dim sngPercent sngPercent = intPercent / 100 Dim objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") Dim objTS, strOutput If Not objFSO.FileExists(strFileName) Then strOutput = "File not found." Else Set objTS = objFSO.OpenTextFile(strFileName) Do Until objTS.AtEndOfStream Dim strComputer, bolFound strComputer = objTS.ReadLine bolFound = False strOutput = strOutput & LineBreak & "<table border=1 cellspacing=1 cellpadding=1 width=100%><TR><TD Class=""resultsTable"" bgcolor=""GOLD""><font color=""black"">" & strComputer & LineBreak & "</font></TD></TR></TABLE>" On Error Resume Next Dim objWMI Set objWMI = GetObject("winmgmts:" & strComputer & "rootcimv2") If Err.Number <> 0 Then strOutput = strOutput & "<fieldset><legend><font size=2><u>Error</u></font></legend> " & Err.Description & "</fieldset>" & LineBreak Err.Clear Else On Error GoTo 0 Err.Clear Dim colResults, objResult, strWMIQuery strWMIQuery = "SELECT * FROM Win32_LogicalDisk" Set colResults = objWMI.ExecQuery(strWMIQuery) For Each objResult In colResults Dim intFreeSpace, intSize, sngFreePercent Select Case objResult.DriveType Case 3 intFreeSpace = objResult.FreeSpace intSize = objResult.Size sngFreePercent = intFreeSpace / intSize If sngFreePercent < sngPercent Then strOutput = strOutput & "<fieldset bgcolor=red><legend><font size=2 color=red><u>Warning</u></font></legend><table width=100%><tr><td bgcolor=""red""> " & objResult.DeviceID & _ " has " & FormatPercent(sngFreePercent,2,True) & " free space</td></tr></table></fieldset>" & LineBreak bolFound = True End If Case 2,5 strOutput = strOutput & "<fieldset><legend><font size=2><u>drive</u></font></legend> <b>" & objResult.DeviceID & _ "</b> is removable media</fieldset>" & LineBreak End Select Next If Not bolFound Then strOutput = strOutput & "<fieldset><legend><font size=2><u>OK</u></font></legend><table width=100%><tr><td bgcolor=""green""> no drives have less than " & _ intpercent & "% free space</td></tr></table></fieldset>" & LineBreak End If End If Loop objTS.Close End If LowDiskSpace = strOutputEnd FunctionSub GetDriveSize document.all.results.innerHTML = LowDiskSpace(document.all.spacetxtFile.value, document.all.spacetxtPercent.value) document.all.ServerResults.innerHTML = "" document.all.footer.innerHTML = "****** DONE ******"End SubSub GetPrtStatus For i = (objTable.Rows.Length - 1) to 0 Step -1 myNewRow = Document.All.objTable.deleteRow(i) Next Set objRow = objTableBody.InsertRow() objRow.Style.fontWeight = "bold" Set objCell = objRow.InsertCell() objCell.InnerText = "Name" Set objCell = objRow.InsertCell() objCell.InnerText = "Location" Set objCell = objRow.InsertCell() objCell.InnerText = "Status" strComputer = "tprint02.tki.local" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!" & _ strComputer & "rootcimv2") Set colPrinters = objWMIService.ExecQuery _ ("SELECT * FROM Win32_Printer") For Each objPrinter in colPrinters Set objRow = objTableBody.InsertRow() objRow.Style.fontSize = "15" Set objCell = objRow.InsertCell() objCell.InnerText = objPrinter.Name Set objCell = objRow.InsertCell() objCell.InnerText = objPrinter.Location Set objCell = objRow.InsertCell() Select Case objPrinter.PrinterStatus Case 1 strPrinterStatus = "Other" Case 2 strPrinterStatus = "Unknown" Case 3 strPrinterStatus = "Idle" Case 4 strPrinterStatus = "Printing" Case 5 strPrinterStatus = "Warming up" End Select objCell.InnerText = strPrinterStatus Next document.all.results.innerHTML = strPrinterStatus document.all.addhost.innerHTML = "" document.all.ServerResults.innerHTML = "" document.all.footer.innerHTML = ""End SubSub Window_OnloadOn Error Resume N
extDim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")' Check for the existence of the file defined above, create if it does not exist If Not objFSO.FileExists(strFileName) Then objFSO.CreateTextFile strFileName, True End If Set objFSO = Nothing' Call Subs 'UpdateDict 'UpdateTable ' Set timer to execute the UpdateTable Sub every second defined in the intRefreshRt variable 'iTimerID = window.setInterval("UpdateTable", intRefreshRt)refresh.disabled=Truecheck_button.disabled=True'Set objDialogWindow = window.Open("about:blank","ProgressWindow","height=15,width=250,left=300,top=300,status=no,titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=no") 'objDialogWindow.Focus()'objDialogWindow.ResizeTo 250,30'objDialogWindow.document.body.style.fontFamily = "Verdana"'objDialogWindow.document.body.style.fontSize = "10pt"'objDialogWindow.document.writeln "<html><body>Retrieving Exchange server information from Active Directory.</body></html>"'objDialogWindow.document.title = "Exchange 2003 Monitor"'objDialogWindow.document.body.style.backgroundColor = "#FFFFCC"'objDialogWindow.document.body.style.borderStyle = "none"'objDialogWindow.document.body.style.marginTop = 15'Get list of Exchange servers from ADDim objRootDSEDim objConfigurationDim catDim connDim cmdDim RSSet objRootDSE = GetObject("LDAP://rootDSE")strConfiguration = "LDAP://" & objRootDSE.Get("configurationNamingContext")Set objConfiguration = GetObject(strConfiguration)'select Exchange servers but not policies which happen to share the same classstrQuery="Select distinguishedname,name from '" & _objConfiguration.ADSPath & "' Where objectclass='msExchExchangeServer'AND objectclass<>'msExchExchangeServerPolicy'"strResults=""set cat=GetObject("GC:")for each obj in cat set GC=objNextAdsPath=GC.ADSPathset conn=Createobject("ADODB.Connection")set cmd=CreateObject("ADODB.Command")conn.Provider="ADSDSOObject"conn.Open set cmd.ActiveConnection=connset RS=conn.Execute(strQuery)do while not RS.EOF strResults=strResults & rs.Fields("name")& ";" rs.movenextLooprs.Closeconn.Close 'populate drop downstrHTML ="<Select onChange=""EnableCheck()"" name=ServerPulldown>" &_ "<option value=""PulldownMessage"">- Select exchange server -" tmpNameArray=Split(strResults,";")For x=0 To UBound(tmpNameArray)-1 strHTML=strHTML & "<option value=" & Chr(34) & tmpNameArray(x) & Chr(34) &">" &_ tmpNameArray(x)Next strHTML = strHTML & "</select>"ExchangeServers.insertAdjacentHTML "beforeEnd", strHTMLobjDialogWindow.Closeself.focusSet objRootDSE=NothingSet objConfiguration=NothingSet cat=NothingSet conn=NothingSet cmd=NothingSet RS=Nothing'CenterWindow 1024,768 end SubSub CenterWindow( widthX, heightY ) self.ResizeTo widthX, heightY self.MoveTo (screen.Width - widthX)/2, (screen.Height - heightY)/2End Sub Sub UpdateTable' On Error Resume Next Dim strComputer, strHTML, strStatus ' Begin building HTML table strHTML = "<table width='100%' border='0'><tr>" & _ "<td nowrap><strong><u>Remote Host</u></strong></td>" & _ "<td nowrap><strong><u>Last Successful Ping</u></strong></td>" & _ "<td class='status' nowrap><strong><u>Status</u></strong></td></tr>" ' Loop through dictionary to get computer names and datetime of last successful ping For Each strComputer In objDict.keys strStatus = GetStatus(strComputer) If Not LCase(strStatus) = "red.jpg" Then objDict(strComputer) = Now ' Update last successful ping for the Host/Computer End If strHTML = strHTML & "<tr><td><font size=2>" & strComputer & "</font></td>" & _ "<td>" & objDict(strComputer) & "</td><td class='status'>" & _ "<img src='images/" & strStatus & "' width='20' height='20'></td></tr>" Next ' Send HTML code generated above to body section window.document.getElementById("ServerResults").innerHTML = "" window.document.getElementById("prtStatus").innerHTML = "" 'window.document.getElementById("LiveQueues").innerHTML = "" window.document.getElementById("footer").innerHTML = "" window.document.getElementById("results").innerHTML = strHTML & "</table>" window.document.getElementById("addhost").innerHTML = "<input type=""text"" id=""newhost"" onKeyPress=""if window.event.keycode = 13 then AddNewHost""> <input type=""button"" value=""Add"" onClick=""AddNewHost""<br> <a href="""" onclick=""EditList"">Edit Host List</a><hr>" End Sub Function GetStatus(strComputer)' On Error Resume Next Dim wmiQuery, objWMIService, objPing, objStatus, intReply, i intReply = 0 ' Define WMI query to ping wmiQuery = "Select * From Win32_PingStatus Where " & _ "Address = '" & strComputer & "'" ' Make WMI connection to local machine Set objWMIService = GetObject("winmgmts:.rootcimv2") ' Execute Query For i = 1 To 4 Set objPing = objWMIService.ExecQuery(wmiQuery) ' Retrieve the status code of each ping request For Each objStatus In objPing Select Case objStatus.StatusCode Case 0 intReply = intReply + 1 End Select Next Next Set objPing = Nothing Set objWMIService = Nothing ' Determine the image color depending on the number of pings successfully received Select Case True Case (intReply = 0) GetStatus = "red.jpg" Case (intReply => 3) GetStatus = "green.jpg" Case Else GetStatus = "yellow.jpg" End Select End Function Sub AddNewHost' On Error Resume Next Dim objFile, strComputer ' Get host/computer name defined in the text field strComputer = window.document.getElementById("newhost").value ' If the host/computer name is empty then do nothing If (IsNull(strComputer) Or strComputer = "" Or strComputer = " ") Then Exit Sub ' Clear the host/computer name text field window.document.getElementById("newhost").value = "" ' Check to ensure the host/computer name does not already exists If Not objDict.Exists(strComputer) Then ' Open the text file and add the new host/computer Set objFile = FileObject(ForAppending) objFile.WriteLine strComputer objFile.Close Set objFile = Nothing ' Call subs to update the information displayed UpdateDict UpdateTable End If End Sub Sub UpdateHList' On Error Resume Next Dim objFile, arrTemp, strTemp, i ' Get the host/computer names in the text area and split into an array arrTemp = Split(window.document.getElementById("txtahlist").Value, VbCrLf) ' Open text file
Set objFile = FileObject(ForWriting) ' Loop through array, writing to text file if the value is not null or blank For i = 0 To UBound(arrTemp) strTemp = arrTemp(i) If Not (IsNull(strTemp) Or strTemp = "" Or strTemp = " ") Then objFile.WriteLine strTemp End If Next objFile.Close Set objFile = Nothing ' Clear info from dictionary in case there has been deletions objDict.RemoveAll ' Refresh all the data displayed by calling the subs UpdateDict UpdateTable ' Re-state the timer that is cleared in the EditList sub iTimerID = window.setInterval("UpdateTable", intRefreshRt) End Sub Sub EditList' On Error Resume Next Dim objFile, strHTML ' Stop the time to prevent the data from refreshing while making changes to the host list window.clearInterval(iTimerID) ' Read the current host/computer names from the text file Set objFile = FileObject(ForReading) ' Output data from text file to text area to review/modify as needed strHTML = "<textarea id='txtahlist' cols='30' rows='10'>" & objFile.ReadAll & "</textarea>" & _ "<br /><br /><input type='button' value='Update List' onclick='UpdateHList'>" & _ " <input type='button' value='Cancel' onclick='UpdateTable'>" objFile.Close Set objFile = Nothing ' Write HTML to body of HTA window.document.getElementById("ServerResults").innerHTML = "" window.document.getElementById("prtStatus").innerHTML = "" window.document.getElementById("footer").innerHTML = "" window.document.getElementById("results").innerHTML = strHTML End Sub Function FileObject(strMethod)' On Error Resume Next Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject") ' Open text file using the method specified Set FileObject = objFSO.OpenTextFile(strFileName, strMethod) Set objFSO = Nothing End Function Sub UpdateDict' On Error Resume Next Dim objFile, strLine ' Open the text file to read its content Set objFile = FileObject(ForReading) ' Loop through each line adding it to the dictionary Do Until objFile.AtEndOfStream strLine = objFile.ReadLine If Not (IsNull(strLine) Or strLine = "" or strLine = " ") Then If Not objDict.Exists(strLine) Then objDict.Add strLine, "" End If End If Loop objFile.Close Set objFile = Nothing UpdateTable End SubSub CheckServer(strSrv)On Error Resume Next'connect to Exchange Server and check servicesDim objWMIdim objRefIf TestPing(strSrv) = False thenstrHTML="<Font Color=RED>Could not ping " & strSrv & ". Verify network connectivity. This tool cannot be used<br>" strHTML=strHTML & "to monitor Exchange 5.5 or Exchange 2000 servers. You must have administrative credentials on the target server.</Font><br>" footer.InnerHTML="<b>Last Updated:</b> " & Now ServerResults.innerHTML=strHTML 'Clear WMI Server information prtStatus.InnerHTML = "" results.InnerHTML = "" addhost.InnerHTML = "" 'clear current server value since we no longer have a connection currentserver.value="" 'sleep for refresh interval then run CheckServer again Interval=setTimeOut("CheckServer(serverpulldown.value)",refresh.value*1000) exit subend If'The LIKE operator requires Windows XP or 2003strQuery="Select * from Win32_service where displayname LIKE 'Microsoft Exchange%'"Set objWMI=GetObject("Winmgmts://"& strSrv)If Err.Number<>0 Then strHTML="<Font Color=RED>Could not connect to WMI on " & strSrv & ". Verify network connectivity. This tool cannot<br>" strHTML=strHTML & " be used to monitor Exchange 5.5 or Exchange 2000 servers. <br>You must have administrative credentials on the target server.</Font>" ServerResults.innerHTML=strHTML footer.InnerHTML="<b>Last Updated:</b> " & Now currentserver.value="" prtStatus.InnerHTML = "" results.InnerHTML = "" addhost.InnerHTML = "" Exit SubEnd IfSet objRef=objWMI.ExecQuery(strQuery,,48)GetExchangeInfo(strSrv)strHTML=strHTML & "<table border=1 cellpadding=5 width=100%>"strHTML=strHTML & "<TR>"strHTML=strHTML & "<TD Class=""resultsTable""><B>Service</B></TD><TD Class=""resultsTable""><B>Started</B></TD><TD Class=""resultsTable""><B>Status</B></TD><TD Class=""resultsTable""><B>State</B></TD><TD Class=""resultsTable""><B>StartMode</B></TD><TR>"For Each svc In objRef'change font color to green is service is running If svc.state="Running" Then strFont=Chr(34) & "GREEN" & Chr(34) Else strFont=Chr(34) & "RED" & Chr(34) End If strHTML=strHTML &"<TR><TD><Font face=""Verdana"" size=2>"&svc.displayname & "</TD><TD Class=""resultsTable"">" & svc.started & "</TD><TD Class=""resultsTable"">" & svc.status &_ "</TD><TD Class=""resultsTable""><Button class=""button"" onClick=""ManageService '" & strSrv & "','" & svc.Name & "'""><Font Color=" & strFont & ">" &_ svc.state & "</font></button></TD><TD Class=""resultsTable""><Button class=""button"" onClick=""ManageServiceStart '" & strSrv & "','" & svc.Name & "'"">" & svc.startmode & "</TR>"Next' Live Queues Section strPATH = "winmgmts:{impersonationLevel=impersonate}!//" & _ strSrv & "/root/cimv2/applications/exchange" Set objWMI = GetObject(strPATH) Set listExchangeLinks = objWMI.InstancesOf("ExchangeLink") For each objExchangeLink in listExchangeLinks strOldestMsg = objExchangeLink.OldestMessage If InStr(1,strOldestMsg,"00000000000000.000000+") Then ShortDate = "NA The Queue is Empty" Else shortDate = cdate(Mid(strOldestMsg, 5, 2) & "/" & _ Mid(strOldestMsg, 7, 2) & "/" & Left(strOldestMsg, 4) _ & " " & Mid (strOldestMsg, 9, 2) & ":" & _ Mid(strOldestMsg, 11, 2) & ":" & Mid(strOldestMsg, _ 13, 2)) End If miscareavalue = miscareavalue & "Queue Name: " & objexchangelink.linkname & VBCRLF & _ "Number of Messages: " & objexchangelink.numberofmessages & VBCRLF & _ "Size of Queue: " & objexchangelink.sizeofqueue & VBCRLF& _ "Oldest Message: " & shortdate & vbcrlf & VBCRLF exchange_queues.innerHTML = " ---------- Exchange Queues ----------<br><textarea rows=""8"" name=""LiveQueues"" cols=""50"">--- Select a server to run a query against ---</textarea><br><font size=2> ---------- Exchange Queues ----------</font>" LiveQueues.value = miscareavalue NextstrHTML=strHTML & "</Table></P>"footer.InnerHTML=""ServerResults.innerHTML=strHTMLprtStatus.InnerHTML = ""results.InnerHTML = ""addhost.InnerHTML = ""'sleep for refresh interval then run CheckServer againInterval=setTimeOut("CheckServer(serverpulldown.value)",refresh.value*1000)End SubSub EnableCheck()check_button.disabled=False'refresh.disabled=FalseEnd SubSub ManageServiceStart(strSrv,strService)On Error Resume Next'manage the start type of the specified serviceDim objSvcConst Boot=0Const System=1Const Automatic=2Const Manual=3Const Disabled=4strTitle="Service Management"Set objSvc=GetObject("WinNT://" & strSrv & "/" & strService & ",service")Select Case objSvc.StartType Case "0" StartDetail="Boot" Case "1" StartDetail="System" Case "2" StartDetail="Automatic" Case "3" StartDetail="Manual" Case "4" StartDetail="Disabled" Case Else StartDetail="Unknown"End Selectrc=MsgBox("The " & objSvc.Displayname & " service (" & strService & ") on " & strSrv & " currently has a start type of " & startDetail &_ ". Do you want to change it?",vbYesNo+vbQuestion,strTitle) 'only display proper choices for start modeIf rc=vbYes Then rc=InputBox("What start type do you want to set for the " & objSvc.DisplayName & " service?" & VbCrLf &_ " 2 - Automatic" & VbCrLf &_ " 3 - Manual" & VbCrLf &_ " 4 - Disabled" & VbCrLf & vbcrlf &_ "Please enter a number.",strTitle,2) If rc="" Then Exit Sub 'user cancelled If rc>4 Or rc <2 Then MsgBox "That is an invalid choice.",vboknly+vbInformation,strTitle ManageServiceStart strSrv,strService Else objSvc.StartType=rc objSvc.SetInfo If Err.Number<>0 Then MsgBox "There was an error with the service." & VbCrLf & Err.Number & " " & Err.Description,vbOKOnly+vbCritical,strTitle Else 'refresh the display after sleeping 5 seconds Sleep=setTimeout("CheckServer(serverPulldown.value)",5000) End If End If End IfEnd SubSub ManageService(strSrv,strService)On Error Resume Next'manage the specified service on the selected server.'you can stop or start or pause the serviceDim objSvcstrTitle="Service Management"Set objSvc=GetObject("WinNT://" & strSrv & "/" & strService & ",service")'if start type is disabled then notify user to change the start mode first'added 12/6/2004If objSvc.starttype=4 Then 'ManageServiceStart strSrv,strService MsgBox "The " & strService & " is disabled. You must modify the start mode first.",vbokonly+vbcritical,strTitle Exit Subend IfSelect Case objSvc.status Case "1" statusDetail="stopped" strOption="start" Case "4" statusDetail="running" strOption="stop" Case Else statusDetail="unknown" MsgBox objSvc.DisplayName & " service (" & strService & ") on " & strSrv & " is currently in an unknown state. Further investigation is warranted.",vbOKOnly+vbCritical,strTtileEnd Selectrc=MsgBox(objSvc.DisplayName & " service (" & strService & ") on " & strSrv & " is currently " & statusDetail & "." & VbCrLf &_ "Do you want to " & strOption & " the service?",vbYesNo+vbQuestion,strTitle)If rc=vbYes Then If strOption="start" Then objSvc.Start Else objSvc.Stop End If If Err.Number<>0 Then MsgBox "There was an error with the service." & VbCrLf & Err.Number & " " & Err.Description,vbOKOnly+vbCritical,strTitle Else 'refresh the display after pausing 5 seconds Sleep=setTimeout("CheckServer(serverpulldown.value)",5000) End IfElseEnd IfEnd SubFunction TestPing(sName)On Error Resume Next'this function requires Windows XP or 2003Dim cPingResults, oPingResultSet cPingResults = GetObject("winmgmts://./root/cimv2").ExecQuery("SELECT * FROM Win32_PingStatus WHERE Address = '" & sName & "'")For Each oPingResult In cPingResults If oPingResult.StatusCode = 0 Then TestPing = True Else TestPing = False End IfNextEnd FunctionSub GetExchangeInfo(strSrv)On Error Resume NextDim objWMIService, colItems'don't do anything if a server isn't selectedIf strSrv="PulldownMessage" Then Exit Sub'if a different server is selected, then get WMI server informationIf UCase(strSrv)<>UCase(currentserver.value) Then Set objWMIService = GetObject("winmgmts:" & strSrv & "rootMicrosoftExchangev2") Set colItems = objWMIService.ExecQuery("Select AdministrativeGroup,DN,ExchangeVersion,FQDN,Name,RoutingGroup from Exchange_Server where name='" & strSrv & "'",,48) For Each objItem In colItems strInfo="<Font Face=Verdana Size=1>" & objItem.FQDN & " [ & objItem.Exchangeversion & ] Administrative Group: " & objItem.AdministrativeGroup & "<Font>" Next exchange_version.InnerHTML=strInfo currentserver.value=strSrv prtStatus.InnerHTML = "" results.InnerHTML = "" addhost.InnerHTML = ""End IfEnd Sub'************ DNS CODE ************Sub DNSAuthenticate' Authenticate within WMI' ---------------------------------------------------------------' From the book "DNS on Windows Server 2003" ' By Cricket Liu, Matt Larson & Robbie Allen' Publisher: O'Reilly and Associates' ISBN: 0-596-00562-8' Book web site: http://rallenhome.com/books/dnsonw2k3/toc.html' ---------------------------------------------------------------strServer = dnssrv.valuestrUserName = dnsusr.valuestrPassword = dnspwd.value Set objLocator = CreateObject("WbemScripting.SWbemLocator")Set objDNS = objLocator.ConnectServer(strServer, "rootMicrosoftDNS", _ strUsername, strPassword) document.all.tool_info.innerHTML = "<center><u>Connected to <b>" & dnssrv.value & "</b>. Continue...</u></center><p>" document.all.Controls.innerHTML = "<input id=resetbutton class='button' type='button' value='List Zones' name='back_button' onClick='DNSGetZoneList'>"End Sub Sub DNSGetZoneList strServer = dnssrv.valuestrUserName = dnsusr.valuestrPassword = dnspwd.valuestrHTML = "<table width='100%' border='0'><tr>" & _ "<td nowrap><strong><u>Zone Name</u></strong><br><font size=3 color='#272936'>spacer text</font></td>" & _ "<td nowrap></td>" & _ "<td class='status' nowrap></td></tr>"Set objLocator = CreateObject("WbemScripting.SWbemLocator")Set objDNS = objLocator.ConnectServer(strServer, "rootMicrosoftDNS", _ strUsername, strPassword)set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")set objZones = objDNS.ExecQuery("Select * from MicrosoftDNS_Zone " & _ "Where DnsServerName = '" & _ objDNSServer.Name & "'") for each objZone in objZonesstrHTML = strHTML & "<tr>" & _ "<td><u><strong><span id=zone>" & objZone.name & "</span></strong></td>"strZoneConf = objZone.namestrHTML = strHTML & "<td>" & _ "<input id='dnszone' class='text' type='hidden' value='" & strZoneConf & "' name='back_button' size=11> <input id=zone_button class='button' type='
button' value='Get Configuration' name='zone_button' onClick='DNSGetZoneConfig(strZoneConf)'></u></td></tr>" document.all.results.innerHTML = strHTML & "</table>"msgbox tVariablenext End SubSub DNSGetZoneConfig(strZoneConf)' Configure a zone' ---------------------------------------------------------------' From the book "DNS on Windows Server 2003" ' By Cricket Liu, Matt Larson & Robbie Allen' Publisher: O'Reilly and Associates' ISBN: 0-596-00562-8' Book web site: http://rallenhome.com/books/dnsonw2k3/toc.html' ---------------------------------------------------------------on error resume next'msgbox strZoneConfstrZone = strZoneConf'msgbox strZonestrServer = dnssrv.valuestrUserName = dnsusr.valuestrPassword = dnspwd.value'msgbox strZone'msgbox strServer'msgbox strUserName'msgbox strPasswordstrHTML = "<table width='100%' border='0'><tr>" & _ "<td nowrap><strong><u>Zone Name</u></strong></td>" & _ "<td nowrap>Property</td>" & _ "<td class='status' nowrap>Value</td></tr>" Set objLocator = CreateObject("WbemScripting.SWbemLocator")Set objDNS = objLocator.ConnectServer(strServer, "rootMicrosoftDNS", _ strUsername, strPassword)set objDNS = GetObject("winMgmts:" & strServer & "rootMicrosoftDNS")set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")set objDNSZone = objDNS.Get("MicrosoftDNS_Zone.ContainerName=""" & strZone & _ """,DnsServerName=""" & objDNSServer.Name & _ """,Name=""" & strZone & """")' List all of the properties of the zone'results.innerHTML = "<u>Configuration for " & objDNSZone.Name & "</u><p>"for each objProp in objDNSZone.Properties_ if IsNull(objProp.Value) then strHTML = strHTML & " " & objProp.Name & " : NULL" 'msgbox strHTML & "Property Value NULL" else if objProp.IsArray = TRUE then For I = LBound(objProp.Value) to UBound(objProp.Value) strHTML = strHTML & " " & objProp.Name & " : " & objProp.Value(I) 'msgbox strHTML & "Property Value Success" next else strHTML = strHTML & " " & objProp.Name & " : " & objProp.Value 'msgbox strHTML & "Property Value Success2" end if end if next' Modify the zone'objDNSZone.AllowUpdate = 1'objDNSZone.Put_'WScript.Echo ""if Err then strHTML = strHTML & "Error occurred: " & Err.Descriptionelse strHTML - strHTML & "Complete"end ifresults.innerHTML = strHTML & "</table>"End Sub'************ DNS CODE ************Sub Page1()document.all.t1.innerHTML = "<fieldset><legend><font size=3 color=""black""><b>HDD Monitor</b></font></legend> <input type=""hidden"" id=""spacetxtFile"" size=""11"" value=""servers.txt""><input type=""hidden"" id=""spacetxtPercent"" size=""3"" value=""5""><center><input type=""submit"" onclick=""GetDriveSize"" value=""Show Drive Status""></center><font color=""#EEEEEE"">spacing text</font></fieldset>"document.all.t2.innerHTML = "<fieldset><legend><font size=3 color=""black""><b>PRT Monitor</b></font></legend><br><center><input type=""submit"" onclick=""GetPrtStatus""
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Get <span> values from array

Post by jhicks »

Is the problem the DNS information or passing getting any information to be displayed in the HTA? I encourage you to break this down into more manageable pieces. I do this all the time. If I'm trying to get something to work in an HTA, I write a simple stripped down HTA that just has the pieces I need. For the script pieces, I write and test the functionality as a standalone VBS script. Once I know that works, then I integrate it into the HTA. If you can come up with a simpler HTA that focuses on the functionality you're trying to achieve, we'll be in a better position to help.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Get <span> values from array

Post by jvierra »

As Jeff suggests - I suggest also - take just this piece of code and get it to work or fail.

for each objZone in objZones
strHTML = strHTML & "<tr><td><a href='" & objZone.name & "'>" & objZone.Name & "</a></td></tr>"
strZoneConf = objZone.name
strHTML = strHTML & "<td>" & _"<input id='dnszone' class='text' type='hidden' value='" & strZoneConf & "' name='back_button' size=11> <input id=zone_button class='button' type='button' value='Get Configuration' name='zone_button' onClick='DNSGetZoneConfig(strZoneConf)'></u></td></tr>"

document.all.results.innerHTML = strHTML & "</table>"

Use a sub with only this and create the strings str = "MyString" & i

Put i in the loop to generate N items. Use only a simple HTML form. Get the built HTML to work first.
User avatar
cybersnac
Posts: 6
Last visit: Sun Jun 24, 2007 10:15 pm

Get <span> values from array

Post by cybersnac »

OK. Here is a basic .hta that works to get the list, which was working in my previous code as well, btw :)<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>.:|Scripted Tools|:.</title><script language="vbscript">Sub DNSGetZoneListstrServer = "tkdc1"strUsername = "wtsmith"strPassword = "********"strHTML = "<table width='100%' border='0'><tr>" & _ "<td nowrap><strong><u>Zone Name</u></strong><br><font size=3 color='#272936'>spacer text</font></td>" & _ "<td nowrap></td>" & _ "<td class='status' nowrap></td></tr>"Set objLocator = CreateObject("WbemScripting.SWbemLocator")Set objDNS = objLocator.ConnectServer(strServer, "rootMicrosoftDNS", _ strUsername, strPassword)set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")set objZones = objDNS.ExecQuery("Select * from MicrosoftDNS_Zone " & _ "Where DnsServerName = '" & _ objDNSServer.Name & "'") for each objZone in objZonesstrHTML = strHTML & "<tr>" & _ "<td><u><strong><span id=zone>" & objZone.name & "</span></strong></td>"strZoneConf = objZone.namestrHTML = strHTML & "<td>" & _ "<input id='dnszone' class='text' type='hidden' value='" & strZoneConf & "' name='back_button' size=11> <input id=zone_button class='button' type='button' value='Get Configuration' name='zone_button' onClick='DNSGetZoneConfig(strZoneConf)'></u></td></tr>" document.all.results.innerHTML = strHTML & "</table>"strTest = strZoneConf & iNextEnd Sub</script><hta:application applicationname="MyHTA" border="normal" borderstyle="normal" caption="Scripted Tools" contextmenu="no" icon="myicon.ico" maximizebutton="yes" minimizebutton="yes" navigable="no" scroll="yes" selection="no" showintaskbar="yes" singleinstance="yes" sysmenu="yes" version="1.0" windowstate="maximize"></head><body><form><table><tr><td><input id=submitbutton class="button" type="button" value="Run" name="submit_button" onClick="DNSGetZoneList"><hr><span id=results></span></td></tr></table></form></body></html>The issue is that I can't get the variable from the code above:onClick='DNSGetZoneConfig(strZoneConf) to pass to the next sub which would get the zone configuration info. That sub looks like this:-----------------------------------------------------------------------Sub DNSGetZoneConfig(strZoneConf)' Configure a zone' ---------------------------------------------------------------' From the book "DNS on Windows Server 2003" ' By Cricket Liu, Matt Larson & Robbie Allen' Publisher: O'Reilly and Associates' ISBN: 0-596-00562-8' Book web site: http://rallenhome.com/books/dnsonw2k3/toc.html' ---------------------------------------------------------------on error resume next'msgbox strZoneConfstrZone = strZoneConf'msgbox strZonestrServer = dnssrv.valuestrUserName = dnsusr.valuestrPassword = dnspwd.value'msgbox strZone'msgbox strServer'msgbox strUserName'msgbox strPasswordstrHTML = "<table width='100%' border='0'><tr>" & _ "<td nowrap><strong><u>Zone Name</u></strong></td>" & _ "<td nowrap>Property</td>" & _ "<td class='status' nowrap>Value</td></tr>" Set objLocator = CreateObject("WbemScripting.SWbemLocator")Set objDNS = objLocator.ConnectServer(strServer, "rootMicrosoftDNS", _ strUsername, strPassword)set objDNS = GetObject("winMgmts:" & strServer & "rootMicrosoftDNS")set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")set objDNSZone = objDNS.Get("MicrosoftDNS_Zone.ContainerName=""" & strZone & _ """,DnsServerName=""" & objDNSServer.Name & _ """,Name=""" & strZone & """")' List all of the properties of the zone'results.innerHTML = "<u>Configuration for " & objDNSZone.Name & "</u><p>"for each objProp in objDNSZone.Properties_ if IsNull(objProp.Value) then strHTML = strHTML & " " & objProp.Name & " : NULL" 'msgbox strHTML & "Property Value NULL" else if objProp.IsArray = TRUE then For I = LBound(objProp.Value) to UBound(objProp.Value) strHTML = strHTML & " " & objProp.Name & " : " & objProp.Value(I) 'msgbox strHTML & "Property Value Success" next else strHTML = strHTML & " " & objProp.Name & " : " & objProp.Value 'msgbox strHTML & "Property Value Success2" end if end if next' Modify the zone'objDNSZone.AllowUpdate = 1'objDNSZone.Put_'WScript.Echo ""if Err then strHTML = strHTML & "Error occurred: " & Err.Descriptionelse strHTML - strHTML & "Complete"end ifresults.innerHTML = strHTML & "</table>"End Sub--------------------------------------------My apologies, I forgot to include the code strTest = strZoneConf & iwhich is now in place accordingly. Still not working though. The response I get is this:Error occured: Object not a collection.So the error part of this code works fine at least :) I'm getting this error I believe because the variable still isn't passing to the next sub.
cybersnac2007-06-20 12:38:34
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Get <span> values from array

Post by jvierra »

Here is a quick example of "decoupling

It is not working code but illustrates how to approach doing this. It willhelp you eliminate errors as yu can just dummy up values to get the HTML working and test teh functionaly code from the commandline or with a debugger.

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    
<script language="vbscript">
<!--
     ' decoupled DNS getter code which can easily be tested from commandline
     '  since it has not HTML references
     '  this returns the string values as an array can easily be multdimensional for more then one field
     Function DNSGetZoneList(strServer,strUserName,strPassword, strDNSServerName)
          Set objLocator = CreateObject("WbemScripting.SWbemLocator")
          Set objDNS = objLocator.ConnectServer(strServer, "rootMicrosoftDNS", strUsername, strPassword)
          set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
          set objZones = objDNS.ExecQuery("Select * from MicrosoftDNS_Zone Where DnsServerName = '" & strDNSServerName & "'") 
          i = 0
          for each objZone in objZones
               Redim Preserve aServers(i)
               aServers(i) = objZone.Name
               i = i + 1
          next
          
          DNSGetZoneList =  aServers      
                                        
     End Sub
     
     Sub DNSDisplayGetZoneList()
          
          ' get array of info
          aServers = DNSGetZoneList (dnssrv.value,dnsusr.value,dnspwd.value, strDNSServerName)
          
          ' build table opening tag and headers
          strHTML = "<table class'mytable'><th>" & _
                  "<td>Zone Name</u></td>" & _
                  "<td>Zone ???</td></th>"
                  
          for each i = 0 to UBound(aServers)
               
               'open the row
               strHTML = strHTML & "<tr>"
               ' add a column
               strHTML = strHTML & "<td><a href='" &  aServers(i) & "'>" & aServers(i) & "</a></td>"
               ' add second column
               strHTML = strHTML & "<td><input id=zone_button type='button' value='Get Configuration' onClick='DNSGetZoneConfig(" & aServers(i)& ")'></td>"
               'close row
               strHTML = strHTML & "</tr>"
          next
          
          mydiv.innerHTML = strHTML & "</table>"
     End Sub
-->
</script>
</head>
<body>
</body>
</html>
User avatar
cybersnac
Posts: 6
Last visit: Sun Jun 24, 2007 10:15 pm

Get <span> values from array

Post by cybersnac »

I'm so completely lost with this.Let me re-state this and see if I asked the question the wrong way earlier, or if I even understand it. I've got this code:set objZones = objDNS.ExecQuery("Select * from MicrosoftDNS_Zone " & _ "Where DnsServerName = '" & _ objDNSServer.Name & "'") for each objZone in objZonesstrZoneConf = objZone.nameWhich sets a variable objZones to a list of zone names on the DNS server and then assigns the variable strZoneConf to the name property of the zones in the variable objZonesAm I correct? What I'm trying to do is output a list of the zones to a <span> with an html button next to the zone names that will trigger a sub routine that in turn executes more code, using the zone name for the button I've clicked.I've tried to hack this up and figure this out, but I don't think I'm looking at this the right way.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Get <span> values from array

Post by jvierra »

Had some time to kll so I made the demo work your way.

Here is a working sample that will query and DNS server in the domain and return a list of zones.

Click on the zone and it will call a sub and the sub will tell you what you clicked. All of this takes one line of code: "window.event.srcElement.innerHTML" which is displayed in a MsgBox so you can see that the correct value is being returned. This is all done without creating allof the extra control elements but accomplishes the same thing.

I also moved all formatting into a simple style sheet to demonsrate how to and show that it simplifies the code building.

The following des exactly what you were trying to do in your code and, mostly, in teh way you were trying to do it.

Code: Select all



    Untitled Page
    




table
{
     border-right: thin solid;
     border-top: thin solid;
     border-left: thin solid;
     border-bottom: thin solid;
}
td
{
     border-right: thin solid;
     border-top: thin solid;
     border-left: thin solid;
     border-bottom: thin solid;
}
thead
{
     font-weight: bold;
     background-color: aqua;
     text-align: center;
}
tbody
{
     color: blue;
     text-align: left;
     text-decoration: underline;
     cursor: hand;
}
   
     



     
     DNS Server:  
     
        UserName:
     
         Password:
     
     

User avatar
cybersnac
Posts: 6
Last visit: Sun Jun 24, 2007 10:15 pm

Get <span> values from array

Post by cybersnac »

I see what you're saying about decoupling. It makes it alot easier to test when the core functions of the code do not mix with generating any HTML.As far as how you did the array and assigned it, very nice. It is apparent that I have alot more to learn, because I have never seen the Redim and Preserve options used before. But then, that's why I came to these boards for help. You guys are great.Thanks again for the guidance and education.I will look up the Redim and Preserve options to see exactly what they do.On another note, that has nothing to do with this topic, I'm going to be making a trip to my local bookstore and am interested in bringing myself up to speed on Windows PowerShell scripting. I'm looking at a banner add for the book "Windows Powershell: TFM" at the top of the page. Does anyone here know, would this be a good book to start with for someone that has very basic understanding of VBScript or should I look for something else?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Get <span> values from array

Post by jvierra »

PowerShell TFM is, in my opinion, an excelent book to start with. It is written for both vbscrters and for those new to scripting. Don and Jeff leave little to be assumed in their overview of PowerShell as an admin scripting environment.

Idelly when using HTML for anythng more than a basic HTA project it is actually much bettr to generate the HTML objeccts via DHTML methods. This allows for a much more fine grained level of control. This, however, is a fairly advanced topic and would probably be too much for any but the more experienced scripters.

ou attempt at this application is very good. YO have managed to get most things into the mix hre. Take Jeff's advise and break it up into smaller applications at least until you get all of the pieces working.
This topic is 16 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked