At work our end-users are on Windows XP and using Outlook Express. Whenever a user composes an email or replies to one, Outlook Express “reads” a static html file located on c:\, and uses the content as a signature. This works perfectly fine.
Now my coworker gave me a simple text(.txt) file with 100+ lines, each line containing a “motivational quote”.
My objective is to somehow have a random quote extracted from this text file, and inserted into the static html-signature file.
Since I am limited to what XP natively supports and can’t install any additional software such as python, I assume either batch or vbscript would be the proper choice (if not only). I imagine a script which is executed via. the Windows Task Scheduler every 15 minutes or so, which randomly reads a line from the .txt-file, and updates it into the static html-signature file.
Is this possible in any way, or are neither batch nor vbscript capable of doing something like that?
Any help or advice will be GREATLY appreciated 🙂
You can create a signature template that has embedded variables that are replaced by delayed expansion. Any exclamation point
!or caret^literals must be encoded as variables as well:!QUOTE!= The random quote!X!= exclamation point literal!C!= caret literal (probably not needed)Additional variables could be added to the template as needed.
Here is a trivial HTML template as an example
The following batch file will select a random quote from the quote file and write out the signature file after replacing the variables in the template.
EDIT – I improved performance and slightly altered the limitations by using FOR /F to read the quote line instead of SET /P.
There are a few limitations to the script as written:
;will be skipped;