Solved

Batch file to print a folder of Outlook Express messages

Posted on 2011-02-14
11
1,181 Views
Last Modified: 2012-05-11
I need to print a folder-full of Outlook Express (.eml) messages as part of an auditing application.  I can look at the messages using the following batch file:

@echo off
for %%X in (.\MailX\ReviewSample\*.eml) do "C:\Program Files\Outlook Express\msimn.exe " /eml:%%X

But how I can I just print them?  Also, does anyone know where I can find the complete list of command line options for Outlook Express?

Thanks, Experts.
0
Comment
Question by:avhfj
  • 3
  • 3
  • 2
  • +1
11 Comments
 
LVL 8

Expert Comment

by:point_pleasant
ID: 34906970
/p mesgfilename will print

see

http://office.microsoft.com/en-us/outlook-help/command-line-switches-HP001003110.aspx

for all command line switches
0
 

Author Comment

by:avhfj
ID: 34907259
Thanks for the reply, point pleasant.  That page is for Outlook, though, not for Outlook Express.  I tried your suggestion with Oulook Express, just in case (C:\Program Files\Outlook Express\msimn.exe /p [messagefilename]), but it didn't work.  

If anyone knows the link to the exact same information for Outlook Express, that's what I'm after.

Thanks again,  . . .  avhfj
0
 
LVL 38

Assisted Solution

by:BillDL
BillDL earned 166 total points
ID: 34907575
point_pleasant.
avhfj is asking about Outlook EXPRESS in Windows XP, not Microsoft Office Outlook.

Outlook Express (msimn.exe) actually only supports 3 command line options, and none are of any use to avhfj:
http://support.microsoft.com/kb/177233

msimn.exe /outnews
msimn.exe /newsonly
Starts OE in News Reader Only mode. You cannot send or receive e-mail, and the Mail tab in the Internet Accounts dialog box is missing.

msimn.exe /mailonly
Starts OE in Mail Only mode.  You cannot view newsgroups, and the News tab in the Internet Accounts dialog box is missing.

Outlook Express was never written to allow command line usage.  msimn.exe does not support the /p (print) switch.  I have tried every permutation possible in the past to do this, and it does not work.  The /p switch only usually works where a file extension is registered with a shell/print/command.  The *.eml file type does not have this registered.

The nearest you will get to automating it is to try messing around with a VBScript that uses the "SendKeys" function to simulate "accelerator key" presses, but the hard thing is bringing the window back into focus each time so that the simulated keypress is sent to that and not some other window that pops up to interfere with the process.

There are utilities that allow you to walk through the steps you would be performing on a repeating basis, build up a macro-based script as you go, and compile it into an executable, for example AutoIT:
http://www.autoitscript.com/site/autoit/

Often these use the "WindowTitle" to determine the item to be brought into focus and have the script actions applied to it, but the "Window Title" is different in each opened message and I don't think you could use that.  Even the Window Class Name of "ATH_NOTE" cannot be relied upon, because that applies to the "Compose Message" windows also, so this utility would fail:
http://nathanaeljones.com/products/quickkey/keystroke-emulation-in-quick-key/
It gets very complicated tracking Handles and Child Handles to try and get this kind of thing done in a scripted way.

I am not a programmer though, and perhaps an expert in this field will be able to devise a VBScript or similar to do what is needed.
0
 
LVL 8

Accepted Solution

by:
point_pleasant earned 167 total points
ID: 34908161
could yoou import them into outlook and then print?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 38

Expert Comment

by:BillDL
ID: 34908167
Just thinking out lod here.

Ctrl + P works to print to the default printer after an *.eml file is opened (as long as the window is in focus), so in theory it's just a case of then finding a way to make sure the window stays active while it is sent the code for Ctrl + P with SendKeys:

WshShell.SendKeys "^P"   (have to check the syntax though)

http://ss64.com/vb/sendkeys.html
http://www.devguru.com/technologies/wsh/quickref/wshshell_SendKeys.html

Here's something that MIGHT just work.  Check and see if the text in the Title Bar of the window matches the file name of the *.eml file that opens with your command.  I am sure that it won't, because it normally applies the subject line of the email message as it would show in Outlook Express, rather than the file name of a saved *.eml file as it shows in Windows Explorer.  I believe that I am correct in guessing that the file name might be truncated, and special characters being converted to underscores, depending on how the eml files were actually saved out from OE, so there's yet another potential complication.

If your file names were saved out in such a way that they are named the same as the subject lines, then it MAY be possible to actually use the file name, with a workaround for underscores replacing reserved characters, of the eml file and use that as the Window Title to apply the focus to for a Ctrl + P keystoke to be sent to it.

If not, then it may be possible to search the eml file, find the "Subject:" line, and store that as a variable for re-use in a VBScript. The only issue I see with this is that, opened in Notepad, the "Subject:" line in some of my saved eml files break over onto a 2nd line and trying to grab the complete subject line would fail.

I think you will agree that the SendKeys concept is beginning to look a bit flawed, but check the file names vs subject lines anyway and let us know.
0
 
LVL 3

Assisted Solution

by:sam0x01
sam0x01 earned 167 total points
ID: 34923045
If you have access to MS Outlook, perhaps an alternative (and easier) way would be to

Script exporting the Outlook Express to a PST file (a lot easier with SendKeys or AutoIT)
Copy the PST file (ideally to a central location, suggest using the Computername env variable in the name)
Work out a script to import PST into Outlook. print and remove PST from Outlook


0
 

Author Comment

by:avhfj
ID: 34926785
point pleasnt, billDL and sam0x01:  I am very grateful for your suggestions.  I am going to fo with a combination of your ideas, so, if you have no objection, will split the point between you:
I'll convert the .eml files to .pst using a batch convert program, such as at http://www.emltopst.com/.
 I'll use the Outlook command line option suggested to print the files.

The reason I haven't tried Outlook before is because I am unlucky/unskillful at installing new applications.  The idea of installing Outlook just for this little (though important for my employers) just for this little task seemed unattractive, but your comments have made me realized I have to bite the bullet.

By the way, point pleasant, the Outlook Express command lines  set out in MS Article ID: 177233 CANNOT be the only command line options for OE.  There is at least one more: the option I found (in a very old message on another help site) to view .eml files:
 
msimn.exe " /eml:[filename]

Thanks again everyone,  . . .  avhfj

 
0
 

Author Comment

by:avhfj
ID: 34929643
Text of my email to Customer Service:

Question ID 26821144  Oops!

Dear Customer Service:

I had three experts, point pleasnt, billDL and sam0x01, respond to my question, all of whom were very helpful.  I meant to divide the 500 points I offered in equal  shares (less rounding) among the three of them, but managed to  award two shares to billDL and none to point pleasant.  Is there a way to correct this?  

Thanks, . . .   avhfj.

Sorry, point pleaseant :-)

0
 
LVL 38

Expert Comment

by:BillDL
ID: 34932482
Thank you avhfj
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
Microsoft Outlook provides an easy way to recover permanently deleted items. When you empty the Deleted Items or simply deleted an Outlook data items using shift+Del key then it can be recovered using Registry Key settings.  Caution- Wrong Registry…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now