Windows 7 Forums


Windows 7: Visual basic script doesn't work in gadget

12 Sep 2012   #1

Windows 7 Home Premium 32-bit (upgrade)
Lethbridge, AB
 
 
Visual basic script doesn't work in gadget

Yes I know we shouldn't be using gadgets, but I simply don't care.

I've been using Computer Status (Computer Status Gadget v3.5 by ~drakesteele on deviantART) for the longest time, and all versions have this annoying bug where the uptime part doesn't work, where immediately after booting up it says -68 (negative) days or so and counts down from that day. It seems to work fine on other people's computers, but it doesn't work on my desktop or laptop. I've tried running sidebar in 32 bit mode and installing the latest version of .NET, and nothing seems to help. I'm assuming that I don't have something installed that the gadget relies on.



This is the code itself that I'm assuming the problem is in:
Code:
Function GetUpdateInterval
	UpdateInterval = 1
	System.Gadget.Settings.write "UpdateInterval", UpdateInterval
	GetUpdateInterval = UpdateInterval * 1000
End Function

Sub uptime

	Set objLocator = CreateObject("WbemScripting.SWbemLocator")
	Set objWMIService = objLocator.ConnectServer(MachineName, "root\cimv2")
	Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
		 
		For Each objOS in colOperatingSystems

			dtmBootup = objOS.LastBootUpTime
			dtmLastBootupTime = WMIDateStringToDate(dtmBootup)
			dtmSystemUptimeSecs = DateDiff("s", dtmLastBootUpTime, Now)


			intSecsTotal     = dtmSystemUptimeSecs
			intDays           = Fix( intSecsTotal / 86400 )
			intSecsRemaining = ( intSecsTotal - ( intDays * 86400 ))
			intSecsTotal     = intSecsRemaining
			intHours         = Fix( intSecsTotal / 3600 )
			intSecsTotal    = ( intSecsTotal - ( intHours * 3600 ))
			intMinutes      = Fix( intSecsTotal / 60 )
			intSecsTotal    = ( intSecsTotal - ( intMinutes * 60 ))
			intSeconds      = Fix( intSecsTotal )
		 
			//uptimeTxt.innerText = intDays & " days " & intHours & " hours " & intMinutes & " minutes"
			uptimeTxt.innerText = intDays & "D " & intHours & "H " & intMinutes & "M " & intSeconds & "S "
			setTimeout "uptime()", GetUpdateInterval()
		Next
				
End Sub


Function WMIDateStringToDate(dtmBootup)
	
	WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) & "/" & _
	Mid(dtmBootup, 7, 2) & "/" & Left(dtmBootup, 4) _
	& " " & Mid (dtmBootup, 9, 2) & ":" & _
	Mid(dtmBootup, 11, 2) & ":" & Mid(dtmBootup,13, 2))

End Function
My System SpecsSystem Spec

Reply

 Visual basic script doesn't work in gadget problems?



Thread Tools



Similar help and support threads for: Visual basic script doesn't work in gadget
Thread Forum
Blue Calendar gadget doesn't work Gadgets
Uninstalling Microsoft Visual C++ 2005-2008-2010 doesn't work Software
network meter gadget doesn't work! Gadgets
"View" button in Slide Show Gadget doesn't work Gadgets
Will Visual Basic.net 2008 work on Windows 7 Software


All times are GMT -5. The time now is 01:57 AM.


Seven Forums Android App Seven Forums IOS App Follow us on Facebook

Windows 7 Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32