Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Process monitor macro needed



several things going on. I have a macro that inserts date and a running
clock into cells A1 and A3 respectively. Looking to get code to insert
into this auto open macro so it just runs always... like the clock does.

want to get CPU time/CPU Usage of a certain process (test.exe for
example) and place that number (whole number as a percentage of 100)
into cell B2.

someone suggested to look at a french site for help,
So I looked here
http://www.vbfrance.com/codes/CLASSE...ATION-CPU-PROC
ESSUS_42392.aspx

Then I right clicked on the "cls"
and saw this
http://files.codes-sources.com/fichi...cessCPU%5cclsP
rocessCpuUsage.cls

but since I am DEAD flat novice at this (the auto open macro was found
on the net....not my invention), i am at a loss as how to accomplish the
task in VBA. i am not a programmer at all, dont know squat about it.

at most I record macros...not create them...

please help? Thank you so much


also to look at help I have gotten but didnt work....please look here
http://www.xtremevbtalk.com/showthread.php?p=1273191
Nothing will compile or produces no results


here is my Auto open macro:::::::::::

Dim SchedRecalc As Date
Sub Auto_open()
Dim wbk As Workbook
Dim ws As Worksheet

Set wbk = ThisWorkbook
Set ws = wbk.Sheets("Sheet1")

ws.Range("a1").Value = Format(Now, "dd-mmm-yy")
ws.Range("a3").Value = Format(Time, "hh:mm:ss AM/PM")

Call SetTime
End Sub

Sub SetTime()
SchedRecalc = Now + TimeValue("00:00:01")
Application.OnTime SchedRecalc, "Auto_open"
End Sub

Sub Disable()
On Error Resume Next
Application.OnTime EarliestTime:=SchedRecalc, Procedu="Auto_open",
Schedule:=False
End Sub



*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Process monitor macro needed

The c ode worked as is except the name range wasn't working for me until I
removed the space in "whatever cell". I also added an offset so all the data
didn't appear in one cell.


Sub test()


Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_PerfFormattedData_PerfProc_Process", , 48)

For Each objItem In colItems
Range("whatever_cell").Offset(0, 0).Value =
"-----------------------------------"
Range("whatever_cell").Offset(1, 0).Value =
"Win32_PerfFormattedData_PerfProc_Process instance"
Range("whatever_cell").Offset(2, 0).Value =
"-----------------------------------"
Range("whatever_cell").Offset(3, 0).Value = "Caption: " & objItem.Caption
Range("whatever_cell").Offset(4, 0).Value = "CreatingProcessID: " &
objItem.CreatingProcessID
Range("whatever_cell").Offset(5, 0).Value = "Description: " &
objItem.Description
Range("whatever_cell").Offset(6, 0).Value = "ElapsedTime: " &
objItem.ElapsedTime
Range("whatever_cell").Offset(7, 0).Value = "Frequency_Object: " &
objItem.Frequency_Object
Range("whatever_cell").Offset(8, 0).Value = "Frequency_PerfTime: " &
objItem.Frequency_PerfTime
Range("whatever_cell").Offset(9, 0).Value = "Frequency_Sys100NS: " &
objItem.Frequency_Sys100NS
Range("whatever_cell").Offset(10, 0).Value = "HandleCount: " &
objItem.HandleCount
Range("whatever_cell").Offset(11, 0).Value = "IDProcess: " &
objItem.IDProcess
Range("whatever_cell").Offset(12, 0).Value = "IODataBytesPersec: " &
objItem.IODataBytesPersec
Range("whatever_cell").Offset(13, 0).Value = "IODataOperationsPersec: "
& objItem.IODataOperationsPersec
Range("whatever_cell").Offset(14, 0).Value = "IOOtherBytesPersec: " &
objItem.IOOtherBytesPersec
Range("whatever_cell").Offset(15, 0).Value = "IOOtherOperationsPersec: "
& objItem.IOOtherOperationsPersec
Range("whatever_cell").Offset(16, 0).Value = "IOReadBytesPersec: " &
objItem.IOReadBytesPersec
Range("whatever_cell").Offset(17, 0).Value = "IOReadOperationsPersec: "
& objItem.IOReadOperationsPersec
Range("whatever_cell").Offset(18, 0).Value = "IOWriteBytesPersec: " &
objItem.IOWriteBytesPersec
Range("whatever_cell").Offset(19, 0).Value = "IOWriteOperationsPersec: "
& objItem.IOWriteOperationsPersec
Range("whatever_cell").Offset(20, 0).Value = "Name: " & objItem.Name
Range("whatever_cell").Offset(21, 0).Value = "PageFaultsPersec: " &
objItem.PageFaultsPersec
Range("whatever_cell").Offset(22, 0).Value = "PageFileBytes: " &
objItem.PageFileBytes
Range("whatever_cell").Offset(23, 0).Value = "PageFileBytesPeak: " &
objItem.PageFileBytesPeak
Range("whatever_cell").Offset(24, 0).Value = "PercentPrivilegedTime: " &
objItem.PercentPrivilegedTime
Range("whatever_cell").Offset(25, 0).Value = "PercentProcessorTime: " &
objItem.PercentProcessorTime
Range("whatever_cell").Offset(26, 0).Value = "PercentUserTime: " &
objItem.PercentUserTime
Range("whatever_cell").Offset(27, 0).Value = "PoolNonpagedBytes: " &
objItem.PoolNonpagedBytes
Range("whatever_cell").Offset(28, 0).Value = "PoolPagedBytes: " &
objItem.PoolPagedBytes
Range("whatever_cell").Offset(29, 0).Value = "PriorityBase: " &
objItem.PriorityBase
Range("whatever_cell").Offset(30, 0).Value = "PrivateBytes: " &
objItem.PrivateBytes
Range("whatever_cell").Offset(31, 0).Value = "ThreadCount: " &
objItem.ThreadCount
Range("whatever_cell").Offset(32, 0).Value = "Timestamp_Object: " &
objItem.Timestamp_Object
Range("whatever_cell").Offset(33, 0).Value = "Timestamp_PerfTime: " &
objItem.Timestamp_PerfTime
Range("whatever_cell").Offset(34, 0).Value = "Timestamp_Sys100NS: " &
objItem.Timestamp_Sys100NS
Range("whatever_cell").Offset(35, 0).Value = "VirtualBytes: " &
objItem.VirtualBytes
Range("whatever_cell").Offset(36, 0).Value = "VirtualBytesPeak: " &
objItem.VirtualBytesPeak
Range("whatever_cell").Offset(37, 0).Value = "WorkingSet: " &
objItem.WorkingSet
Range("whatever_cell").Offset(38, 0).Value = "WorkingSetPeak: " &
objItem.WorkingSetPeak
Next
End Sub


"Mark Creager" wrote:



several things going on. I have a macro that inserts date and a running
clock into cells A1 and A3 respectively. Looking to get code to insert
into this auto open macro so it just runs always... like the clock does.

want to get CPU time/CPU Usage of a certain process (test.exe for
example) and place that number (whole number as a percentage of 100)
into cell B2.

someone suggested to look at a french site for help,
So I looked here
http://www.vbfrance.com/codes/CLASSE...ATION-CPU-PROC
ESSUS_42392.aspx

Then I right clicked on the "cls"
and saw this
http://files.codes-sources.com/fichi...cessCPU%5cclsP
rocessCpuUsage.cls

but since I am DEAD flat novice at this (the auto open macro was found
on the net....not my invention), i am at a loss as how to accomplish the
task in VBA. i am not a programmer at all, dont know squat about it.

at most I record macros...not create them...

please help? Thank you so much


also to look at help I have gotten but didnt work....please look here
http://www.xtremevbtalk.com/showthread.php?p=1273191
Nothing will compile or produces no results


here is my Auto open macro:::::::::::

Dim SchedRecalc As Date
Sub Auto_open()
Dim wbk As Workbook
Dim ws As Worksheet

Set wbk = ThisWorkbook
Set ws = wbk.Sheets("Sheet1")

ws.Range("a1").Value = Format(Now, "dd-mmm-yy")
ws.Range("a3").Value = Format(Time, "hh:mm:ss AM/PM")

Call SetTime
End Sub

Sub SetTime()
SchedRecalc = Now + TimeValue("00:00:01")
Application.OnTime SchedRecalc, "Auto_open"
End Sub

Sub Disable()
On Error Resume Next
Application.OnTime EarliestTime:=SchedRecalc, Procedu="Auto_open",
Schedule:=False
End Sub



*** Sent via Developersdex http://www.developersdex.com ***

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide Macro Process Brian Morrison[_2_] Excel Programming 1 October 31st 05 07:58 PM
Urgent Help needed - I need to stop a process that is running forever in Excel shadestreet Excel Discussion (Misc queries) 2 October 6th 05 09:59 PM
How to count process running time ( process not finished) miao jie Excel Programming 0 January 13th 05 09:23 AM
How to count process running time ( process not finished) miao jie Excel Programming 2 January 12th 05 06:01 AM
Run a macro batch process marijo[_8_] Excel Programming 2 June 2nd 04 02:46 AM


All times are GMT +1. The time now is 01:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"