自动执行涉及Outlook和Excel的Windows任务的最佳语言是什么? [英] What's the best language to automate this Windows task involving Outlook and Excel?

查看:145
本文介绍了自动执行涉及Outlook和Excel的Windows任务的最佳语言是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要自动执行涉及到的特定任务:




  • 根据一组条件从邮箱中获取邮件 - 来自特定用户,具有特定的主题行模式等。


  • 分析每个邮件的邮件正文并提取一些内容(邮件几乎固定模式)


  • 创建具有特定模板的Excel工作表(前两行不变,第三行是本周的星期一和星期五等) 。)并将连续提取的上述内容粘贴到该表中。


  • 创建具有不同格式的相同内容的Outlook电子邮件


  • 附加上述Excel这张邮件的表格。



(最后发送,但我不想自动化那部分 - 我喜欢在发送邮件之前仔细检查一下。 )



现在,当我想到自动执行这个任务时,Perl的Win32 :: OLE最近刚刚知道了,而且Perl很满意Perl 。但是之后,我认为Visual Basic for Automation可能更适合该任务,因为它是为这些任务创建的语言。我的问题是,VBA是否能更好地抵消Perl和VB之间的技能差异?我在几岁前就是个VB6玩过的玩家,但这是VB体验的程度。



我也欢迎任何其他语言/平台的建议,只要他们允许一些灵活性,而不是太难学习。我也知道一些Python。



我查看了以及这个,但它们不相关,或没有任何好的答案。

解决方案

我问,答案大多是< a href =http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx =nofollow noreferrer> PowerShell 。这是一个链接,我发现自动化Outlook:使用PowerShell进行Outlook自动化

  $ outlook = new-object -com Outlook.Application 




查看您发送的前5封电子邮件的主题




  $ sentMail = $ outlook.Session.GetDefaultFolder(5)#== olFolderSentMail 
$ sentMail.Items |选择-first 5 TaskSubject

和Excel: PowerShell和Excel

  $ a = new-object  - comobject excel.application 




如何更改指定单元格的值?




  $ a.ActiveSheet.Range(B1)Value2 =y 


I need to automate a particular task that involves:

  • Fetching mails from my mailbox based on a set of criteria - from a particular user, has a particular pattern of subject line, etc.

  • Parsing the mail body of each mail and extracting some content (the mails have an almost fixed pattern)

  • Creating an Excel sheet with a particular template (the first two lines are constant, the third line is the Monday and Friday of this week, etc.) and paste the content extracted above into this sheet in successive lines.

  • Creating an Outlook email message with the same content in a different format

  • Attaching the above Excel sheet with this mail.

(Finally sending it, but I don't want to automate that part - I like to double check things before sending out mails.)

Now, when I thought of automating this task, Perl's Win32::OLE came to mind immediately since I'd learnt about it recently, and am very comfortable in Perl. But then, I thought Visual Basic for Automation might be more suited for the task, since it is a language created for such tasks.

My question is, is VBA better enough to offset the difference in my skillset between Perl and VB? I've played with VB6 when I was a kid years ago, but that's about the extent of my VB experience.

I'm open to any other language/platform suggestions as well, provided they allow some flexibility and aren't too difficult to learn. I know some Python as well.

I looked at this and also this, this, this and this, but they either are not relevant, or do not have any good answers.

解决方案

I asked Best "official" scripting language for Windows programmers, and the answer was mostly PowerShell. Here's a link I found automating Outlook: using PowerShell for Outlook automation.

$outlook = new-object -com Outlook.Application

Look at the subjects of the first 5 emails you sent

$sentMail = $outlook.Session.GetDefaultFolder(5) # == olFolderSentMail 
$sentMail.Items | select -first 5 TaskSubject    

And Excel: PowerShell and Excel.

$a = new-object -comobject excel.application

How do I change the value of a specified cell?

$a.ActiveSheet.Range("B1").Value2 = "y"

这篇关于自动执行涉及Outlook和Excel的Windows任务的最佳语言是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆