help with script

Reply

Join Date: Jul 2007
Posts: 276
Reputation: rapture has a spectacular aura about rapture has a spectacular aura about 
Solved Threads: 37
rapture rapture is offline Offline
Posting Whiz in Training

help with script

 
0
  #1
Jan 26th, 2009
Not sure if this is the right place or not, I'm trying to create a script to learn scripting better before editing the login script at work. I'm getting an error while trying to run this piece, can anyone tell me what's missing?

it's supposed to check running processes and information on my local machine
<SCRIPT LANGUAGE = "VBScript">
Sub window_onLoad
 iTimerID = window.setInterval("GetInfo", 10000, "VBScript")
End Sub
Sub GetInfo
 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 = "Process ID"
 Set objCell = objRow.InsertCell()
 objCell.InnerText = "Process Name"
 Set objCell = objRow.InsertCell()
 objCell.InnerText = "Working Set Size"
 strComputer = "ecancel2"
 Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 Set colProcesses = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_Process")
 For Each strProcess in colProcesses
 Set objRow = objTableBody.InsertRow()
 Set objCell = objRow.InsertCell()
 objCell.InnerText = strProcess.ProcessID
 Set objCell = objRow.InsertCell()
 objCell.InnerText = strProcess.Name
 Set objCell = objRow.InsertCell()
 objCell.InnerText = FormatNumber(strProcess.WorkingSetSize,0,,,-1)
 Next
End Sub
</SCRIPT>
<TABLE ID = "objTable">
<TBODY ID = "objTableBody">
</TBODY>
</TABLE>

the error is line 1, char 1 expected statement, code 800a0400 source is Microsoft VBScript compilation error

if I take out first line it moves towards the end and get the same error
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC