Hi!
I'm creating a command group for Chrome (in fact I used the one that is posted in gems as a base).
I want to have a more consistent treatment as to launching the browser and making sure it is in focus before I start sending commands to it. So I've modified the launch command as below.
Instead of launching the default browser, which creates dependencies of external manual actions (ie I would need to manually set Chrome as my default browser), I wanted to launch the Chrome executable. But then I wanted to confirm it is opened before I go ahead sending the commands for it to browse to a web site.
I supposed the loop block would fit perfectly for my needs since I could keep looping until Chrome is in focus and then follow the remaining actions (check the commands attached for more details).
As per the wiki, loops blocks can't have logic blocks inside, so I thought I could have an event that would trigger a command that would set j variable to a value greater than the one set in the loop, hence breaking the loop block.
On my tests I can't get the above to work, probably because more than one characteristics of how the logic blocks have been designed. I'm not questioning this, or asking to change anything, but perhaps some of you guys can suggest a way of doing the consistency I'm trying to do.
So could you please take a look on that and eventually suggest something else that would achieve the same result?
Thanks in advance.
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.7-->
<command id="678" name="open url with payload" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<if ifBlockDisabled="False" ifNot="True">
<ifType>ProcessRunning</ifType>
<ifParams>chrome&&</ifParams>
<then>
<action>
<cmdType>Launch.RawParam</cmdType>
<params>
<param>{Path.PFx86}\Google\Chrome\Application\chrome.exe</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.SpeakSync</cmdType>
<params>
<param>Opening Chrome</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else />
</if>
<loop>
<loopParams>
<from>1</from>
<to>30</to>
</loopParams>
<loopActions>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>Waiting for Chrome: {j}/30 seconds</param>
<param>1000</param>
<param>1</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.Pause</cmdType>
<params>
<param>500</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Window.Focus</cmdType>
<params>
<param>chrome</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.Pause</cmdType>
<params>
<param>500</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</loopActions>
</loop>
<if ifBlockDisabled="False" ifNot="False">
<ifType>ProcessRunning</ifType>
<ifParams>chrome&&</ifParams>
<then>
<action>
<cmdType>Window.Focus</cmdType>
<params>
<param>chrome</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.Pause</cmdType>
<params>
<param>5</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>SendKeys</cmdType>
<params>
<param>^l</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>VC.Pause</cmdType>
<params>
<param>5</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>DxInput.Type</cmdType>
<params>
<param>{1}{RETURN}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>{1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>Browsing to {PF.1}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>I couldn't open Chrome</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>OSD.ShowText</cmdType>
<params>
<param>I couldn't open Chrome</param>
<param>2000</param>
<param>1</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<phrase>open site</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\url.xml</payloadFromXML>
</command>