News:

HOT TIP! In the command editor, you can ctrl-click and drag an item to create a copy of it.

Main Menu

Help needed for javascript url.

Started by xtermin8r, April 23, 2013, 11:05:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xtermin8r

hi
i need some help, i want to copy a link from a web  page which is javascript:playSound('../Audios/L014/L014_017.mp3'); by using System.GetClipboardText and strip out  the filename L014_017.mp3, and get the OSD to display this filename using voxcommando ?

Thanks in advance.
Neural Net Based Artificial Intelligence.

jitterjames

Quote from: xtermin8r on April 23, 2013, 11:05:12 AM
hi
i need some help, i want to copy a link from a web  page which is javascript:playSound('../Audios/L014/L014_017.mp3'); by using System.GetClipboardText and strip out  the filename L014_017.mp3, and get the OSD to display this filename using voxcommando ?

Thanks in advance.

are you asking for help on how to use regex to pull "L014_017.mp3" from "javascript:playSound('../Audios/L014/L014_017.mp3');" ?

jitterjames

the best part of this (I think) is the command name I came up with  :biglaugh

<?xml version="1.0" encoding="utf-16"?>
<command id="684" name="regextermin8ter" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Results.SetLastResult</cmdType>
    <cmdString>javascript:playSound('../Audios/L014/L014_017.mp3');</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <cmdString>([^/]*?mp3)</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <cmdString>{Match.1}</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

jitterjames

the magic pattern is

([^/]*?mp3)

everything between the (  ) will be returned as a match.  the [^/] means match everything except '/'

and the *? means match as many characters as necessary.  Actually in this case just * will probably work.

xtermin8r

Thanks a million James, you are a star, will try it now.
Neural Net Based Artificial Intelligence.

jitterjames

Thank you!

Finding regex patterns is one of my favourite games!   ::wiggle

xtermin8r

#6
Thanks James works perfectly.  :clap

this is what i have done:

<?xml version="1.0" encoding="utf-16"?>
<command id="684" name="regextermin8r" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
 <action>
   <cmdType>System.GetClipboardText</cmdType>
   <cmdString />
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>Results.RegEx</cmdType>
   <cmdString>([^/]*?mp3)</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>OSD.ShowText</cmdType>
   <cmdString>{Match.1}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>Window.Focus</cmdType>
   <cmdString>wavepad</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>SendKeys</cmdType>
   <cmdString>+^(I)</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>VC.Pause</cmdType>
   <cmdString>2000</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>SendKeys</cmdType>
   <cmdString>{Match.1}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
</command>


The website and urls in question http://www.madinaharabic.com/Arabic_Language_Course/Lessons/L001_001.html
the software wavepad http://www.nch.com.au/wavepad/index.html

You and your program have simplified my life once again Thanks.        

name="regextermin8r"    nice  :biglaugh
Neural Net Based Artificial Intelligence.

xtermin8r

#7
hi everyone
Creating Arabic audio lessons with help from VoxCommando
the demo of the above method http://youtu.be/xTOPxYN4jyU
Neural Net Based Artificial Intelligence.