Thanks, wowbagger, for this useful script. One example — many internet receipts are emails, to be "saved as . . ." and stored for reference at tax time (which has just come up, sigh), so toggling these columns on and off is a great help. Four comments:
MSG FILES: I have long given up on .eml files because of their file-date problem, and I now save any required emails as .msg files (which are essentially the same thing). I therefore replaced line 61 by:
if (!scriptColData.item.is_dir && (scriptColData.item.ext.toLowerCase() == ".eml" || scriptColData.item.ext.toLowerCase() == ".msg")) {
and the script now picks up the column information for .msg files as well as for .eml files. So I'm happy!
DATES: The dates come out awkwardly as "Mon, 1 Jun 2015 09:19:32 +1000", rather than the shorter "01/06/15 09:20", but I don't understand the JScript date object well enough to get the date into a copy of the JScript date object so that the output can be massaged into the more convenient form. Some further editing here would be very useful.
A BUTTON: Here is a button that toggles the four columns on and off (the four lines can easily be written as one line):
Set ColumnsToggle="scp:EmlEmailColumns/Date"
Set ColumnsToggle="scp:EmlEmailColumns/ToAddres(*,200)"
Set ColumnsToggle="scp:EmlEmailColumns/Subject(*,200)"
Set ColumnsToggle="scp:EmlEmailColumns/FromAddress(*,200)"
The reason that I have omitted any custom width on the first line is that if I change it to
Set ColumnsToggle="scp:EmlEmailColumns/Date(*,200)"
then the "Date" column is replaced by a column containing the file extensions and headed "CS1". This strange column comes from the script "Custom Sort Column", which happens to lie immediately above your script in my list at "Preferences - - > Toolbars - - > Scripts" — this may indicate that some sort of curious bug is causing this problem. (When the order of the lines in the button is changed, the "Date" column is still consistently replaced by the "CS1" column.) If the date were rewritten as "01/06/15 09:20", there would be no problem.
IS LINE 9 A TYPO: Should "ToAddres" be "ToAddress"? There are no other mentions of "ToAddres", so I tried changing it to "To Address" (in the script and in the button). But when I do that, the "To Address" and "From Address" columns either fail to appear, or are replaced by two identical "From Address" columns. Could some sort of bug causing this behaviour?