Author Topic: Some of my codes  (Read 4360 times)

0 Members and 1 Guest are viewing this topic.

sirs2k

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Some of my codes
« on: May 17, 2014, 11:50:32 AM »
Hey guys, I've learnt a lot in the last week or so. Thanks for all your help!
I would like to share the codes that I or the great members on the forums have made/refined to suit my needs, maybe be of interest to some of you.

"It's showtime"
When I want to watch a movie, this will change the output to "PC screen only" for some reason it's not "second screen" on my PC. You can edit the key inputs to suit you. Speaking of which, is there any way we can just input the screen name instead of inputting keys to manually press? (check the script).
So this does the following:
1- Change video output to 2nd screen (HDMI)
2- Sets audio output to (HDMI)
3- Starts XBMC
4- "Enjoy the show"

Then of course reverse+exit XBMC when finished.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="560" name="Android On" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>player.setspeed&amp;&amp;"playerid":1,"speed":2</cmdString>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>player.setspeed&amp;&amp;"playerid":1,"speed":0</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Input.ExecuteAction&amp;&amp;"action":"pause"</cmdString>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <cmdString>200</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.SoftMute</cmdType>
    <cmdString>0</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <cmdString>200</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>AV.Mic.On</event>
</command>


Then Obviously when you let go of the button on VoxWav it will Unmute and Resume.

"Mic Off"
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="526" name="Android Off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>player.setspeed&amp;&amp;"playerid":1,"speed":0</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <cmdString>200</cmdString>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Input.ExecuteAction&amp;&amp;"action":"pause"</cmdString>
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <cmdString>300</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.SoftUnMute</cmdType>
    <cmdString />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>AV.Mic.Off</event>
</command>

"Run Pandora"
This obviously runs the Pandora add-on
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="443" name="run Pandora" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Launch.RawParam</cmdType>
    <cmdString>{path.pfx86}\XBMC\XBMC.exe</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>VC.Pause</cmdType>
    <cmdString>2000</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Addons.ExecuteAddon&amp;&amp;"addonid":"script.audio.pandora"</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>run Pandora</phrase>
</command>

"Now Playing"
In movie mode, if I go to home screen or anything out of the Now Playing, it's a nightmare trying to get back to the player window! (maybe I haven't figured it out yet). This is just a simple mouse click to click on the side to get me to that window.

Remember you might have to change the mouse coordinates depending on your viewing resolution   :)
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="291" name="now playing" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Mouse.MoveAbsolute</cmdType>
    <cmdString>2000,150</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Mouse.LeftClick</cmdType>
    <cmdString />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>now playing</phrase>
</command>

That's all for now. Please feel free to suggest anyways to make these better. Especially the way it changes display output.

Cheers
« Last Edit: May 21, 2014, 02:22:01 PM by sirs2k »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Some of my codes
« Reply #1 on: May 17, 2014, 12:17:49 PM »
Great post.  Thanks!  ::banana

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Some of my codes
« Reply #2 on: May 20, 2014, 06:39:14 PM »
Speaking of which, is there any way we can just input the screen name instead of inputting keys to manually press? (check the script).

You could try DisplaySwitch.exe from the command line if it's more convenient for you. http://voxcommando.com/forum/index.php?topic=1125.msg9462#msg9462
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)

sirs2k

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: Some of my codes
« Reply #3 on: May 21, 2014, 12:37:45 PM »
You could try DisplaySwitch.exe from the command line if it's more convenient for you. http://voxcommando.com/forum/index.php?topic=1125.msg9462#msg9462

That worked perfectly! It's much faster and not a hit and miss like keyboard emu.

I do have a few other questions I hope I can get some advice.

1- "Remind me to" (name dictation is not accurate). Can VC learn from windows, gmail, or outlook dictionary? That way it will detect what we have added to dictionary before for detection. Or is there another way we can input names and new words for use across VC?

2- If I run XBMC on PC the "pass-through output device" in XBMC changes obviously. What's really annoying is when I watch a movie on surround system next, I always have to go into settings and change it back to HDMI. Is there a direct XBMC command to change pass-through device?

3- I'm starting to use MediaMonkey now and I know to start a new instance of VC to open MM commands. I want to know if it would be an issue if I import MM commands to the same default command list I'm using for XBMC or I have to use 2 separate instances of VC?

4- What I get VC to speak something while I'm on pass-through mode the volume is WAY too high compared to movie volume (that's because the movie is in pass-through mode while VOX is on 2 channel only). Can we set the volume limit for VC when speaking?
EDIT: I found a solution for this, add <volume level="10"> at the beginning of the text box. For example (<volume level="10">Enjoy the show) 10 stands for 10% can obviously go up to 100%

Thanks in advance guys
« Last Edit: May 21, 2014, 01:48:32 PM by sirs2k »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Some of my codes
« Reply #4 on: May 21, 2014, 03:30:55 PM »
I do have a few other questions I hope I can get some advice.

1-...Can VC learn from windows, gmail, or outlook dictionary...

2- ...Is there a direct XBMC command to change pass-through device?

3- I'm starting to use MediaMonkey now and I know to start a new instance of VC to open MM commands. I want to know if it would be an issue if I import MM commands to the same default command list I'm using for XBMC or I have to use 2 separate instances of VC?

4- What I get VC to speak something while I'm on pass-through mode the volume is WAY too high...

1 ) The short answer is no. You basically have two options.  Payload "dictation" which uses windows built in dictionary, or PayloadXML files.  You can create your own payloadXML files and put anything you want in there, but you have to figure out how to create the file yourself.  If you use "dictation", there is nothing VoxCommando can do to extend it.  You can try looking for other tools that allow you to edit the windows dictionary.  Windows offers to scan your documents and email etc. when you create a new speech profile.  I haven't tried this but you can try it if you want.

2) Not that I know of.  Please complain to XBMC about this.  I would also like to be able to set the output device.  It looks like Gotham may have brought back the option of a "default" device.  You might be able to use that to switch outputs, by changing the default Windows output.

3)  You can combine them, but you need to edit your commands to avoid conflicting commands.  One way is to only enable your XBMC groups when XBMC is focused, and only enable MM groups when MM is focused.  You should also keep in mind that you will be creating extra payloadXML files (for artists, albums, genres, songtitles) which contain a lot of items for your songs.  If you have a lot of music this will require more memory and increase load times.  I personally don't use XBMC for music so I removed all the music command in XBMC to create room for MM.

4) Yes.  It is easy to set TTS volume.  There is an action for it.  It starts with TTS...
« Last Edit: May 21, 2014, 03:33:45 PM by jitterjames »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Some of my codes
« Reply #5 on: May 21, 2014, 09:16:22 PM »
Quote
2- ...Is there a direct XBMC command to change pass-through device?

http://voxcommando.com/forum/index.php?topic=1583.0
« Last Edit: May 23, 2014, 10:12:31 AM by nime5ter »