Author Topic: Retrieve window size  (Read 5485 times)

0 Members and 1 Guest are viewing this topic.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Retrieve window size
« on: June 19, 2016, 01:42:04 PM »
Anybody knows of a way that vc retrieve a window size... I am trying to figure out Kodi window size when I log in remotely
Tx
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Retrieve window size
« Reply #1 on: June 20, 2016, 06:35:43 PM »
I may have something for you soon.  I'm working on a beta plugin called "Win" for doing stuff like that.  I will try to give you something to play with but the actions names and structure may change as I get closer to a finished product.

Stay tuned.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: Retrieve window size
« Reply #2 on: June 21, 2016, 02:31:41 AM »
 ;D ;D ;D ..
I knew you can do it ... but I felt I am asking for too many features ... so I passed on this ... though I was hoping that one day you extend the window actions with size and move and get size ...etc.
« Last Edit: June 21, 2016, 02:34:35 AM by Haddood »
When Voice command gets tough, use hand gestures

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Retrieve window size
« Reply #3 on: July 02, 2016, 01:33:42 PM »
OK.  I just uploaded VC 2.2.2.1 which includes the first beta of the "Win" plugin.  I did not tweet about this version yet because I still need to work on the changelog.

Update VC, enable the Win plugin, and then for a quick test you can try these commands:

There is still a lot of work to do on this plugin but the basics seem to be working well.  I think there is also a lot of potential room for growth in terms of new tools we can build into this one.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.2.1-->
<commandGroup open="True" name="Win Plugin quick tests" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="31" name="Window test chrome" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="" loopMax="" description="">
    <action>
      <cmdType>Win.Find.ByProcess</cmdType>
      <params>
        <param>chrome</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Win.Set.State</cmdType>
      <params>
        <param>normalize</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Win.Set.Position</cmdType>
      <params>
        <param>0</param>
        <param>0</param>
        <param>800</param>
        <param>600</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Win.Set.Focus</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Win.Get.Info</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Window test chrome</phrase>
  </command>
  <command id="34" name="Window test internet explorer" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="" loopMax="" description="">
    <action>
      <cmdType>Win.Find.ByProcess</cmdType>
      <params>
        <param>iexplore</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Win.Set.State</cmdType>
      <params>
        <param>normalize</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Win.Set.Position</cmdType>
      <params>
        <param>0</param>
        <param>0</param>
        <param>800</param>
        <param>600</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Win.Set.Focus</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Win.Get.Info</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Window test internet explorer</phrase>
  </command>
</commandGroup>

Enjoy...  ::happy

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Retrieve window size
« Reply #4 on: July 02, 2016, 05:20:36 PM »
 :yay :clap ::banana

you my man are a genius, I just did some testing with this new plugin and it works great, every update you release the less and less I have to use Autohotkey  ;D, I think the only thing I need Autohotkey for now is watching for specific popups,

like right now I use it to watch for the Teamviewer pop, the one that pops when you close the connection (Sponsored session, This was a free session sponsored by....) something like that anyways, and then it automaticly clicks the "ok" button for me


by the way in the "Action Selection Tree" the plugin has "State" listed twice under "Set", when you click on the top one its shows a name of "NewSate" and the bottom one shows a name of "State"

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Retrieve window size
« Reply #5 on: July 03, 2016, 10:30:23 AM »
Thanks Peg.  We had already noticed and corrected that error, along with quite a few other changes to the command descriptions, but somehow that file did not get updated in the installer, even though I remember doing it!  :bonk

Since there are a few changes you may want to update the action.xml file right away so I'm attaching it to this post.  Obviously it will also be updated in version 2.2.2.2

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Retrieve window size
« Reply #6 on: July 05, 2016, 03:25:50 AM »
Thanks for the updated File, I've been playing around with with the plugin, but I have found that moving Voxcommando is difficult,

I use a dual monitor setup and when I Power off my receiver it goes down to one monitor, so when I power the receiver back on, EG and VC are still located on Monitor one, but I need them on monitor 2, up until now I've been using Autohotkey to move them once the receiver powered on,

what makes it difficult is that VC's window name changes to match the previous voice command plus the confirmation percentage, so could we add a "Win.Find.ByName.RegEx" or something similar, so then to move VC we would use something like:

Code: [Select]
Win.Find.ByName.ReEx | {LastSpoken} \(.*?\) | WindowsForms10.Window.8.app.0.141b42a_r12_ad1

I think this could be used with other programs as well.


also I noticed that in the win plugin if I try to drag the gear icon for Process to an LCB window I get an error that says:

Quote
---------------------------

---------------------------
Invalid clipboard data:

System.Xml.XmlException: The 'cmdType' start tag on line 1 position 103 does not match the end tag of 'action'. Line 2, position 36.

   at System.Xml.XmlTextReaderImpl.Throw(Exception e)

   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)

   at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)

   at System.Xml.XmlTextReaderImpl.ParseEndElement()

   at System.Xml.XmlTextReaderImpl.ParseElementContent()

   at System.Xml.XmlTextReaderImpl.Read()

   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)

   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)

   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)

   at System.Xml.XmlDocument.Load(XmlReader reader)

   at System.Xml.XmlDocument.LoadXml(String xml)

   at System.Xml.XmlDocument.set_InnerXml(String value)

   at eval_d.eval_ᜀ(String A_0)

<?xml version="1.0" encoding="utf-16"?><command id="-1" name="WinDragAction find by process"><action><cmdType>Win.Find.ByProcess/cmdType><params><param>VoxCommando</param>

</params><cmdRepeat>1</cmdRepeat></action></command>


---------------------------
OK   
---------------------------


jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Retrieve window size
« Reply #7 on: July 05, 2016, 08:33:00 AM »

what makes it difficult is that VC's window name changes to match the previous voice command plus the confirmation percentage, so could we add a "Win.Find.ByName.RegEx" or something similar, so then to move VC we would use something like:


also I noticed that in the win plugin if I try to drag the gear icon for Process to an LCB window I get an error that says:

For moving VC use FindByProcess or FindByName with the class parameter and no name parameter.

Thanks for the bug report. My XML is missing a < symbol!

Windows does not allow us to search by partial window names so your idea is not so straightforward to implement. In order to do it we would need to get a list of all open windows and then search through them ourselves. This might be time consuming and also involves threading and callbacks etc. I'm considering options and still experimenting at this point.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Retrieve window size
« Reply #8 on: July 07, 2016, 02:42:02 AM »
FindByProcess works, as long as I don't execute it from the tree manually, if I do it moves the LCB window instead

a couple other ideas that might help, both of the ideas though would only help with Moving VC and not with other programs

1.) set the window name permanently, so its not changing with the previous command
    1.5) remove the confirmation percanantage from the window name (I.E. what time is it (82%) >to> what time is it)

2.) allow the user to set the window name in the options menu, could also be used by those running multiple VC's on the same system (easier to identify which VC is controlling what)

I know that doesn't get you any closer but maybe it will help spark some Ideas

I have some new commands to build using this plugin  8)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Retrieve window size
« Reply #9 on: July 08, 2016, 02:10:45 PM »
I suspect that many people don't know why the VC main window caption changes to show the last recognized voice command. This allows us to see what was recognized in the taskbar even if the VC window is minimized or hidden.

For this to work you must set your taskbar to combine when full or something like that.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Retrieve window size
« Reply #10 on: July 19, 2016, 07:00:42 PM »

what makes it difficult is that VC's window name changes to match the previous voice command plus the confirmation percentage, so could we add a "Win.Find.ByName.RegEx" or something similar, so then to move VC we would use something like:

Code: [Select]
Win.Find.ByName.ReEx | {LastSpoken} \(.*?\) | WindowsForms10.Window.8.app.0.141b42a_r12_ad1

I think this could be used with other programs as well.


VC 2.2.2.2 is out and includes updates to the Win plugin.  Among them is a better tool to identify windows and the ability to match window names or classes using RegEx.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Retrieve window size
« Reply #11 on: July 19, 2016, 11:47:36 PM »
Thanks for the new action  :hugs

here's a group I made using the new Win plugin, http://voxcommando.com/forum/index.php?topic=2614.0

I use the new Win.Find.BySearch action to help move VC when I Turn my TV and Receiver On, and it works like a Charm  ::banana