{"id":162,"date":"2006-09-06T17:28:14","date_gmt":"2006-09-06T22:28:14","guid":{"rendered":"http:\/\/www.juixe.com\/techknow\/index.php\/2006\/09\/06\/outlook-fun-with-scriptom\/"},"modified":"2006-09-06T17:28:14","modified_gmt":"2006-09-06T22:28:14","slug":"outlook-fun-with-scriptom","status":"publish","type":"post","link":"http:\/\/juixe.com\/techknow\/index.php\/2006\/09\/06\/outlook-fun-with-scriptom\/","title":{"rendered":"Outlook Fun With Scriptom"},"content":{"rendered":"<p>It is soo true that if you work for a startup you end up wearing multiple hats.  I work for a very small startup and I wear more hats that the Queen of England.  One of those hats is of a Visual Basic developer.  Most business applications are not fancy or web two point ooh-y, they usually involve some charts, some graphs, and some integration with <b>Microsoft Office<\/b> products.<\/p>\n<p>As most script kiddies know, with a little Visual Basic code you can write scripts to open, write, and send emails, generate excel documents, print word documents, and so much more.  Fore example, here is a little bit of vbs code to automate the send button (now if you can automate running the script):<\/p>\n<p>[source:vbs]<br \/>\nSet objOutlook = CreateObject(&#8220;Outlook.Application&#8221;)<br \/>\nSet objNamespace = objOutlook.GetNamespace(&#8220;MAPI&#8221;)<\/p>\n<p>&#8216; Need to have open a new email window for the following<br \/>\nSet objInspector = objOutlook.ActiveInspector<br \/>\nSet objMailItem = objInspector.CurrentItem<\/p>\n<p>&#8216; Send the email, after the user presses the okay<br \/>\n&#8216; button on the confirmation dialog<br \/>\nobjMailItem.Send<br \/>\n[\/source]<\/p>\n<p>Now, if you want to pop up a message dialog with the subject of the last email you received, just run the following lines of code:<\/p>\n<p>[source:vbs]<br \/>\nConst olFolderInbox = 6<br \/>\nConst olFolderSentMail = 5<\/p>\n<p>Set objOutlook = CreateObject(&#8220;Outlook.Application&#8221;)<br \/>\nSet objNamespace = objOutlook.GetNamespace(&#8220;MAPI&#8221;)<\/p>\n<p>Set objFolder = objNamespace.GetDefaultFolder(olFolderSentMail)<br \/>\nMsgBox &#8220;Subject: &#8221; &#038; objFolder.Items.GetLast.Subject<br \/>\n[\/source]<\/p>\n<p>I have a few more example of Visual Basic code manipulating Microsoft Office products <a href=\"http:\/\/www.juixe.com\/techknow\/index.php\/category\/techknow\/visual-basic\/\">here<\/a>.  If you want to run similar COM code but in Java you can do so using <b>Groovy<\/b> and <b>Scriptom<\/b>.  I have already mentioned Scriptom before so I will refer you to that <a href=\"http:\/\/www.juixe.com\/techknow\/index.php\/2006\/08\/08\/com-scripting-with-groovy\/\">post<\/a>.<\/p>\n<p>Technorati Tags: <a href=\"http:\/\/technorati.com\/tag\/scriptom\" rel=\"tag\">scriptom<\/a>, <a href=\"http:\/\/technorati.com\/tag\/groovy\" rel=\"tag\"> groovy<\/a>, <a href=\"http:\/\/technorati.com\/tag\/java\" rel=\"tag\"> java<\/a>, <a href=\"http:\/\/technorati.com\/tag\/com\" rel=\"tag\"> com<\/a>, <a href=\"http:\/\/technorati.com\/tag\/visual+basic\" rel=\"tag\"> visual basic<\/a>, <a href=\"http:\/\/technorati.com\/tag\/outlook\" rel=\"tag\"> outlook<\/a>, <a href=\"http:\/\/technorati.com\/tag\/scripts\" rel=\"tag\"> scripts<\/a>, <a href=\"http:\/\/technorati.com\/tag\/visual+basic+script\" rel=\"tag\"> visual basic script<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is soo true that if you work for a startup you end up wearing multiple hats. I work for a very small startup and I wear more hats that the Queen of England. One of those hats is of a Visual Basic developer. Most business applications are not fancy or web two point ooh-y, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[15,3,5],"tags":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p902K-2C","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/162"}],"collection":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/comments?post=162"}],"version-history":[{"count":0,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/posts\/162\/revisions"}],"wp:attachment":[{"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/media?parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/categories?post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/juixe.com\/techknow\/index.php\/wp-json\/wp\/v2\/tags?post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}