Author Topic: Computer Status XML request  (Read 3226 times)

0 Members and 1 Guest are viewing this topic.

Spenner11

  • Jr. Member
  • **
  • Posts: 26
  • Karma: 0
  • British laddo, kicking it in B.C
    • View Profile
Computer Status XML request
« on: November 03, 2014, 06:01:03 PM »
I was wondering if anyone had a command that returned the computers temperature status/ CPU usage?
EG Something along the lines of Command : Jarvis How are you feeling...
VC would then return an answer based on the values..?
EG.  Not too good sir (If the temperature was hot)
A little rushed (If CPU usage was high)
Or specific values with a "What's your status" command

Its something I would love to have a bash at myself but I haven't a clue where to start!
Third party software im guessing is definately going to be needed...

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Computer Status XML request
« Reply #1 on: November 03, 2014, 07:01:24 PM »
You can probably get the load % but not temp.

btw, XML exchange is intended as a place to share, not a place for requests.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Computer Status XML request
« Reply #2 on: November 03, 2014, 10:01:55 PM »
@Spenner11 - Does the wmic command for getting CPU (computer) temperature as described here: http://www.tomshardware.com/faq/id-1924879/learn-computer-command-prompt-wmic.html work for you?

If it does, it will return a number in the thousands (temp is given as 0.1 * n Kelvin).

If that works, I can probably come up with something for you.

TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Spenner11

  • Jr. Member
  • **
  • Posts: 26
  • Karma: 0
  • British laddo, kicking it in B.C
    • View Profile
Re: Computer Status XML request
« Reply #3 on: November 05, 2014, 01:02:57 PM »
Nime5ter unfortunately that function doesn't work on my command prompt  :-\

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Computer Status XML request
« Reply #4 on: November 05, 2014, 02:42:12 PM »
@Spenner11 try http://openhardwaremonitor.org/ and see if it works ...
those things are highly variable in functionality from PC to another ... from software to another ...

this software has internal webserver that means VC can access info not only about the PC it is running on ... but all PCs you might have at home :)

When Voice command gets tough, use hand gestures

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Computer Status XML request
« Reply #5 on: November 05, 2014, 04:33:50 PM »
In the meantime, if you just want a bit of fun, you can add the following to any of your existing python files in VC that are set to load when VC first loads (e.g. the weatherDay.py python file).:

Code: [Select]
import clr
clr.AddReference("System.Management")
from System.Management  import ManagementObject

def CPUload():

    usg = ManagementObject("Win32_PerfFormattedData_PerfOS_Processor.Name='_total'")
    load = str(usg["PercentProcessorTime"])
    return load
   
    #see http://www.ironpython.info/index.php?title=WMI_with_IronPython for other system info examples

If you're not using any python scripts yet, save the above as something like cpu.py in your \PY folder, and then create a VC command to load it (as per other examples on the forum).

Then, the following command provides a bit of CPU load chitchat -- mostly for entertainment value. Not particularly practical.
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.7-->
<command id="332" name="Jarvis, how are you feeling" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>PY.ExecString</cmdType>
    <params>
      <param>result=CPUload()</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>{LastResult}&amp;&amp;40</ifParams>
    <then>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>Currently I'm taking it easy, thanks.|Pretty much chillinn -- most of the time. |No worries. I'm A-OK.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <params>
          <param>Frankly, I've seen lighter loads.|Try to take it easy, would you?|Dude, yer killin' me.</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </else>
  </if>
  <action>
    <cmdType>VC.Pause</cmdType>
    <params>
      <param>400</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>CPU usage is at {LastResult}%.</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Jarvis, how are you feeling</phrase>
</command>
« Last Edit: December 27, 2014, 02:54:36 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)