Published on January 10, 2004 By digital_trucker In Stardock Software
I've got two differently named objects. One is a clock with a second hand whose position is updated by a timed event. The other is a gauge with a pointer whose position is updated by a timed event. The timers have different names. When the gauge script is active the clock's hand 'stutters'. if I disable the gauge script, the clock hand works fine.

The following is the clock hand script:

'Called when the script is executed
Sub Object_OnScriptEnter
object.SetTimer 3333,1000
End Sub
Sub Object_OnTimer3333
Object.Rotation = Second(Now)*6
End Sub
'Called when the script is terminated
Sub Object_OnScriptExit

End Sub


The following is the gauge pointer script:

'Called when the script is executed
Sub Object_OnScriptEnter
Object.SetTimer 10, 100
Dim CPULoad
Dim NeedleDestination
End Sub

Sub Object_OnTimer10
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select LoadPercentage from Win32_Processor",,48)
For Each objItem In colItems
CPULoad = objItem.LoadPercentage
Next
NeedleDestination = 235+(CPULoad*2.5)
Object.Rotation = NeedleDestination
End Sub

'Called when the script is terminated
Sub Object_OnScriptExit
Object.KillTimer 10
End Sub


Why do they interfere with each other?


Comments
on Jan 11, 2004
btw, why were the docs located at the link below locked up? They were very handy in help me to learn how to script DX doodads.

https://www.stardock.com/products/desktopx/docs/
on Jan 11, 2004
go here for the documentation, that page probably just got moved: https://www.stardock.com/products/desktopx/development.html

as for your problem I looked at this a while earlier in the evening and didn't see anything wrong with the script. the only discrepancy was that one object had a kill timer in the exit sub and the other doesn't, but I can't see how that would affect anything. I am sure others have read this and have no idea what's wrong, just like me.
on Jan 11, 2004
That link does the same thing as the link I posted above.
on Jan 11, 2004
Well, after much testing, I've determined that it's nothing to do with the timer. I rewrote the gauge code to eliminate the timer, and it still has that effect on the clock hand.
on Jan 11, 2004
my link is good I just tried it again. and I still have no idea what's wrong. its probably a bug or complexity within desktopx.
on Jan 11, 2004
Your link doesn't go to the same place. If you look at the links on that page of yours, there are links shown to where I wanted to go...and they do the same thing.

As far as the code, I've come to the conclusion that the problem is simply that VBScript is too slow to handle this kind of operation smoothly. Looks like I'm going to have to learn to code dll's to do what I want to do. Any tips on where to start to learn how to code dll's?