Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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

12 Sep 2012   #1
FuturDreamz

Windows 8 Pro (32-bit)
 
 
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




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Visual Basic Script Change
Someone who knows Visual Basic Scripting, help me with a script that was handed to me, but it's not complete and can use a few adjustments to it. The script is a little advanced, just a forewarning :)
Software
Blue Calendar gadget doesn't work
I tried everything but unfortunately I can't get this calendar gadget to work :cry: Any idea? Blue Microsoft Calendar Gadget by ~rapha2 on deviantART Thanks a lot
Gadgets
Uninstalling Microsoft Visual C++ 2005-2008-2010 doesn't work
So I'm trying to uninstall/reinstall Microsoft Visual C++ 2005-2008-2010 but a window pops up saying "The feature you are trying to use is on a network resource that is unavailable." "Click OK to try again, or enter an alternate path to a folder containing the installation package 'vcredist' in the...
Software
network meter gadget doesn't work!
hi see the picture! my nework adaptor card not shown on gadgets!:( but my connection to internet is ok I tried this(http://www.sevenforums.com/tutorials/140358-gadgets-not-displaying-correctly-windows-7-fix.html) but didn't help me
Gadgets
"View" button in Slide Show Gadget doesn't work
I've noticed in all builds of Windows 7 that the "View" button of the Slide Show Gadget doesn't work. It should open the displayed picture, but it does nothing. Anybody experiencing the same? Regards!
Gadgets
Will Visual Basic.net 2008 work on Windows 7
Hi guys I just have a quick question. Will VB.net 2008 work on Windows 7? Im sure it will but just want to be sure. :) RJ
Software


Our Sites

Site Links

About Us

Find Us

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

All times are GMT -5. The time now is 17:42.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App