Reply to post: Re: @h4rmony and your comparison rules

Munich considers dumping Linux for ... GULP ... Windows!

h4rm0ny

Re: @h4rmony and your comparison rules

>>This is a lot of writing and looks pretty ugly. I'd prefer a much simpler syntax like this one:

I probably shouldn't indulge this. Your initial attack was to demand whether Outlook could be used by scripting. Having been told that it can and much more (it has a full OO API) you shift goal posts and say there's too much "writing" for your tastes. However, I can see where this road leads and it's not to a good place for your argument, so I'll allow you to shift the goal posts a little closer to the cliff if you wish.

Basically, you don't understand what is happening here. I'll illustrate the difference. Here's a short sample of a script that works with Outlook. It's creating and sending an email.

$ol = New-Object -comObject Outlook.Application

gm -InputObject $ol

$mail = $ol.Session.OpenSharedItem("C:\Test Email Subject.msg")

$mail.Forward()

$Mail.Recipients.Add("someone@example.com")

$Mail.Subject = "Test Mail"

$Mail.Body = " Here is some text"

$Mail.Send()

Here's what you prefer because you think it's shorter and simpler:

echo "Hello

Here's my message.... " | mutt -F ~/.mutt/one_of_myprofyles -s "Hi from me" someone@somewhere.something -a ~/Documents/attached.pdf

Firstly, the former isn't long - it's eight lines, one statement on each and anyone remotely competent should be able to handle that. ;)

The reason yours is short is because all you're doing is piping text to the Mutt program and using command line flags. The Outlook example is Object Oriented code that lets you instantiate an instance of Outlook, an instance of a mail object, perform operations on those instances and do pretty much anything you want with them, clone them, copy them, feed them as objects to other programs... It's vastly more powerful than piping text to Mutt on the command line. If you don't understand that, then you are not a programmer.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

SUBSCRIBE TO OUR WEEKLY TECH NEWSLETTER

Biting the hand that feeds IT © 1998–2019