<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Random Stuff About Software &#187; Scripts</title>
	<atom:link href="http://patricksheedy.net/softwareblog/category/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://patricksheedy.net/softwareblog</link>
	<description>Tips that might be useful</description>
	<lastBuildDate>Tue, 05 May 2009 03:56:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Outlook Automation Error When Connecting From Elevated Prompt</title>
		<link>http://patricksheedy.net/softwareblog/2008/01/16/outlook-automation-error-when-connecting-from-elevated-prompt/</link>
		<comments>http://patricksheedy.net/softwareblog/2008/01/16/outlook-automation-error-when-connecting-from-elevated-prompt/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 05:50:40 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[JScript]]></category>
		<category><![CDATA[Outlook]]></category>
		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://patricksheedy.net/softwareblog/2008/01/16/outlook-automation-error-when-connecting-from-elevated-prompt/</guid>
		<description><![CDATA[One thing I didn&#8217;t realize until the other day is that a Vista command prompt that is elevated is unable to control Outlook. I was testing some JScript code from an elevated prompt and got this error:

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Users\psheed\SendMail.js(1, 1) Microsoft JScript runtime error: Automation [...]]]></description>
			<content:encoded><![CDATA[<p>One thing I didn&#8217;t realize until the other day is that a Vista command prompt that is elevated is unable to control Outlook. I was testing some JScript code from an elevated prompt and got this error:<br />
<code><br />
Microsoft (R) Windows Script Host Version 5.7<br />
Copyright (C) Microsoft Corporation. All rights reserved.<br />
C:\Users\psheed\SendMail.js(1, 1) Microsoft JScript runtime error: Automation server can't create object</code></p>
<p>Unfortunately the error message isn&#8217;t very helpful in diagnosing the problem. After trying a few things I eventually found out that the script would work fine if it was running from a non-elevated prompt. Now it makes sense, you can&#8217;t use code that is running elevated to control non-elevated code for security reasons.</p>
]]></content:encoded>
			<wfw:commentRss>http://patricksheedy.net/softwareblog/2008/01/16/outlook-automation-error-when-connecting-from-elevated-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automate the creation of an Outlook message with JScript</title>
		<link>http://patricksheedy.net/softwareblog/2007/12/26/automate-the-creation-of-an-outlook-message-with-jscript/</link>
		<comments>http://patricksheedy.net/softwareblog/2007/12/26/automate-the-creation-of-an-outlook-message-with-jscript/#comments</comments>
		<pubDate>Wed, 26 Dec 2007 21:59:40 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[JScript]]></category>
		<category><![CDATA[Outlook]]></category>

		<guid isPermaLink="false">http://patricksheedy.net/softwareblog/2007/12/26/automate-the-creation-of-an-outlook-message-with-jscript/</guid>
		<description><![CDATA[Every so often I need a way to automatically create an Outlook email message. I could create a C# application to do this but that is usually overkill and takes too much time to maintain the source and executable. Instead I create a simple JScript file that creates the Outlook message and populates it with [...]]]></description>
			<content:encoded><![CDATA[<p>Every so often I need a way to automatically create an Outlook email message. I could create a C# application to do this but that is usually overkill and takes too much time to maintain the source and executable. Instead I create a simple JScript file that creates the Outlook message and populates it with the necessary information.</p>
<p>To do this create a new file named CreateMessage.js. Paste the code below into the file. Save the file and then at the command line run this command: &#8220;cscript CreateMessage.js&#8221;. Confirm the Outlook dialog that you want to do this and the new message will appear.</p>
<pre>
var outlookApp = new ActiveXObject("Outlook.Application");
var outlookNamespace =
	     outlookApp.GetNameSpace("MAPI").CurrentUser;
var mailItem = outlookApp.CreateItem(0);

var olTo = 1;
var olCC = 2;
var recipient = mailItem.Recipients.Add ("User1");
recipient.Type = olTo;
var recipient = mailItem.Recipients.Add ("User2");
recipient.Type = olCC;

mailItem.Subject = "Test Subject";
mailItem.HTMLBody = "Test Body";
mailItem.Display();
outlookNamespace.Logoff;</pre>
]]></content:encoded>
			<wfw:commentRss>http://patricksheedy.net/softwareblog/2007/12/26/automate-the-creation-of-an-outlook-message-with-jscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
