Zabaware Support Forums

Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: sybershot on March 01, 2010, 09:06:37 pm

Title: Hal pc control
Post by: sybershot on March 01, 2010, 09:06:37 pm
I would like to explore the possibilities of being able to control your pc via voice through the use of Hal, is it possible? If so Could anyone point me in the right direction. Here are a few things I would like to be able to do. Could a plug-in work for any one of these?

1: control system volume
2: control a program like winamp, to (stop, pause, play, next, close, etc.)
3: shut down system
4: restart system
5: on demand go to a specified web address, is a plug-in made for this already? I thought I might have seen one a while back but can't seem to find it.
6: give stats on our system, like cpu usage, memory usage, and maybe upload and download speeds.  

most of these can be done using Microsoft speech, but I think it would be great if we could do all these within our Hals.
Title: Hal pc control
Post by: onthecuttingedge2005 on March 02, 2010, 12:42:39 pm
quote:
Originally posted by sybershot

I would like to explore the possibilities of being able to control your pc via voice through the use of Hal, is it possible? If so Could anyone point me in the right direction. Here are a few things I would like to be able to do. Could a plug-in work for any one of these?

1: control system volume
2: control a program like winamp, to (stop, pause, play, next, close, etc.)
3: shut down system
4: restart system
5: on demand go to a specified web address, is a plug-in made for this already? I thought I might have seen one a while back but can't seem to find it.
6: give stats on our system, like cpu usage, memory usage, and maybe upload and download speeds.  

most of these can be done using Microsoft speech, but I think it would be great if we could do all these within our Hals.



Hi sybershot.

UPDATED: TUESDAY, MARCH 2 2010, 12:04PM

I wrote this script for HAL that gives CPU usage percent and hard disk free space info. I tried to get it to function in a plugin but it doesn't seem to function as a plugin.

but it does work when directly placed into the HAL brain which is kind of weird but at least it works.

you'll have to place the script into the Hal Brain directly below this area: Rem PLUGIN: POST-PROCESS

here is the code:
Code: [Select]
'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."

'THIS WILL GET CPU USAGE INFORMATION
If InStr(1, InputString, "processor usage", 1) > 0 Or InStr(1, InputString, "processor time", 1) > 0 Or _
InStr(1, InputString, "cpu time", 1) > 0 Or InStr(1, InputString, "cpu usage", 1) > 0 Then
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'")
For Each objItem In colItems
UltraHal = " Processor usage is " & objItem.PercentProcessorTime & "  %"
Next
End If

'THIS WILL GET AVAILABLE PHYSICAL MEMORY INFORMATION
If InStr(1, InputString, "physical memory", 1) > 0 Then
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\" & strComputer & "\rootcimv2")
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colSettings
UltraHal = " Available Physical Memory: " & _
        objOperatingSystem.FreePhysicalMemory & " MB "
Next
End If

'THIS WILL GET TOTAL PHYSICAL MEMORY INFORMATION
If InStr(1, InputString, "physical memory", 1) > 0 Then
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
For Each objComputer In colSettings
UltraHal = UltraHal & " Total Physical Memory: " & _
        objComputer.TotalPhysicalMemory & " MB "
Next
End If

'THIS WILL GET CPU CURRENT SPEED INFORMATION
If InStr(1, InputString, "processor usage", 1) > 0 Or InStr(1, InputString, "processor time", 1) > 0 Or _
InStr(1, InputString, "cpu time", 1) > 0 Or InStr(1, InputString, "cpu usage", 1) > 0 Or InStr(1, InputString, "clock speed", 1) > 0 Then
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem In colItems
UltraHal = UltraHal & " Current Clock Speed: " & objItem.CurrentClockSpeed & " MHz"
Next
End If

'THIS WILL GET THE HARD DISK SPACE INFORMATION
If InStr(1, InputString, "hard disk space", 1) > 0 Or InStr(1, InputString, "harddisk space", 1) > 0 Or _
InStr(1, InputString, "free space", 1) > 0 Or InStr(1, InputString, "storage space", 1) > 0 Then
Set oFs = CreateObject("Scripting.FileSystemObject")
         Set oDrives = oFs.Drives
          For Each oDrive In oDrives
         Select Case oDrive.DriveType
      Case Fixed
GetFreeSpaceReport = GetFreeSpaceReport & oDrive.DriveLetter & ": " & Round(oDrive.FreeSpace/(1024*1024)) & "MB free (" & Round(100 * (oDrive.FreeSpace/oDrive.TotalSize),2) & "%)" & vbcrlf
End Select
Next
Str = GetFreeSpaceReport
UltraHal = Str
End If

'THIS WILL ALLOW A USER TO SHUT DOWN THE COMPUTER
'THIS SCRIPT WILL WORK WELL WITH ASSISTANT BUT MAY CAUSE
'PROBLEMS WITH AIM BOT USERS BECAUSE ANYONE USING AIM
'COULD SHUT DOWN YOUR COMPUTER ON COMMAND.
If InStr(1, InputString, "shut down computer", 1) > 0 Or InStr(1, InputString, "shut down system", 1) > 0 Then
Set oWshX = CreateObject("WScript.Shell")
Set oWshSysEnvX = oWshX.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnvX("COMPUTERNAME")
    strShutdown = "shutdown -s -t 0 -f -m \" & GetCurrentComputerName
    Set objShell = CreateObject("WScript.Shell")
    objShell.Run strShutdown
End If


Have fun and I will try to work on the rest of your requests when I get time.

this code will come default in the Quantum Child Brain I am developing but won't be done for a while.
Jerry[8D]
Title: Hal pc control
Post by: onthecuttingedge2005 on March 02, 2010, 01:04:24 pm
you can also use this plugin I designed called WebSurfer, it allows HAL more flexibility in opening up Web Maps, Pictures, Sites. you can peer into the plugin to see how it functions to give you a better idea of how it works.

here is the plugin web surfer:

(http://icon_paperclip.gif) Download Attachment: WebSurf.uhp ("http://www.zabaware.com/forum/uploaded/onthecuttingedge2005/201032125944_WebSurf.uhp")
5.81 KB

you can say things like; please open up www.zabaware.com and the site will open, you can say find a picture or a portrait of an eagle and it will load a page with pictures of an eagle and or eagles.
you can also say find a map on new york and it will open a map of new york and so on.

place the plugin in your Ultra Hal Assistant 6 folder and then choose the plugin from your brain options.

Jerry[8D]
Title: Hal pc control
Post by: sybershot on March 02, 2010, 04:23:28 pm
onthecuttingedge2005 Thanks a million, "Quantum Child Brain"  That is a great name, it grabs my attention and got me curious. Let me know if you need any help testing with different operating systems. I know have 3 computers with 3 different operating systems. xp home 32 bit, vista home 64bit, and windows7 home 64bit.

Any other coder needing testing on any of the above operating systems let me know, I'm more than glad to help.

Thanks again sincerely Sybershot
Title: Hal pc control
Post by: sybershot on March 03, 2010, 02:10:35 pm
onthecuttingedge2005 I created a second default brain file today named Trinity to try your
quote:
UPDATED: TUESDAY, MARCH 2 2010, 12:04PM
. It was the first time I ever did that, and it was very simple. in my new brain under "Rem PLUGIN: POST-PROCESS" and after all of Roberts comments for that area I placed your code.

Here are the results

Processor usage is = error
HalScript Error- 2147217375 on line 303 in column 0:

Available Physical Memory = error
HalScript Error- 2147217375 on line 312 in column 0:

Total Physical Memory = error
HalScript Error- 2147217375 on line 312 in column 0:

current clock speed = error
HalScript Error- 2147217375 on line 338 in column 0:

Get Free Space Report
C:177146MB free (60%) F:425645MB free (89.37%) G: 153447MB free (50.28%)

just for a reference of accuracy my system shows this info
C: Total Size 288GB, free space 172GB
F: Total Size 465GB, free space 415GB
G: Total Size 298GB, free space 149GB

shut down computer
popped up 3 DOS windows and they closed within a few seconds, and system did not shut down

Tested on a gateway FX Laptop with vista 64bit home premium and two WD Passport usb Portable Hard Drives

If and when you have the time could you please look into this for me?
If you want the DBG file let me know

I have not tried the WebSurf.uhp yet, I will later tonight if I have time.
EDIT: Just tried WebSurf.uhp and works perfect, Thanks you
EDIT2: been looking at the code and Win32 looks to be a possible culprit, I will try Win64 and post results
EDIT3: just changing 32 to 64 on all paths/files, did not work. I found out with other plug-ins that paths are different in 64bit[:(] is this maybe the issue here?
Title: Hal pc control
Post by: onthecuttingedge2005 on March 03, 2010, 06:10:45 pm
quote:
Originally posted by sybershot

onthecuttingedge2005 I created a second default brain file today named Trinity to try your
quote:
UPDATED: TUESDAY, MARCH 2 2010, 12:04PM
. It was the first time I ever did that, and it was very simple. in my new brain under "Rem PLUGIN: POST-PROCESS" and after all of Roberts comments for that area I placed your code.

Here are the results

Processor usage is = error
HalScript Error- 2147217375 on line 303 in column 0:

Available Physical Memory = error
HalScript Error- 2147217375 on line 312 in column 0:

Total Physical Memory = error
HalScript Error- 2147217375 on line 312 in column 0:

current clock speed = error
HalScript Error- 2147217375 on line 338 in column 0:

Get Free Space Report
C:177146MB free (60%) F:425645MB free (89.37%) G: 153447MB free (50.28%)

just for a reference of accuracy my system shows this info
C: Total Size 288GB, free space 172GB
F: Total Size 465GB, free space 415GB
G: Total Size 298GB, free space 149GB

shut down computer
popped up 3 DOS windows and they closed within a few seconds, and system did not shut down

Tested on a gateway FX Laptop with vista 64bit home premium and two WD Passport usb Portable Hard Drives

If and when you have the time could you please look into this for me?
If you want the DBG file let me know

I have not tried the WebSurf.uhp yet, I will later tonight if I have time.
EDIT: Just tried WebSurf.uhp and works perfect, Thanks you
EDIT2: been looking at the code and Win32 looks to be a possible culprit, I will try Win64 and post results
EDIT3: just changing 32 to 64 on all paths/files, did not work. I found out with other plug-ins that paths are different in 64bit[:(] is this maybe the issue here?



you are right, the codes I wrote are for a 32 bit operating system not 64 bit, since I don't have a 64 bit system I will have to wait till I get one to rewrite the codes to work for you, sorry.

do you have a 32 bit system you can try it on? I know it works flawlessly on my 32 O/S

thanks for informing of your error so I can make a note to 64 bit users.

Jerry
Title: Hal pc control
Post by: sybershot on March 04, 2010, 01:18:11 am
yes I have xp home 32bit on a desktop, I will test it on that one and get back to you.

quote:
since I don't have a 64 bit system I will have to wait till I get one to rewrite the codes to work for you, sorry.
 

I will try and see what I can do, Maybe I'll get lucky an figure it out. this way 32 and 64 bit users can enjoy this. I will keep you posted.

quote:
thanks for informing of your error so I can make a note to 64 bit users.

your welcome, anytime
Title: Hal pc control
Post by: sybershot on March 05, 2010, 09:25:37 am
I asked for help with this on a vb forum, I got a reply saying that it is not a 32-bit vs 64-bit issue, but is user permissions and potentially the information provided by the motherboard too.
he suggested a couple of things and An alternative to get the information via API's
http://www.vbforums.com/showthread.php?t=606023 is where the thread can be located

I will test on xp 32 home premium service pack 3 this weekend, and let you know
Title: Hal pc control
Post by: sybershot on March 05, 2010, 08:34:50 pm
onthecuttingedge2005 I am sorry  I went ahead and posted your code else where, I was not really thinking straight, alot has been going on here. I should of asked first. again sorry, I will not do it again. sincerely Sybershot
Title: Hal pc control
Post by: sybershot on March 08, 2010, 09:35:11 pm
I tested on my windows XP home premium32 bit over the weekend and here are the results

Processor usage is = error
HalScript Error- 2147217375 on line 301 in column 0:

Available Physical Memory = error
HalScript Error- 2147217375 on line 310 in column 0:

Total Physical Memory = error
HalScript Error- 2147217375 on line 310 in column 0:

current clock speed = error
HalScript Error- 2147217375 on line 336 in column 0:

Get Free Space Report
C:4576MB free (5.17%) D: 470MB free (6.89%)

shut down system
a few dos boxes and a request from my firewall for Windows Remote Shutdown Tool to get access to the internet

I allowed shutdown tool access and the system did not shut down, then I tried with out letting it have access and it still did not shut down

if you want/need any further testing any either os let me know. I will be glad to help
Title: Hal pc control
Post by: onthecuttingedge2005 on March 09, 2010, 09:07:34 am
quote:
Originally posted by sybershot

I tested on my windows XP home premium32 bit over the weekend and here are the results

Processor usage is = error
HalScript Error- 2147217375 on line 301 in column 0:

Available Physical Memory = error
HalScript Error- 2147217375 on line 310 in column 0:

Total Physical Memory = error
HalScript Error- 2147217375 on line 310 in column 0:

current clock speed = error
HalScript Error- 2147217375 on line 336 in column 0:

Get Free Space Report
C:4576MB free (5.17%) D: 470MB free (6.89%)

shut down system
a few dos boxes and a request from my firewall for Windows Remote Shutdown Tool to get access to the internet

I allowed shutdown tool access and the system did not shut down, then I tried with out letting it have access and it still did not shut down

if you want/need any further testing any either os let me know. I will be glad to help




Hi sybershot.

could you send me a copy of the brain you are using with the code inserted the way you had it so I can see if it runs on my system.

I am not sure yet but it sounds like your administration security is somehow messing up the script. are you running it as a full administrator?

Jerry
Title: Hal pc control
Post by: sybershot on March 10, 2010, 03:38:04 am
quote:
are you running it as a full administrator

yes (Compaq-Owner Computer administrator) displays under User Account, with no other users, guest account is turned off.
if helps my system is a Hp Compaq Presario model sr1810nx windows xp
quote:
could you send me a copy of the brain you are using

(http://icon_paperclip.gif) Download Attachment: trail2.uhp ("http://www.zabaware.com/forum/uploaded/SyberShot/201031033628_trail2.uhp")
139.53 KB

Edit: I thought maybe my anti virus (avast) and firewall (zone alarm) might have been a culprit, I shut them both down and i still got the same results
Title: Hal pc control
Post by: onthecuttingedge2005 on March 15, 2010, 02:16:38 am
Hi Sybershot.

would you create a file called Tester.vbs onto your desktop and then right click on the vbs file and choose edit, then copy and paste this code into the vbs file then save it, click on it to run the code.



does the code run? it should give you your computers name via a message box.

Code: [Select]
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
MsgBox GetCurrentComputerName

if you get an error then I think it is related to Wscript and I will investigate further whether Wscript is causing your errors here.
Title: Hal pc control
Post by: sybershot on March 15, 2010, 09:02:13 am
I got a window that opened Stating my computers name "SYBERSHOT-PC"
Title: Hal pc control
Post by: onthecuttingedge2005 on March 15, 2010, 12:23:40 pm
quote:
Originally posted by sybershot

I got a window that opened Stating my computers name "SYBERSHOT-PC"



Hi Sybershot.

now could you do the same thing with this code, add it to your tester.vbs file and then see if it runs on your system.

Code: [Select]
'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."

'THIS WILL GET CPU USAGE INFORMATION

Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'")
For Each objItem In colItems
MsgBox " Processor usage is " & objItem.PercentProcessorTime & "  %"
Next


'THIS WILL GET AVAILABLE PHYSICAL MEMORY INFORMATION

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\" & strComputer & "\rootcimv2")
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colSettings
MsgBox " Available Physical Memory: " & _
        objOperatingSystem.FreePhysicalMemory & " MB "
Next


'THIS WILL GET TOTAL PHYSICAL MEMORY INFORMATION

Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
For Each objComputer In colSettings
MsgBox " Total Physical Memory: " & _
        objComputer.TotalPhysicalMemory /10241024+1 & "MB"
Next


'THIS WILL GET CPU CURRENT SPEED INFORMATION

Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem In colItems
MsgBox " Current Clock Speed: " & objItem.CurrentClockSpeed & " MHz"
Next


'THIS WILL GET THE HARD DISK SPACE INFORMATION

Set oFs = CreateObject("Scripting.FileSystemObject")
         Set oDrives = oFs.Drives
          For Each oDrive In oDrives
         Select Case oDrive.DriveType
      Case Fixed
GetFreeSpaceReport = GetFreeSpaceReport & oDrive.DriveLetter & ": " & Round(oDrive.FreeSpace/(1024*1024)) & "MB free (" & Round(100 * (oDrive.FreeSpace/oDrive.TotalSize),2) & "%)"
End Select
Next
MsgBox GetFreeSpaceReport



'THIS WILL ALLOW A USER TO SHUT DOWN THE COMPUTER
'THIS SCRIPT WILL WORK WELL WITH ASSISTANT BUT MAY CAUSE
'PROBLEMS WITH AIM BOT USERS BECAUSE ANYONE USING AIM
'COULD SHUT DOWN YOUR COMPUTER ON COMMAND.

'Set oWshX = CreateObject("WScript.Shell")
'Set oWshSysEnvX = oWshX.Environment("PROCESS")
'GetCurrentComputerName = oWshSysEnvX("COMPUTERNAME")
    'strShutdown = "shutdown -s -t 0 -f -m \" & GetCurrentComputerName
    'Set objShell = CreateObject("WScript.Shell")
    'objShell.Run strShutdown



you should get several message boxes showing properties of your computer's memory and CPU

Thanks.
Jerry
Title: Hal pc control
Post by: sybershot on March 15, 2010, 03:35:24 pm
window 1:
SYBERSHOT-PC

window 2:
Script:   C:UsersSybershotDesktopTester.vbs
Line:   20
Char:   1
Error:   0x80041021
Code:   80041021
Source:   (null)

complete code of vbs
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
MsgBox GetCurrentComputerName

'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."

'THIS WILL GET CPU USAGE INFORMATION

Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'")
For Each objItem In colItems
MsgBox " Processor usage is " & objItem.PercentProcessorTime & "  %"
Next


'THIS WILL GET AVAILABLE PHYSICAL MEMORY INFORMATION

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\" & strComputer & "\rootcimv2")
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colSettings
MsgBox " Available Physical Memory: " & _
        objOperatingSystem.FreePhysicalMemory & " MB "
Next


'THIS WILL GET TOTAL PHYSICAL MEMORY INFORMATION

Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
For Each objComputer In colSettings
MsgBox " Total Physical Memory: " & _
        objComputer.TotalPhysicalMemory /10241024+1 & "MB"
Next


'THIS WILL GET CPU CURRENT SPEED INFORMATION

Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem In colItems
MsgBox " Current Clock Speed: " & objItem.CurrentClockSpeed & " MHz"
Next


'THIS WILL GET THE HARD DISK SPACE INFORMATION

Set oFs = CreateObject("Scripting.FileSystemObject")
         Set oDrives = oFs.Drives
          For Each oDrive In oDrives
         Select Case oDrive.DriveType
      Case Fixed
GetFreeSpaceReport = GetFreeSpaceReport & oDrive.DriveLetter & ": " & Round(oDrive.FreeSpace/(1024*1024)) & "MB free (" & Round(100 * (oDrive.FreeSpace/oDrive.TotalSize),2) & "%)"
End Select
Next
MsgBox GetFreeSpaceReport



'THIS WILL ALLOW A USER TO SHUT DOWN THE COMPUTER
'THIS SCRIPT WILL WORK WELL WITH ASSISTANT BUT MAY CAUSE
'PROBLEMS WITH AIM BOT USERS BECAUSE ANYONE USING AIM
'COULD SHUT DOWN YOUR COMPUTER ON COMMAND.

'Set oWshX = CreateObject("WScript.Shell")
'Set oWshSysEnvX = oWshX.Environment("PROCESS")
'GetCurrentComputerName = oWshSysEnvX("COMPUTERNAME")
    'strShutdown = "shutdown -s -t 0 -f -m \" & GetCurrentComputerName
    'Set objShell = CreateObject("WScript.Shell")
    'objShell.Run strShutdown

Title: Hal pc control
Post by: onthecuttingedge2005 on March 15, 2010, 08:08:47 pm
Hi Sybershot.

could you try each code set individually, that way I can debug each set for you.

thanks
Jerry
Title: Hal pc control
Post by: sybershot on March 15, 2010, 08:32:51 pm
Code: [Select]
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
MsgBox GetCurrentComputerName

'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."

'THIS WILL GET CPU USAGE INFORMATION

Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'")
For Each objItem In colItems
MsgBox " Processor usage is " & objItem.PercentProcessorTime & "  %"
Next

Script: C:UsersSybershotDesktopTester.vbs
Line: 20
Char: 1
Error: 0x80041021
Code: 80041021
Source: (null)

Code: [Select]
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
MsgBox GetCurrentComputerName

'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."

'THIS WILL GET AVAILABLE PHYSICAL MEMORY INFORMATION

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\" & strComputer & "\rootcimv2")
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colSettings
MsgBox " Available Physical Memory: " & _
        objOperatingSystem.FreePhysicalMemory & " MB "
Next
 
Script: C:UsersSybershotDesktopTester.vbs
Line: 17
Char: 1
Error: 0x80041021
Code: 80041021
Source: (null)

Code: [Select]
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
MsgBox GetCurrentComputerName

'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."

'THIS WILL GET TOTAL PHYSICAL MEMORY INFORMATION

Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
For Each objComputer In colSettings
MsgBox " Total Physical Memory: " & _
        objComputer.TotalPhysicalMemory /10241024+1 & "MB"
Next
Script: C:UsersSybershotDesktopTester.vbs
Line: 17
Char: 1
Error: Object required:'objWMIService'
Code: 800A01A8
Source: Microsoft VBScript runtime error

Code: [Select]
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
MsgBox GetCurrentComputerName

'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."

'THIS WILL GET CPU CURRENT SPEED INFORMATION

Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem In colItems
MsgBox " Current Clock Speed: " & objItem.CurrentClockSpeed & " MHz"
Next
Script: C:UsersSybershotDesktopTester.vbs
Line: 20
Char: 1
Error: 0x80041021
Code: 80041021
Source: (null)

Code: [Select]
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
MsgBox GetCurrentComputerName

'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."

'THIS WILL GET THE HARD DISK SPACE INFORMATION

Set oFs = CreateObject("Scripting.FileSystemObject")
         Set oDrives = oFs.Drives
          For Each oDrive In oDrives
         Select Case oDrive.DriveType
      Case Fixed
GetFreeSpaceReport = GetFreeSpaceReport & oDrive.DriveLetter & ": " & Round(oDrive.FreeSpace/(1024*1024)) & "MB free (" & Round(100 * (oDrive.FreeSpace/oDrive.TotalSize),2) & "%)"
End Select
Next
MsgBox GetFreeSpaceReport
C:176714MB free (59.85%)G:153425MB free(50.28%)

next one is shut down so I will post now so I don't loose info for testing and posting live


Code: [Select]
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
MsgBox GetCurrentComputerName

'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."


'THIS WILL ALLOW A USER TO SHUT DOWN THE COMPUTER
'THIS SCRIPT WILL WORK WELL WITH ASSISTANT BUT MAY CAUSE
'PROBLEMS WITH AIM BOT USERS BECAUSE ANYONE USING AIM
'COULD SHUT DOWN YOUR COMPUTER ON COMMAND.

'Set oWshX = CreateObject("WScript.Shell")
'Set oWshSysEnvX = oWshX.Environment("PROCESS")
'GetCurrentComputerName = oWshSysEnvX("COMPUTERNAME")
    'strShutdown = "shutdown -s -t 0 -f -m \" & GetCurrentComputerName
    'Set objShell = CreateObject("WScript.Shell")
    'objShell.Run strShutdown
no system shut down. dough! just realized you commented out^^
un-commented last 6 lines, got a blank dos box to appear for 2 to 3 seconds
no system shut down

 
Title: Hal pc control
Post by: onthecuttingedge2005 on March 15, 2010, 08:40:13 pm
Hi Sybershot.

can you go to run, regedit, look for HKEY_CLASSES_ROOT\WINMGMTS

does the hot key class exist in your computer's registry?
Title: Hal pc control
Post by: sybershot on March 15, 2010, 09:25:23 pm
I looked manually for HKEY_CLASSES_ROOTWINMGMTS and I have nothing starting with HKEY as a main folder, I did a search, and came up empty handed
Title: Hal pc control
Post by: sybershot on March 15, 2010, 09:38:28 pm
i did find this on a vista forum, if it helps.

"Note that HKEY_CLASSES_ROOT is HKEY_LOCAL_MACHINESoftwareClasses and
HKEY_CURRENT_USERSoftwareClasses combined together, with entries in
HKCU taking precedence.
I believe writes to this location get sent to HKLM, but not exactly sure."

I used the search function in registry just for HKEY main folders =
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USER
HKEY_CYRRENT_CONFIG

EDIT: there is a HKEY_CLASSES_ROOT main folder, was at the top, still no ROOTWINMGMTS within. I was rushing to post to try and catch you and did not notice it.
Title: Hal pc control
Post by: sybershot on March 15, 2010, 10:49:43 pm
if this helps I also searched for JUST "winmgmts"

HKEY-LOCAL-MACHINE
..SOFTWARE
....CLASSES
......CLSID
........172bDDF8-CEEA-11D1-8B05-00600806D9B6
..........InProcServer32
..........ProgID
..........VersionIndependentProgID

InProcServer32:
NAME......TYPE..............DATA
(Default).REG_EXPAND_SZ..%SystemRoot%system32wbemwbemdisp.dll  
ThreadingModel..REG_SZ...Apartment

ProgID:
NAME......TYPE...........DATA
(default).REG_SZ.........WINMGMTS.1

VersionIndependentProgID
NAME......TYPE...........DATA
(default).REG_SZ.........WINMGMTS

edit: had to add "...." for indentation
Title: Hal pc control
Post by: onthecuttingedge2005 on March 15, 2010, 11:03:40 pm
You can download the WMI core from Microsoft here:

http://download.microsoft.com/download/platformsdk/wmint4/1.5/NT4/EN-US/wmint4.EXE

install it and see if writes to the registry: HKEY_CLASSES_ROOT\WINMGMTS

we can start here to see if this problem gets resolved.
I am not sure what the minimum and maximum O/S supported. if not support it may not install.

once installed, reboot your system to refresh your registry.

after reboot you can try to run the vbscript codes to see if you still get errors.

also when posting backslashes in the forum use two backslashes to post root directories properly, forward slashes are not effect by the filtering on this forum.
Title: Hal pc control
Post by: sybershot on March 16, 2010, 09:16:31 am
Unsupported Platform

This version of the WMI Core Components is
only supported on Windows NT 4.0 Service
Pack 4 or later Versions of Windows NT 4
Title: Hal pc control
Post by: sybershot on March 16, 2010, 05:01:58 pm
I have been Google searching for ketwords such as "vb, vista system info, etc" to try and find out why this does not work. I have had no luck yet.
Though I did find somewhere in the vista forums someone asking a similar question. I think it was system volume control using vb, a person responded by stating that even though your under a admin account, have user account control turned off, that in vista you have to run it as admin by right clicking the exe, vbs, etc. and click run as admin.
I did this with Hal and got the same error results.
I went to do this with the Tester.vbs and "run as admin" was not in the menu.
Is it suppose to be in the menu for a .vbs?
If it is suppose to be there, maybe it is a clue to why it is not working.


Title: Hal pc control
Post by: onthecuttingedge2005 on March 16, 2010, 08:51:12 pm
Hi Sybershot.

try turning off your UAC, UAC is the program that keeps some scripts and stuff from running as a security feature in windows vista and windows 7.

http://www.petri.co.il/disable_uac_in_windows_vista.htm

you can read this article and learn to turn it off or on, turning it off also keeps those nagging security screens from running that say, are you sure you want to run this program! a real pain in the butt to me.

this is strictly to see if the "shut down vbscript code" I gave you will work as it is supposed to if UAC is turned off.
Title: Hal pc control
Post by: sybershot on March 18, 2010, 04:47:42 pm
sorry I was not able to get back right away, I had quite a few problems yesterday, and was away from my computer.

My UAC has not been turned back on (except to test with it on) for some time now, at least 3 months.

with the UAC off or on I get a Dos box that opens up, and closes just as fast as it opened up, and nothing happens.