<?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>Energy Aware &#187; dssw</title>
	<atom:link href="http://www.dssw.co.uk/blog/tag/dssw/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dssw.co.uk/blog</link>
	<description>An insight into DssW, energy saving, and business</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:08:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Launch an Application When Switching to Mains Power</title>
		<link>http://www.dssw.co.uk/blog/2011/07/28/how-to-launch-an-application-when-switching-to-mains-power/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-launch-an-application-when-switching-to-mains-power</link>
		<comments>http://www.dssw.co.uk/blog/2011/07/28/how-to-launch-an-application-when-switching-to-mains-power/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 01:21:27 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[PM4]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[Recipe]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[mains power]]></category>
		<category><![CDATA[recipe]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=1290</guid>
		<description><![CDATA[You can use Power Manager to automatically launch an application when switching from battery to mains power. <a href="http://www.dssw.co.uk/blog/2011/07/28/how-to-launch-an-application-when-switching-to-mains-power/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>You can use <a href="http://www.dssw.co.uk/powermanager/standard/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager</a> to automatically launch an application when switching from battery to mains power.</p>
<p>Being able to trigger applications, scripts, and tasks when switching from battery to mains power is useful. Imagine plugging your Mac back into the mains power and for the computer to automatically starting backing up and checking for software updates.</p>
<p>We have previously shown <a href="http://www.dssw.co.uk/blog/2011/02/11/how-to-run-an-applescript-when-switching-to-mains-power/">how to run a command when switching from mains to battery power</a>. Today we will create an event to perform a task when going the other way, from battery to mains power.</p>
<p><iframe src="http://www.youtube.com/embed/sCkOTBHTxA0?rel=0" frameborder="0" width="618" height="352"></iframe></p>
<p><span id="more-1290"></span></p>
<h3>Create a Power Adapter Triggered Application Launch Event</h3>
<ol>
<li>Launch <strong>System Preferences</strong> and select <strong>Power Manager</strong>.</li>
<li>Click <strong>Add…</strong>to create a new event.
<p><div id="attachment_1291" class="wp-caption aligncenter" style="width: 628px"><img class="size-full wp-image-1291" title="Click Add to begin creating a new Power Manager event" src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/07/1-power-manager-empty-schedule2.jpg" alt="Click Add to begin creating a new Power Manager event" width="618" height="410" /><p class="wp-caption-text">Click Add to begin creating a new Power Manager event</p></div></li>
<li>Choose the template <strong>Launch an application on mains power</strong>.
<p><div id="attachment_1292" class="wp-caption aligncenter" style="width: 628px"><img class="size-full wp-image-1292" title="Select the Launch an application on mains power task" src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/07/2-power-manager-select-launch-application-on-mains.jpg" alt="Select the Launch an application on mains power task" width="618" height="457" /><p class="wp-caption-text">Select the Launch an application on mains power task</p></div></li>
<li>Click <strong>Continue</strong> to the <strong>Launch</strong> step.</li>
<li>Choose the application to launch. You can choose an application to launch, or a document to open.
<p><div id="attachment_1293" class="wp-caption aligncenter" style="width: 628px"><img class="size-full wp-image-1293" title="Choose the application to launch" src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/07/3-power-manager-choose-an-application.jpg" alt="Choose the application to launch" width="618" height="457" /><p class="wp-caption-text">Choose the application to launch</p></div></li>
<li><strong>Continue</strong> through the remaining steps until your event is created.
<div id="attachment_1294" class="wp-caption aligncenter" style="width: 628px"><img class="size-full wp-image-1294" title="Continue passed the Constraints step" src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/07/4-power-manager-constraints1.jpg" alt="Continue passed the Constraints step" width="618" height="457" /><p class="wp-caption-text">Continue passed the Constraints step</p></div>
<div id="attachment_1295" class="wp-caption aligncenter" style="width: 628px"><img class="size-full wp-image-1295" title="Document your new event in the Why step" src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/07/5-power-manager-why2.jpg" alt="Document your new event in the Why step" width="618" height="457" /><p class="wp-caption-text">Document your new event in the Why step</p></div>
<p><div id="attachment_1296" class="wp-caption aligncenter" style="width: 628px"><img class="size-full wp-image-1296" title="Confirm your new Power Manager event should be created" src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/07/6-power-manager-confirm1.jpg" alt="Confirm your new Power Manager event should be created" width="618" height="457" /><p class="wp-caption-text">Confirm your new Power Manager event should be created</p></div></li>
</ol>
<div id="attachment_1297" class="wp-caption aligncenter" style="width: 628px"><img class="size-full wp-image-1297" title="Power Manager will now launch an application when your Mac switches to mains power" src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/07/7-power-manager-launch-on-mains-scheduled.jpg" alt="Power Manager will now launch an application when your Mac switches to mains power" width="618" height="410" /><p class="wp-caption-text">Power Manager will now launch an application when your Mac switches to mains power</p></div>
<p>Having followed the above steps, your event is scheduled and ready to perform. Try disconnecting and reconnecting your laptop mains power. A moment after reconnecting, your Mac will automatically launch your choosen application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2011/07/28/how-to-launch-an-application-when-switching-to-mains-power/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Run an AppleScript On Wake Up</title>
		<link>http://www.dssw.co.uk/blog/2011/02/01/how-to-run-an-applescript-on-wake-up/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-run-an-applescript-on-wake-up</link>
		<comments>http://www.dssw.co.uk/blog/2011/02/01/how-to-run-an-applescript-on-wake-up/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 04:25:34 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[PM4]]></category>
		<category><![CDATA[PMPRO4]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[Recipe]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[power on]]></category>
		<category><![CDATA[recipe]]></category>
		<category><![CDATA[wake up]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=972</guid>
		<description><![CDATA[You can use Power Manager to run an AppleScript when you wake up your Mac. Running an AppleScript when your Mac wakes up can be used to automate repetitive configuration tasks, such as mounting disks, or establishing a connection to a particular wireless network. <a href="http://www.dssw.co.uk/blog/2011/02/01/how-to-run-an-applescript-on-wake-up/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>You can use <a href="http://www.dssw.co.uk/powermanager/standard/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager</a> to run an AppleScript when you wake up your Mac.</p>
<p>Running an AppleScript when your Mac wakes up can be used to automate repetitive configuration tasks, such as mounting disks, or establishing a connection to a particular wireless network.</p>
<p>We are going to use Power Manager&#8217;s <a href="http://dssw.co.uk/powermanager/guide/v4/developer/pme.structure.triggerpoweron.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">trigger power on</a>. This trigger fires whenever your Mac powers on from being asleep or from hibernation. This means you can use this event with MacBooks that are set to <a href="http://support.apple.com/kb/TA27091">deep sleep</a>. This trigger provides consistent behaviour when waking from sleep and deep sleep.<span id="more-972"></span></p>
<h3>Create the Wake Triggered Event</h3>
<ol>
<li>Launch AppleScript Editor: <strong>Applications</strong> &gt; <strong>Utilities</strong> &gt; <strong>AppleScript Editor</strong>.</li>
<li>Copy and paste the following AppleScript into a new document:
<pre class="applescript">set myPathToTheApplicationToRun to "/Users/Shared/MyScript.app"

tell application "/Library/Application Support/Power Manager/Agents/Power Manager Scripting.app"

	tell workshop

		set myEvent to make new event with properties {trigger ID:"myWakeEvent", name:"Run AppleScript on wake up"}

		-- Add the on-demand behaviour to aid testing
		set behaviours of myEvent to [can perform on demand]

		-- Create a power on trigger
		make new trigger power on at front of triggers of myEvent

		-- Create an launch application action
		set myApplication to make new application description with properties {path:myPathToTheApplicationToRun}
		set myAction to make new action launch application at front of actions of myEvent with properties {application description:myApplication}

		-- Add a slight delay before launching the application
		make new action await relative date at front of actions of myEvent with properties {seconds:3, quiet:yes}

	end tell

	-- Deploy the event
	tell Event Store to store these events myEvent

	-- Clean up
	tell the workshop to empty

end tell</pre>
<p><div id="attachment_973" class="wp-caption aligncenter" style="width: 547px"><img class="size-full wp-image-973" title="An AppleScript for creating a wake trigger event in Power Manager." src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/02/1-power-manager-applescript-editor-wake-event.jpg" alt="An AppleScript for creating a wake trigger event in Power Manager." width="537" height="601" /><p class="wp-caption-text">An AppleScript for creating a wake trigger event in Power Manager.</p></div></li>
<li>Save the script: <strong>File</strong> &gt; <strong>Save</strong>.</li>
<li>Run the script: <strong>Script</strong> &gt; <strong>Run</strong>.</li>
</ol>
<p>When run, this AppleScript will create a new event in Power Manager. The event will contain one trigger and two actions.</p>
<p>When your Mac powers on, the trigger will fire. The event will start performing its actions. The first action asks the event to wait three seconds. This time is needed to ensure your Mac is fully woken up and ready to launch new applications.</p>
<p>After three seconds, the second action is performed. It is this action that launches the application. By default your application will be launched as the front most user. If no-one is logged in, the application can not be launched and nothing will happen.</p>
<p>The action launches the application stored at <strong>/Users/Shared/MyScript.app</strong>. For this event, you should save your AppleScript as an application in this location.</p>
<p>If you need to run a process regardless of whether a user is logged in, consider using a shell script and Power Manager&#8217;s <a href="http://dssw.co.uk/powermanager/guide/v4/developer/pme.structure.actionexecuteexternal.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">action execute external</a>.</p>
<div id="attachment_974" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-974" title="A schedule wake event in Power Manager's System Preference." src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/02/2-power-manager-mac-system-preference.jpg" alt="A schedule wake event in Power Manager's System Preference." width="593" height="384" /><p class="wp-caption-text">A schedule wake event in Power Manager&#39;s System Preference.</p></div>
<p>Once the above AppleScript is run, the event will be created and scheduled. Thanks to the on-demand behaviour, you can test this event without needing to put your Mac to sleep. Test this event manually by using the system menu bar or your using <a href="http://www.dssw.co.uk/powermanager/remote/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager Remote</a> as a trigger.</p>
<p>For the curious, you may like to see what happens when you set the <a href="http://dssw.co.uk/powermanager/guide/v4/developer/pme.structure.actionawaitrelativedate.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">await relative date</a>&#8216;s quiet property to no.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2011/02/01/how-to-run-an-applescript-on-wake-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Power Manager 4.0.4 and Power Manager Professional 4.0.4 Released</title>
		<link>http://www.dssw.co.uk/blog/2011/02/01/power-manager-4-0-4-and-power-manager-professional-4-0-4-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=power-manager-4-0-4-and-power-manager-professional-4-0-4-released</link>
		<comments>http://www.dssw.co.uk/blog/2011/02/01/power-manager-4-0-4-and-power-manager-professional-4-0-4-released/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 01:41:03 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[PM4]]></category>
		<category><![CDATA[PMPRO4]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[Power Manager Professional]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=964</guid>
		<description><![CDATA[Power Manager 4.0.4 and Power Manager Professional 4.0.4 are now available. These updates include a critical bug fix and minor localisation improvements. As always, we recommend all users to upgrade. Changes Since v4.0.3 Bug: Fixed launch application action bug that &#8230; <a href="http://www.dssw.co.uk/blog/2011/02/01/power-manager-4-0-4-and-power-manager-professional-4-0-4-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.dssw.co.uk/powermanager/standard/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=pm404">Power Manager</a> 4.0.4 and <a href="http://www.dssw.co.uk/powermanager/professional/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=pm404">Power Manager Professional</a> 4.0.4 are now available. These updates include a critical bug fix and minor localisation improvements. As always, we recommend all users to upgrade.</p>
<div id="attachment_597" class="wp-caption aligncenter" style="width: 603px"><a href="http://www.dssw.co.uk/blog/wp-content/uploads/2010/08/power-manager-check-for-updates.jpg"><img class="size-full wp-image-597" title="Power Manager includes an automatic software update feature" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/08/power-manager-check-for-updates.jpg" alt="Power Manager includes an automatic software update feature" width="593" height="401" /></a><p class="wp-caption-text">Power Manager includes an automatic software update feature</p></div>
<h3><span id="more-964"></span>Changes Since v4.0.3</h3>
<ul>
<li><small>Bug:</small> Fixed <a href="http://www.dssw.co.uk/powermanager/guide/v4/developer/pme.structure.actionlaunchapplication.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=pm404">launch application action</a> bug that could cause the <code>pmd</code> daemon to crash.</li>
<li><small>Refined:</small> Improved localisation of recent triggers and conditions (Pro).</li>
</ul>
<p>If you encounter problems updating, please <a href="http://www.dssw.co.uk/powermanager/dsswpowermanager.dmg">download and manually install</a> this update.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2011/02/01/power-manager-4-0-4-and-power-manager-professional-4-0-4-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About.com Recommends Power Manager</title>
		<link>http://www.dssw.co.uk/blog/2011/01/26/about-com-recommends-power-manager/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=about-com-recommends-power-manager</link>
		<comments>http://www.dssw.co.uk/blog/2011/01/26/about-com-recommends-power-manager/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 02:26:31 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[Energy saving]]></category>
		<category><![CDATA[PM4]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[about.com]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[Tom Nelson]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=948</guid>
		<description><![CDATA[Thanks to Tom Nelson, About.com, for recommending Power Manager. Nelson&#8217;s article highlights the core features of Power Manager and how Power Manager extends Mac OS X&#8217;s Energy Saver capabilities. &#8220;Power Manager gives you so much more control over your Mac&#8217;s &#8230; <a href="http://www.dssw.co.uk/blog/2011/01/26/about-com-recommends-power-manager/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://www.coyotemoon.com/">Tom Nelson</a>, About.com, for recommending <a href="http://www.dssw.co.uk/powermanager/index.html?utm_source=businessinsider2011&amp;utm_medium=blog&amp;utm_campaign=about-com-tom">Power Manager</a>. Nelson&#8217;s article highlights the core features of Power Manager and <a href="http://macs.about.com/b/2011/01/22/power-manager-toms-mac-software-picks.htm">how Power Manager extends Mac OS X&#8217;s Energy Saver capabilities</a>.</p>
<div id="attachment_949" class="wp-caption aligncenter" style="width: 241px"><img class="size-full wp-image-949" title="About.com recommends DssW Power Manager" src="http://www.dssw.co.uk/blog/wp-content/uploads/2011/01/2011-01-about-mac-logo.jpg" alt="About.com recommends DssW Power Manager" width="231" height="35" /><p class="wp-caption-text">About.com recommends DssW Power Manager</p></div>
<blockquote cite="http://macs.about.com/b/2011/01/22/power-manager-toms-mac-software-picks.htm"><p>&#8220;Power Manager gives you so much more control over your Mac&#8217;s built-in Energy Saver preference pane that once you give it a try, you may not want to go back.&#8221;<br />
&#8211; Tom Nelson, About.com</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2011/01/26/about-com-recommends-power-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DssW Featured in PC Power Management Report</title>
		<link>http://www.dssw.co.uk/blog/2011/01/02/dssw-featured-in-pc-power-management-report/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dssw-featured-in-pc-power-management-report</link>
		<comments>http://www.dssw.co.uk/blog/2011/01/02/dssw-featured-in-pc-power-management-report/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 09:55:00 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Andrew Donoghue]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[PC Power Management]]></category>
		<category><![CDATA[The 451 Group]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=875</guid>
		<description><![CDATA[Thanks to Andrew Donoghue, Analyst at The 451 Group, for featuring DssW and our energy saving software, Power Manager, in their latest Eco-Efficient IT report. &#8220;The past 36 months have witnessed a significant expansion in the number of suppliers offering &#8230; <a href="http://www.dssw.co.uk/blog/2011/01/02/dssw-featured-in-pc-power-management-report/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://hu.linkedin.com/pub/andrew-donoghue/3/b2b/baa">Andrew Donoghue</a>, Analyst at <a href="http://www.the451group.com/ecoIT/451_ecoIT.php">The 451 Group</a>, for featuring DssW and our energy saving software, <a href="http://www.dssw.co.uk/powermanager/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=the451group">Power Manager</a>, in their latest Eco-Efficient IT report.</p>
<div id="attachment_877" class="wp-caption aligncenter" style="width: 396px"><img class="size-full wp-image-877" title="DssW is featured in The 451 Group's PC Power Management report" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/12/dssw-the451group-pc-power-management-report.png" alt="DssW is featured in The 451 Group's PC Power Management report" width="386" height="500" /><p class="wp-caption-text">DssW is featured in The 451 Group&#39;s PC Power Management report</p></div>
<p><span id="more-875"></span></p>
<blockquote><p>&#8220;The past 36 months have witnessed a significant expansion in the number of suppliers offering PM products. Concurrently, the overall differentiation between products has decreased as suppliers learn from one another. This report examines the market for desktop power management products, including the technology currently available, adoption trends and user behavior, and the future direction of the market, as well as profiles of 19 prominent vendors.&#8221;<br />
&#8211; PC Power Management; Measuring, Monitoring and Managing Client Energy Consumption</p></blockquote>
<p>The report is available for 3750 USD from <a href="https://store.the451group.com/product_info.php?products_id=156">The 451 Group</a>; an <a href="http://www.the451group.com/reports/executive_summary.php?id=1448">overview document</a> (PDF) is also available.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2011/01/02/dssw-featured-in-pc-power-management-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Notification Trigger in Power Manager</title>
		<link>http://www.dssw.co.uk/blog/2010/11/18/using-the-notification-trigger-in-power-manager/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-the-notification-trigger-in-power-manager</link>
		<comments>http://www.dssw.co.uk/blog/2010/11/18/using-the-notification-trigger-in-power-manager/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 01:14:30 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[PM4]]></category>
		<category><![CDATA[PMPRO4]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[Recipe]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[code snippets]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=840</guid>
		<description><![CDATA[Power Manager has the ability to trigger events on receiving a system wide notification, and to post system wide notifications as part of an event's actions. For developers, and for those integrating Power Manager into their workflow, these two abilities are a great way of loosely chaining tools together. <a href="http://www.dssw.co.uk/blog/2010/11/18/using-the-notification-trigger-in-power-manager/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.dssw.co.uk/powermanager/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager</a> has the ability to trigger events on receiving a system wide notification, and to post system wide notifications as part of an event&#8217;s actions. For developers, and for those integrating Power Manager into their workflow, these two abilities are a great way of loosely chaining tools together.</p>
<p>The system wide notifications used by Power Manager are a standard part of Mac OS X. Notifications can be posted and observed by any other process, including scripts, daemons, C/CoreFoundation based applications, and Objective-C/Cocoa based applications. We will look at the code required to post a notification shortly.</p>
<p><span id="more-840"></span>First, let&#8217;s create an event that will be triggered when a specific notification is observed.</p>
<h3>Create with Professional, Deploy on Standard</h3>
<p>The notification trigger and notification action are not exposed in the interface of the <a href="http://www.dssw.co.uk/powermanager/standard/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">standard edition of Power Manager</a>. To create and configure these items, you will need to use <a href="http://www.dssw.co.uk/powermanager/professional/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager Professional</a> or an alternative interface to Power Manager such as AppleScript.</p>
<p>Every edition of Power Manager supports the notification trigger and action. You can create the event with Professional, or <a href="http://www.dssw.co.uk/powermanager/guide/v4/applescript/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">via AppleScript</a>, and deploy the final schedule across your Macs running Power Manager.</p>
<h3>Triggering an Event with a Notification</h3>
<p>Create a new event with a single trigger. Set the trigger to be <strong>Notification</strong>.</p>
<div id="attachment_842" class="wp-caption aligncenter" style="width: 474px"><img class="size-full wp-image-842" title="A notification triggered event in Power Manager Professional" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/1-power-manager-professional-notification-event.jpg" alt="A notification triggered event in Power Manager Professional" width="464" height="459" /><p class="wp-caption-text">A notification triggered event in Power Manager Professional</p></div>
<p>The notification trigger has one required field and two optional fields. The required field is called <strong>Notification</strong> and this is the name to observe and act upon.</p>
<p>We recommend using a reverse-domain-name style format for system wide notifications. This format helps stop naming collisions by ensuring uniqueness between processes from different developers. The format also helps to provide a suggestion as to the source and cause of the notification.</p>
<p>By default, notification triggers automatically observe system wide notifications. These kinds of notifications are also know as host wide or distributed notifications. The trigger&#8217;s optional <strong>Scope</strong> field controls this behaviour.</p>
<p>With your trigger set up, next add a suitable action to your event. In our case, we have asked the computer to show a warning. You might want to launch an application or start a back up script.</p>
<p>Save and deploy this event to your local Mac.</p>
<h3>Issuing the Notification</h3>
<p>With the event deployed we can move onto how to post system wide notifications.</p>
<p>The following two code snippets both post a system wide notification that will trigger our event.</p>
<p>The first code snippet is for an Objective-C based application requiring only the Foundation (Cocoa) library.</p>
<pre class="objective-c">#import &lt;Foundation/Foundation.h&gt;

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"uk.co.dssw.recipe.notification-example"
                                                                   object:nil
                                                                 userInfo:nil
                                                                  options:NSNotificationPostToAllSessions];

    [pool drain];
    return 0;
}</pre>
<p>The notification needs to be posted through the <strong>distributed notification centre</strong>, and the option flag to <strong>post to all sessions</strong> must be set. Without these settings the notification will not reach Power Manager&#8217;s daemon process.</p>
<p>This is all that is needed to trigger the event programmatically from Cocoa.</p>
<p>The second code snippet is for a C based application and requires only the CoreFoundation library.</p>
<pre class="c">#include &lt;CoreFoundation/CoreFoundation.h&gt;

int main (int argc, const char * argv[]) {

    CFNotificationCenterRef distributedNotificationCenter = CFNotificationCenterGetDistributedCenter();
    CFNotificationCenterPostNotificationWithOptions(distributedNotificationCenter,
                                                    CFSTR("uk.co.dssw.recipe.notification-example"),
                                                    nil,
                                                    nil,
                                                    kCFNotificationPostToAllSessions);

    return 0;
}</pre>
<p>As with the Objective-C example, the notification must be posted via the <strong>distributed notification centre</strong> and the <strong>post to all sessions</strong> flag must be set.</p>
<p>This is all that is needed to trigger the event programmatically from C.</p>
<p>Note the lack of any mention of Power Manager in the code snippets. The code does not require the <a href="http://www.dssw.co.uk/powermanager/developer/index.html">Power Manager framework</a>, or any non-standard libraries.</p>
<p>This is an important aspect of the notification trigger and action. The lack of coupling between the posting and observing processes allows for creative solutions to difficult problems, without requiring tightly intertwined infrastructure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2010/11/18/using-the-notification-trigger-in-power-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using an External Script as an Event Condition</title>
		<link>http://www.dssw.co.uk/blog/2010/11/11/using-an-external-script-as-an-event-condition/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-an-external-script-as-an-event-condition</link>
		<comments>http://www.dssw.co.uk/blog/2010/11/11/using-an-external-script-as-an-event-condition/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 01:38:07 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[PM4]]></category>
		<category><![CDATA[PMPRO4]]></category>
		<category><![CDATA[PMR]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[Recipe]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[recipe]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=831</guid>
		<description><![CDATA[You can augment Power Manager's built-in energy saving functionality with shell scripts and other external tools. This article shows you how to create an event that uses an external script as a condition. <a href="http://www.dssw.co.uk/blog/2010/11/11/using-an-external-script-as-an-event-condition/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>You can augment <a href="http://www.dssw.co.uk/powermanager/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager</a>&#8216;s built-in energy saving functionality with shell scripts and other external tools. This article shows you how to create an event that uses an external script as a condition.</p>
<p>Power Manager has been designed to allow for easy integration with other tools and workflows. We rely on this ability to easily extend Power Manager to help us trial and test new triggers, conditions, and actions before enshrining them into the formal event specification.</p>
<p>The ability to integrate is provided by events that can be triggered on demand, and through an external condition and an external action.</p>
<p>Being able to be triggered on demand allows Power Manager events to be launched by other scheduling tools, such as cron and launchd.</p>
<p>External conditions and actions allow third party scripts and tools to augment the event sequence.</p>
<p>We are going to look at the external condition.</p>
<p><span id="more-831"></span></p>
<p>External conditions allow events to call out to external scripts and processes. The external script or process is asked if their condition is met. What that condition is, Power Manager does not know; that is for the external script or process to determine and test.</p>
<p>External conditions are powerful. With an external condition you can test almost any value, setting, or state available to your Mac. You might test if a particular file exists, or if a certain application is busy. You might test if a web page can be reached or if a particular e-mail remains unread. The possibilities are unlimited.</p>
<p>The ability to create an external condition is not exposed in the standard Power Manager interface. You need <a href="http://www.dssw.co.uk/powermanager/professional/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager Professional</a>, or to use one of the alternative interfaces &#8211; such as <a href="http://www.dssw.co.uk/powermanager/guide/v4/applescript/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">AppleScript</a> or the included command line tool <a href="http://www.dssw.co.uk/powermanager/guide/v4/administrator/pm.tool.pmctl.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">pmctl</a>.</p>
<p>To demonstrate how to create a Power Manager event that uses an external condition, we are going to use the AppleScript interface. This will work with every edition of Power Manager.</p>
<h3>Conditionally Sleep After 15 Minutes</h3>
<p>The event will put the Mac to sleep after 15 minutes of user inactivity, but only if a particular file exists. If the file does not exist, the event will not put the Mac to sleep.</p>
<ol>
<li>Launch AppleScript Editor: <strong>Applications</strong> &gt; <strong>Utilities</strong> &gt; <strong>AppleScript Editor</strong>.</li>
<li>Copy and paste the following AppleScript into a new document:
<pre class="applescript">-- The script to run when testing the condition
set myScriptContents to "#!/usr/bin/perl

exit (-e '/Users/Shared/no-sleep.txt');
"

tell application "/Library/Application Support/Power Manager/Agents/Power Manager Scripting.app"

	tell workshop

		set myEvent to make new event with properties {trigger ID:"externalSleep", name:"Conditionally Sleep"}

		-- Create an inactivity trigger for 15 minutes
		make new trigger after inactivity with properties {seconds of inactivity:(60 * 15)} at end of triggers of myEvent

		-- Create an external inline script to test for a file's existence
		set myExternal to make new external inline with properties {inline:myScriptContents}

		-- Create a condition using the external
		set criteria of myEvent to make new criteria
		make new condition execute external with properties {external:myExternal} at end of conditions of criteria of myEvent

		-- Create a warn action before sleeping
		make new action warn at end of actions of myEvent

		-- Create a sleep action after the warning
		make new action sleep at end of actions of myEvent

		-- Mark the event as having on-demand behaviour
		set behaviours of myEvent to [can perform on demand]

	end tell

	-- Deploy the event
	tell Event Store to store these events myEvent

	-- Clean up
	tell the workshop to empty

end tell</pre>
<p><div id="attachment_832" class="wp-caption aligncenter" style="width: 596px"><img class="size-full wp-image-832" title="AppleScript to create a Power Manager event with an external condition." src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/1-applescript-editor-power-manager-scripting.jpg" alt="AppleScript to create a Power Manager event with an external condition." width="586" height="713" /><p class="wp-caption-text">AppleScript to create a Power Manager event with an external condition.</p></div></li>
<li>Save the script: <strong>File</strong> &gt; <strong>Save</strong>.</li>
<li>Run the script: <strong>Script</strong> &gt; <strong>Run</strong>.</li>
</ol>
<p>When run, the above script, creates a Power Manager event called &#8216;Conditionally Sleep&#8217;. The event contains a single trigger, a condition, and two actions.</p>
<p>Below is how the new event looks in <a href="http://www.dssw.co.uk/powermanager/professional/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager Professional</a>. Using Professional&#8217;s event editor, you can see the different sections of the event and how the script has put those sections together.</p>
<div id="attachment_833" class="wp-caption aligncenter" style="width: 504px"><img class="size-full wp-image-833" title="The event editor in Power Manager Professional." src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/2-power-manager-professional-external-condition.jpg" alt="The event editor in Power Manager Professional." width="494" height="647" /><p class="wp-caption-text">The event editor in Power Manager Professional.</p></div>
<h3>Testing the Event</h3>
<p>The event will be triggered after 15 minutes of inactivity and can also be triggered on demand. You can use the on demand trigger to test the event works. Try triggering the event using the status menu bar, or through <a href="http://www.dssw.co.uk/powermanager/remote/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager Remote</a> on your iOS device.</p>
<p>Your Mac will immediately sleep unless a file named <strong>no-sleep.txt</strong> exists in a particular folder. The folder being checked is: <strong>Users</strong> &gt; <strong>Shared</strong>.</p>
<p>Try triggering your event after placing a file named &#8216;no-sleep.txt&#8217; in /Users/Shared/. Note your Mac does not sleep. This is because the event has called out to the external script to test if the file exists; the file does exist, so the event&#8217;s actions are not performed.</p>
<h3>Self-Contained Event</h3>
<p>This event is self-contained. The external script is included inside the event itself. This is not required and Power Manager can be told to use scripts stored elsewhere on your Mac. However, inline scripts benefit from being less fragile. The script is always available and its association with the event is clear.</p>
<p>As you have seen, <a href="http://www.dssw.co.uk/powermanager/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager</a> can be extended with external scripts. The script can be as simple or as complex as you desire. Should you ever find Power Manager&#8217;s built-in functionality not quite enough for your needs, consider using an external condition or action.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2010/11/11/using-an-external-script-as-an-event-condition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Power On Your Mac at a Specific Date and Time</title>
		<link>http://www.dssw.co.uk/blog/2010/11/02/how-to-power-on-your-mac-at-a-specific-date-and-time/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-power-on-your-mac-at-a-specific-date-and-time</link>
		<comments>http://www.dssw.co.uk/blog/2010/11/02/how-to-power-on-your-mac-at-a-specific-date-and-time/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 23:27:05 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[Energy saving]]></category>
		<category><![CDATA[PM4]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[Recipe]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[energy saver]]></category>
		<category><![CDATA[pmset]]></category>
		<category><![CDATA[power on]]></category>
		<category><![CDATA[start up]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=812</guid>
		<description><![CDATA[Mac computers have the ability to power themselves on. This ability is available on all Macs running Mac OS X.

You can schedule your Mac to power itself on in the morning No more waiting for your Mac to start up. One less reason to leave your Mac on over night; remember, a powered off Mac uses less energy than a sleeping Mac. <a href="http://www.dssw.co.uk/blog/2010/11/02/how-to-power-on-your-mac-at-a-specific-date-and-time/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Mac computers have the ability to power themselves on. This ability is available on all Macs running Mac OS X.</p>
<p>You can schedule your Mac to power itself on in the morning. No more waiting for your Mac to start up. One less reason to leave your Mac on over night; remember, a powered off Mac uses less energy than a sleeping Mac.</p>
<p>&#8220;Powering on&#8221; is the same as &#8220;starting up&#8221;. Both phrases mean the Mac is powering on to a state of readyness having been switched completely off. Previously the Mac was not asleep, but had been shut down. In this shut down state the Mac is using the lowest amount of energy it can while plugged in to mains power.</p>
<p><span id="more-812"></span></p>
<h3>Energy Saver</h3>
<p>You can configure your Mac&#8217;s automatic powering on ability using the <strong>Energy Saver</strong> System Preference panel. Mac OS X&#8217;s Energy Saver settings let you set up a repeating power on and power off schedule.</p>
<div id="attachment_822" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-822" title="Mac OS X's Energy Saver System Preference panel" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/system-preference-energy-saver.jpg" alt="Mac OS X's Energy Saver System Preference panel" width="593" height="434" /><p class="wp-caption-text">Mac OS X&#39;s Energy Saver System Preference panel</p></div>
<p>Energy Saver&#8217;s settings are not too flexible. You can set up repeating power events for a limited range of situations. If you need more than Energy Saver offers, you have a couple of options.</p>
<div id="attachment_821" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-821" title="Mac OS X's built-in Energy Saver Schedule" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/system-preference-energy-saver-schedule.jpg" alt="Mac OS X's built-in Energy Saver Schedule" width="593" height="434" /><p class="wp-caption-text">Mac OS X&#39;s built-in Energy Saver Schedule</p></div>
<h3>pmset</h3>
<p>Mac OS X includes a command line tool called <strong>pmset</strong>. This tool has been improved with each major release of Mac OS X. With Mac OS X 10.6, aka Snow Leopard, pmset has matured into a capable tool and is now able to create more complex power event schedules.</p>
<p>Your copy of pmset&#8217;s manual is available through the Terminal application:</p>
<p><strong>Applications</strong> &gt; <strong>Utilities</strong> &gt; <strong>Terminal.app</strong></p>
<p>Within the Terminal.app issue the following command to view pmset&#8217;s manual:</p>
<pre>man pmset</pre>
<div id="attachment_823" class="wp-caption aligncenter" style="width: 532px"><img class="size-full wp-image-823" title="Mac OS X's Terminal" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/terminal-man-pmset.jpg" alt="Mac OS X's Terminal" width="522" height="118" /><p class="wp-caption-text">Mac OS X&#39;s Terminal</p></div>
<div id="attachment_824" class="wp-caption aligncenter" style="width: 532px"><img class="size-full wp-image-824" title="pmset's manual in Mac OS X's Terminal" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/terminal-pmset-manual.jpg" alt="pmset's manual in Mac OS X's Terminal" width="522" height="390" /><p class="wp-caption-text">pmset&#39;s manual in Mac OS X&#39;s Terminal</p></div>
<h3>Power Manager &#8211; Beyond Energy Saver and pmset</h3>
<p>Energy Saver and pmset both have their limitations. <a href="http://www.dssw.co.uk/powermanager/standard/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager</a> overcomes these limitations and provides a consistent interface across multiple editions of Mac OS X.</p>
<p>You can create multiple repeating and non-repeating power events with Power Manager.</p>
<p>Let&#8217;s look at how to schedule a non-repeating power on event using Power Manager. Our event will power on your Mac once, at a specific date and time.</p>
<h3>Create a Date and Time Power On/Start Up event</h3>
<ol>
<li>Launch <strong>System Preferences</strong> and select <strong>Power Manager</strong>.</li>
<li>Click <strong>Add…</strong> to create a new event.
<p><div id="attachment_814" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-814" title="Click Add… to create a new Power Manager event" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/1-power-manager-empty-schedule.jpg" alt="Click Add… to create a new Power Manager event" width="593" height="384" /><p class="wp-caption-text">Click Add… to create a new Power Manager event</p></div></li>
<li>Choose the template <strong>Power on</strong>.
<p><div id="attachment_815" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-815" title="Select the Power On template in the Schedule Assistant" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/2-power-manager-schedule-assistant.jpg" alt="Select the Power On template in the Schedule Assistant" width="593" height="430" /><p class="wp-caption-text">Select the Power On template in the Schedule Assistant</p></div></li>
<li>Click <strong>Continue</strong> to the <strong>What and When</strong> step.
<p><div id="attachment_816" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-816" title="Continue to the What and When step." src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/3-power-manager-power-on-what-and-when.jpg" alt="Continue to the What and When step." width="593" height="430" /><p class="wp-caption-text">Continue to the What and When step.</p></div></li>
<li>Adjust the date and time for when your Mac should automatically power on.</li>
<li>Click <strong>Continue</strong> and fill in the <strong>Why</strong> step.
<p><div id="attachment_817" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-817" title="Continue and complete the Why step" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/4-power-manager-power-on-why.jpg" alt="Continue and complete the Why step" width="593" height="430" /><p class="wp-caption-text">Continue and complete the Why step</p></div></li>
<li>Click <strong>Continue</strong> and you will see your new event ready to create.
<p><div id="attachment_818" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-818" title="Continue and Confirm your event is correct" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/5-power-manager-power-on-confirm.jpg" alt="Continue and Confirm your event is correct" width="593" height="430" /><p class="wp-caption-text">Continue and Confirm your event is correct</p></div></li>
<li>Click <strong>Confirm</strong> to create your new event.
<p><div id="attachment_819" class="wp-caption aligncenter" style="width: 603px"><img class="size-full wp-image-819" title="Your Power On event has been created and scheduled" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/6-power-manager-power-on-scheduled.jpg" alt="Your Power On event has been created and scheduled" width="593" height="384" /><p class="wp-caption-text">Your Power On event has been created and scheduled</p></div></li>
</ol>
<p>Your power on event is now scheduled and ready to run.</p>
<div id="attachment_820" class="wp-caption aligncenter" style="width: 238px"><img class="size-full wp-image-820 " title="The event appears in the Power Manager status menu bar" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/11/power-manager-power-on-scheduled-menu-bar.jpg" alt="The event appears in the Power Manager status menu bar" width="228" height="130" /><p class="wp-caption-text">The event appears in the Power Manager status menu bar</p></div>
<p>Your pending power on event will now appear in the Power Manager status menu bar. From here you can adjust, cancel, or delay the pending event.</p>
<p>If you need to schedule additional times and days, add another event.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2010/11/02/how-to-power-on-your-mac-at-a-specific-date-and-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Log Out Users With AppleScript</title>
		<link>http://www.dssw.co.uk/blog/2010/10/27/how-to-log-out-users-with-applescript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-log-out-users-with-applescript</link>
		<comments>http://www.dssw.co.uk/blog/2010/10/27/how-to-log-out-users-with-applescript/#comments</comments>
		<pubDate>Wed, 27 Oct 2010 07:17:22 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[PM4]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[Recipe]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[log out]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=797</guid>
		<description><![CDATA[Being able to log out a user on Mac OS X with AppleScript is useful. A common reason for needing to log out a user is to ensure a shared Mac is freed up for other users. The simplest way of logging out an active user is shown in the AppleScript snippet below. The script asks the System Events process to begin the log out process. <a href="http://www.dssw.co.uk/blog/2010/10/27/how-to-log-out-users-with-applescript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Being able to log out a user on Mac OS X with AppleScript is useful. A common reason for needing to log out a user is to ensure a shared Mac is freed up for other users.</p>
<p>The simplest way of logging out an active user is shown in the AppleScript snippet below. The script asks the System Events process to begin logging out.<span id="more-797"></span></p>
<pre class="applescript">tell application "System Events"

	log out

end tell</pre>
<div id="attachment_800" class="wp-caption aligncenter" style="width: 591px"><img class="size-full wp-image-800" title="Fragile AppleScript for logging out" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/10/1-applescript-editor-log-out-system-events.jpg" alt="Fragile AppleScript for logging out" width="581" height="237" /><p class="wp-caption-text">Fragile AppleScript for logging out</p></div>
<p>This script, though simple, is not perfect and is not robust enough to use in situations where the user might cancel the log out, or where a rogue application may block the log out.</p>
<p>Over the years we have become experts at automating the log out process. Thankfully all that experience is encapsulated in <a href="http://www.dssw.co.uk/powermanager/standard/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager</a> for you to call upon as needed.</p>
<p>Let&#8217;s look at how to use AppleScript with Power Manager to force all users logged into a Mac to log out &#8211; whether they want to or not. Our solution can claim the following improvements over the AppleScript snippet above:</p>
<ul>
<li>Active users will be warned of the pending log out.</li>
<li>Users logged in but Fast User Switched will also be logged out.</li>
<li>Administrators will have the opportunity to cancel or adjust the log out.</li>
<li>The script will work even if the login window is front most.</li>
<li>The log out can not be stopped by standard users.</li>
<li>The log out will not be stopped by application dialog boxes.</li>
<li>The log out will not be stopped by stalled or rogue applications.</li>
<li>The script will wake up the Mac when the log out is due.</li>
</ul>
<h3>How to Create a Log Out Event in Power Manager</h3>
<ol>
<li>Launch AppleScript Editor: <strong>Applications</strong> &gt; <strong>Utilities</strong> &gt; <strong>AppleScript Editor</strong>.</li>
<li>Copy and paste the following AppleScript into a new document:
<pre class="applescript">tell application "Power Manager Scripting"

	tell workshop

		set myEvent to make new event with properties {trigger ID:"myLogOutEvent", name:"Log out"}

		-- Create short notification delay before logging out
		make new action await relative date with properties {seconds:60, availability:wake up} at front of actions of myEvent

		-- Create a warn action before logging out
		make new action warn at end of actions of myEvent

		-- Create a log out action after the warning
		make new action log out at end of actions of myEvent

		-- Mark the event has having on-demand behaviour
		set behaviours of myEvent to [can perform on demand]

	end tell

	-- Deploy the event
	tell Event Store to store these events myEvent

	-- Clean up
	tell the workshop to empty

end tell</pre>
<div id="attachment_809" class="wp-caption aligncenter" style="width: 564px"><img src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/10/2-applescript-editor-log-out-power-manager.jpg" alt="Robust AppleScript for automatically logging users out of Mac OS X" title="Robust AppleScript for automatically logging users out of Mac OS X" width="554" height="533" class="size-full wp-image-809" /><p class="wp-caption-text">Robust AppleScript for automatically logging users out of Mac OS X</p></div>
</li>
<li>Save the script: <strong>File</strong> &gt; <strong>Save</strong>.</li>
<li>Run the script: <strong>Script</strong> &gt; <strong>Run</strong>.</li>
</ol>
<p>When you ran the script, you created a new event in Power Manager. This event has no triggers, so it will not be automatically scheduled. Instead this event has on-demand behaviour. Your new &#8216;Log out&#8217; event will immediately appear in Power Manager&#8217;s interface.</p>
<div id="attachment_802" class="wp-caption aligncenter" style="width: 420px"><img class="size-full wp-image-802" title="A one minute notification alerts active users" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/10/3-power-manager-log-out-notifications.jpg" alt="A one minute notification alerts active users" width="410" height="191" /><p class="wp-caption-text">A one minute notification alerts active users</p></div>
<p>An on-demand event can be triggered using one of the following methods:</p>
<ul>
<li>Using Power Manager&#8217;s status menu;</li>
<li>Over the network via <a href="http://www.dssw.co.uk/powermanager/professional/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Professional</a>;</li>
<li>With your iPhone or iPod Touch using <a href="http://www.dssw.co.uk/powermanager/remote/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=how-to">Power Manager Remote</a>.</li>
</ul>
<div id="attachment_805" class="wp-caption aligncenter" style="width: 520px"><img class="size-full wp-image-805" title="Trigger the log out from your iPhone with Power Manager Remote" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/10/4-power-manager-remote-iphone-log-out.jpg" alt="Trigger the log out from your iPhone with Power Manager Remote" width="510" height="274" /><p class="wp-caption-text">Trigger the log out from your iPhone with Power Manager Remote</p></div>
<p>If you want to schedule this event to occur at a specific date and time, or on specific days, go back and edit the AppleScript to add one or more triggers. The AppleScript included in the <a href="http://www.dssw.co.uk/blog/2010/09/09/how-to-shut-down-your-mac-using-applescript/">shut down recipe</a> includes a trigger for its event.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2010/10/27/how-to-log-out-users-with-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Power Manager Rebates for BC Hydro Customers</title>
		<link>http://www.dssw.co.uk/blog/2010/10/14/power-manager-rebates-for-bc-hydro-customers/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=power-manager-rebates-for-bc-hydro-customers</link>
		<comments>http://www.dssw.co.uk/blog/2010/10/14/power-manager-rebates-for-bc-hydro-customers/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 00:45:47 +0000</pubDate>
		<dc:creator>Graham Miln</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Energy saving]]></category>
		<category><![CDATA[PM4]]></category>
		<category><![CDATA[Power Manager]]></category>
		<category><![CDATA[bc hydro]]></category>
		<category><![CDATA[dssw]]></category>
		<category><![CDATA[MacInHome]]></category>
		<category><![CDATA[rebate]]></category>

		<guid isPermaLink="false">http://www.dssw.co.uk/blog/?p=753</guid>
		<description><![CDATA[BC Hydro customer? Looking to reduce your energy bill? Thanks to BC Hydro&#8217;s PIP Incentive programme, you can now save up to $6 or up to 75% of the licence cost for every Mac running Power Manager. For more information, &#8230; <a href="http://www.dssw.co.uk/blog/2010/10/14/power-manager-rebates-for-bc-hydro-customers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>BC Hydro customer? Looking to reduce your energy bill? Thanks to BC Hydro&#8217;s PIP Incentive programme, you can now save up to $6 or up to 75% of the licence cost for every Mac running <a href="http://www.dssw.co.uk/powermanager/index.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=bc-hydro-rebate">Power Manager</a>.</p>
<div id="attachment_754" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-754" title="BC Hydro's Peace Canyon Dam, British Columbia, Canada" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/10/bc-hydros-the-peace-canyon-dam.jpg" alt="BC Hydro's Peace Canyon Dam, British Columbia, Canada" width="500" height="375" /><p class="wp-caption-text">BC Hydro&#39;s Peace Canyon Dam, British Columbia, Canada</p></div>
<p>For more information, see BC Hydro&#8217;s <a href="http://www.bchydro.com/ecatalog/eCatServlet?cmd=product_details&amp;catId=&amp;prdId=2157&amp;pid=&amp;rid=&amp;eid=">Rebates and Savings e.Catalog</a> and then contact our friendly Canadian resellers, <a href="http://www.macinhome.com/marketplace.html?utm_source=dssw&amp;utm_medium=blog&amp;utm_campaign=bc-hydro-rebate">MacInHome</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dssw.co.uk/blog/2010/10/14/power-manager-rebates-for-bc-hydro-customers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

