[AccessD] OT: HTPC Command Line Parsing Problem

Robert robert at servicexp.com
Fri Mar 18 18:33:58 CDT 2011


Ok, I have been fighting with this for a while now, and just can't seem to
come up with a solution

Enviroment:
  Windows Command Line Batch Process

Back Ground:
 My WMC7 HTPC records shows to a folder, from there I have a program called
WatchDirectory trigger a batch file for show processing. The batch file
logic looks in a SHOWPARMS.txt text file for the show name, and returns to
the batch file it's processing parameters. I have the basic framework up and
running.

Inside SHOWPARMS.txt Example:
Glenn;True;"";"C:\VideoCaptures\GlennBeck";False;"";False;False
 
Returns: 
True;"";"C:\VideoCaptures\GlennBeck";False;"";False;False

Batch File Commands So Far:
set SEARCHNAME=%WD_FILE_B:~0,4% :find from left to right the row that
matches the first 4 characters

:: Get the Show Params
for /f "tokens=2-9 delims=;" %%A in ('findstr /b /i "%SEARCHNAME%"
"C:\SyncFiles\Bat Files\SHOWPARMS.txt"') do ( 

set sQSF=%%A
set sCOM=%%B
set sPAT=%%C
set sRAR=%%D
set sUPL=%%E
set sSFV=%%F
set sDEL=%%G

)

Problem:
 I need to parse the string backwards from the first "-" (I think). So if a
show name is less the 4 characters the batch would still find it in the text
file. 

So code would not only find this string using "Glen" or "Glenn" In "Glenn
Beck-" or "GlennBeck-" (Which currently works) but would also need to find
"V" in "V-" (currently the show would be missed due to the < 4 characters
show name.)

Then "-" after the show name is always there.


Objective:
  To make the search string length variable (I think), and not based on the
current limited 4 character requirement. To find the "-" after the show name
and match as many characters as possible. (I think). ;)


Any ideas how I can pull this off?





More information about the AccessD mailing list