Author Topic: Close Browser after send URL  (Read 2177 times)

0 Members and 1 Guest are viewing this topic.

Foggy

  • $upporter
  • Contributor
  • *****
  • Posts: 86
  • Karma: 4
    • View Profile
Close Browser after send URL
« on: January 19, 2013, 12:53:39 PM »
Hi All,

I am trying to send a url that switches on my lights and then close the browser.

Switching on my lights works - but for the life of me I can't then close the browser.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="249" name="Lights On" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Launch.OpenURL</cmdType>
    <cmdString>http://192.168.0.112/lightwaverf.php?room=living&amp;device=socket&amp;state=on</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Window.Close</cmdType>
    <cmdString>firefox</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Enable Standing Light</phrase>
</command>

Can any one tell me what I am doing wrong.

Best wishes.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Close Browser after send URL
« Reply #1 on: January 19, 2013, 01:43:42 PM »
I suspect that you are trying to close the window before it has a chance to open.  I don't think the Launch command waits for the web page to load or anything like that, before moving on to the next action.

I suggest that you use the scrape command instead, so you won't need to worry about opening a browser at all, and it will be much faster.  Plus if you happen to be using firefox at the time you don't have to worry about firefox closing when you want to turn the lights on!

Try this:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="249" name="Lights On" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <cmdString>http://192.168.0.112/lightwaverf.php?room=living&amp;device=socket&amp;state=on</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Enable Standing Light</phrase>
</command>

Foggy

  • $upporter
  • Contributor
  • *****
  • Posts: 86
  • Karma: 4
    • View Profile
Re: Close Browser after send URL
« Reply #2 on: January 19, 2013, 02:03:52 PM »
Super - That works.

Appreciate your help.

Best wishes.

Etrust

  • Jr. Member
  • **
  • Posts: 45
  • Karma: 1
    • View Profile
Re: Close Browser after send URL
« Reply #3 on: November 14, 2014, 03:17:57 PM »
Hi Guys,

I am using the stable version 2.0.

I want to use this code from james. How can I use it exactly? I think I have to save as xml and change my url of course. But how to load this xml to a command exactly??

Please help! I am loving voxcommando and will buy this week after my tests.

Best regards

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Close Browser after send URL
« Reply #4 on: November 14, 2014, 03:44:56 PM »
Welcome eTrust.

Looks like you've missed a very important wiki page! http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum

Knowing how to copy and paste xml into your command tree will make the forum posts a lot more useful. :)
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)

Etrust

  • Jr. Member
  • **
  • Posts: 45
  • Karma: 1
    • View Profile
Re: Close Browser after send URL
« Reply #5 on: November 15, 2014, 06:29:54 AM »
oh yes thank you very much!!!