WTF is wrong with my RTF?
August 9, 2010 5:25 PM   Subscribe

I am having trouble editing an RTF file by using a Windows Batch file. Any batch or RTF guru's out there?

I am trying to automate the process of creating standardized outlook signature files for our company with a batch file. In the batch, I am collecting the users name, title, phone, location, and whether or not they interface with customers, and then generating three standardized signature files, htm, rtf, and txt. The htm and txt are working perfectly. the RTF is looking almost perfect, but it adds 3 extra spaces to the beginning of the first line. The actual text of the RTF looks correct when viewed through Notepad, and it even looks the same when compared to a file created in wordpad ...yet somehow wordpad is interpereting them differently and displaying 3 extra spaces. Any thoughts?

Working RTF File text:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}{\f1\fswiss\fcharset0 Arial;}}
{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;}
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\b\f0\fs20 My Name\b0 | My Title | \b Company\b0\par
123.123.1234 | www.mycompany.com\par
\b Mission Statement:\b0 \cf1 To be the best at what we do.\cf2\par
\b Thanks for making My Company a part of your life!\cf0\b0\f1\par
}

File with extra 3 spaces at the start:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}{\f1\fswiss\fcharset0 Arial;}}
{\colortbl ;\red255\green0\blue0;}
{\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\b\f0\fs20 My Name\b0 | My Title | \b My Company\b0\par
123.123.1234 | www.mycompany.com\par
\b Mission Statement:\b0 \cf1 To be the best at what we do.\cf0\f1\par
}

(The second one is missing the last line, but that's because the second example is not cusomer facing)


Also, I have no Ariel font in my file, yet there is a reference to it in the RTF files...I assume this is because it is the default font in the file. Any way to remove it?

So...does anyone have any thoughts why those extra spaces show up?

Any links to RTF file syntax I could peruse?
Thanks for the help! :)
posted by AltReality to Computers & Internet (4 answers total)
 
Response by poster: Yay for wasted AskMi questions! I figured it out a few minutes after posting..I had extra spaces in the batch file lines that created the lines for the RTF files. Good Times.

Thanks for looking!
posted by AltReality at 5:58 PM on August 9, 2010


Best answer: Every line has a whitespace at the end, except this one, which has two:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}{\f1\fswiss\fcharset0 Arial;}}
(I had to read the HTML source to tell this, but it did get translated into spaces before metafilter added the <br>

I think I know what's going on: CMD echo is super super literal.
echo some stuff >> sig.rtf
     ^^^^^^^^^^^
will echo everything until the >, including spaces. Change it to
echo some stuff>> sig.rtf
(notice that there is no space between the end of the string and the redirection operator? that's the important part).
posted by aubilenon at 6:10 PM on August 9, 2010


Oops I'm too slow!
posted by aubilenon at 6:11 PM on August 9, 2010


Response by poster: Thanks aubilenon! :)
posted by AltReality at 9:20 PM on August 9, 2010


« Older To make a man happy...   |   Two for the Road? Newer »
This thread is closed to new comments.