<?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>Chris Haynie &#187; mac</title>
	<atom:link href="http://chrishaynie.com/tag/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrishaynie.com</link>
	<description>I&#039;ll fix it when its not broken</description>
	<lastBuildDate>Mon, 06 Sep 2010 08:06:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Bluetooth Proximity Lock for Macbook</title>
		<link>http://chrishaynie.com/2008/11/bluetooth-proximity-lock-for-macbook/</link>
		<comments>http://chrishaynie.com/2008/11/bluetooth-proximity-lock-for-macbook/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 00:34:43 +0000</pubDate>
		<dc:creator>sax</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.chrishaynie.com/?p=26</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>I wanted to have my macbook automatically lock and unlock based on if I am in the room or not automatically. Best way to do that I figured would be bluetooth, since I always have my phone on me, and it has bluetooth. From there I proceeded to google.</p>
<p><a title="http://web.mac.com/jhollington/technocrat/The_Technocrat/Entries/2007/3/18_Bluetooth_Proximity_Detection_on_OS_X.html" href="http://web.mac.com/jhollington/technocrat/The_Technocrat/Entries/2007/3/18_Bluetooth_Proximity_Detection_on_OS_X.html">http://web.mac.com/jhollington/technocrat/The_Technocrat/Entries/2007/3/18_Bluetooth_Proximity_Detection_on_OS_X.html</a></p>
<p>Pointed me to</p>
<p><a title="http://www.apple.com/downloads/macosx/system_disk_utilities/proximity.html" href="http://www.apple.com/downloads/macosx/system_disk_utilities/proximity.html">http://www.apple.com/downloads/macosx/system_disk_utilities/proximity.html</a></p>
<p>he also includes a script to automate syncing your phone book and such too</p>
<p>Another utility in my searching, is called JackSMS</p>
<p><a title="http://www.macupdate.com/info.php/id/21860" href="http://www.macupdate.com/info.php/id/21860">http://www.macupdate.com/info.php/id/21860</a></p>
<p>JackSMS does some cool stuff like, say someone tries to access your laptop while you&#8217;re not there &#8211; the built in isight camera will take their picture and email it then, so I wanted to use JackSMS as well.</p>
<p>Proximity allows you to set scripts for when you arrive or when you leave, so here are the applescripts I used:</p>
<p>lock.scpt:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;">﻿<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;JackSMS&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">set</span> lock screen <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">true</span></pre></div></div>

<p>unlock.scpt:</p>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;">﻿<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;JackSMS&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">set</span> lock screen <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">false</span></pre></div></div>

<p>courtesy of: <a title="http://www.macosxhints.com/article.php?story=2006061914363693" href="http://www.macosxhints.com/article.php?story=2006061914363693">http://www.macosxhints.com/article.php?story=2006061914363693</a></p>
<p>update: a better proximity script, copied below, courtesy of:<br />
<a title="http://pixelignition.net/better-proximity-applescript" href="http://pixelignition.net/better-proximity-applescript"> http://pixelignition.net/better-proximity-applescript</a><br />
lock.scpt:<br />
<a href="javascript:void(null);" onclick="s_toggleDisplay(document.getElementById('SID1911932779'), this, 'Show &#9660;', 'Hide &#9650;');">Show &#9660;</a></p>
<div id='SID1911932779' style='display:none;'>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #ff0033; font-weight: bold;">global</span> okflag
<span style="color: #ff0033; font-weight: bold;">set</span> okflag <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">false</span>
<span style="color: #ff0033; font-weight: bold;">set</span> front_app <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">path to</span> frontmost <span style="color: #0066ff;">application</span> <span style="color: #ff0033;">as</span> Unicode <span style="color: #0066ff;">text</span><span style="color: #000000;">&#41;</span> <span style="color: #808080; font-style: italic;">-- So we can switch back to this after running the fade</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- check if iTunes is running</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;System Events&quot;</span>
        <span style="color: #ff0033; font-weight: bold;">if</span> process <span style="color: #009900;">&quot;iTunes&quot;</span> <span style="color: #0066ff;">exists</span> <span style="color: #ff0033; font-weight: bold;">then</span>
                <span style="color: #ff0033; font-weight: bold;">set</span> okflag <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">true</span> <span style="color: #808080; font-style: italic;">--iTunes is running</span>
        <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
&nbsp;
<span style="color: #ff0033; font-weight: bold;">if</span> okflag <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #0066ff;">true</span> <span style="color: #ff0033; font-weight: bold;">then</span>
        <span style="color: #ff0033; font-weight: bold;">try</span>
                <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;iTunes&quot;</span>
                        <span style="color: #ff0033; font-weight: bold;">set</span> currentvolume <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033;">the</span> sound volume
                        <span style="color: #ff0033; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>player state <span style="color: #ff0033; font-weight: bold;">is</span> playing<span style="color: #000000;">&#41;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
                                <span style="color: #ff0033; font-weight: bold;">repeat</span>
                                        <span style="color: #808080; font-style: italic;">--Fade down</span>
                                        <span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> i <span style="color: #ff0033; font-weight: bold;">from</span> currentvolume <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">0</span> <span style="color: #0066ff;">by</span> <span style="color: #000000;">-</span><span style="color: #000000;">1</span> <span style="color: #808080; font-style: italic;">--try by -4 on slower Macs</span>
                                                <span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> sound volume <span style="color: #ff0033; font-weight: bold;">to</span> i
                                                delay <span style="color: #000000;">0.01</span> <span style="color: #808080; font-style: italic;">-- Adjust this to change fadeout duration (delete this line on slower Macs)</span>
                                        <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
                                        pause
                                        <span style="color: #808080; font-style: italic;">--Restore original volume</span>
                                        <span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> sound volume <span style="color: #ff0033; font-weight: bold;">to</span> currentvolume
                                        <span style="color: #ff0033; font-weight: bold;">exit</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
                                <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
                                <span style="color: #ff0033; font-weight: bold;">set</span> comment <span style="color: #ff0033; font-weight: bold;">of</span> current track <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;Proximity Paused&quot;</span>
                        <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
                <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
                <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> front_app
                        <span style="color: #0066ff;">activate</span>
                <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
        <span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span>
                <span style="color: #0066ff;">beep</span>
        <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;JackSMS&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033; font-weight: bold;">set</span> jack status <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;on&quot;</span>
delay <span style="color: #000000;">1</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;DeskShade&quot;</span>
        lock
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #0066ff;">run</span></pre></div></div>

</div>
<p>unlock.scpt:<br />
<a href="javascript:void(null);" onclick="s_toggleDisplay(document.getElementById('SID2141217197'), this, 'Show &#9660;', 'Hide &#9650;');">Show &#9660;</a></p>
<div id='SID2141217197' style='display:none;'>

<div class="wp_syntax"><div class="code"><pre class="applescript" style="font-family:monospace;"><span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;ScreenSaverEngine&quot;</span> <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">quit</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;DeskShade&quot;</span>
        unlock
        <span style="color: #0066ff;">quit</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;JackSMS&quot;</span>
        <span style="color: #0066ff;">quit</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">global</span> okflag
<span style="color: #ff0033; font-weight: bold;">set</span> okflag <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">false</span>
<span style="color: #ff0033; font-weight: bold;">set</span> front_app <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #000000;">&#40;</span><span style="color: #0066ff;">path to</span> frontmost <span style="color: #0066ff;">application</span> <span style="color: #ff0033;">as</span> Unicode <span style="color: #0066ff;">text</span><span style="color: #000000;">&#41;</span> <span style="color: #808080; font-style: italic;">-- So we can switch back to this after running the fade</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- check if iTunes is running</span>
<span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;System Events&quot;</span>
        <span style="color: #ff0033; font-weight: bold;">if</span> process <span style="color: #009900;">&quot;iTunes&quot;</span> <span style="color: #0066ff;">exists</span> <span style="color: #ff0033; font-weight: bold;">then</span>
                <span style="color: #ff0033; font-weight: bold;">set</span> okflag <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #0066ff;">true</span> <span style="color: #808080; font-style: italic;">--iTunes is running</span>
        <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
&nbsp;
<span style="color: #ff0033; font-weight: bold;">if</span> okflag <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #0066ff;">true</span> <span style="color: #ff0033; font-weight: bold;">then</span>
        <span style="color: #ff0033; font-weight: bold;">try</span>
                <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> <span style="color: #009900;">&quot;iTunes&quot;</span>
                        <span style="color: #ff0033; font-weight: bold;">set</span> currentvolume <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #ff0033;">the</span> sound volume
                        <span style="color: #ff0033; font-weight: bold;">if</span> comment <span style="color: #ff0033; font-weight: bold;">of</span> current track <span style="color: #ff0033; font-weight: bold;">is</span> <span style="color: #009900;">&quot;Proximity Paused&quot;</span> <span style="color: #ff0033; font-weight: bold;">then</span>
                                <span style="color: #ff0033; font-weight: bold;">set</span> comment <span style="color: #ff0033; font-weight: bold;">of</span> current track <span style="color: #ff0033; font-weight: bold;">to</span> <span style="color: #009900;">&quot;&quot;</span>
                                play
                                <span style="color: #ff0033; font-weight: bold;">repeat</span> <span style="color: #ff0033; font-weight: bold;">with</span> j <span style="color: #ff0033; font-weight: bold;">from</span> <span style="color: #000000;">0</span> <span style="color: #ff0033; font-weight: bold;">to</span> currentvolume <span style="color: #0066ff;">by</span> <span style="color: #000000;">2</span> <span style="color: #808080; font-style: italic;">--try by 4 on slower Macs</span>
                                        <span style="color: #ff0033; font-weight: bold;">set</span> <span style="color: #ff0033;">the</span> sound volume <span style="color: #ff0033; font-weight: bold;">to</span> j
                                <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">repeat</span>
                        <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span>
                <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
                <span style="color: #ff0033; font-weight: bold;">tell</span> <span style="color: #0066ff;">application</span> front_app
                        <span style="color: #0066ff;">activate</span>
                <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">tell</span>
        <span style="color: #ff0033; font-weight: bold;">on</span> <span style="color: #ff0033; font-weight: bold;">error</span>
                <span style="color: #0066ff;">beep</span>
        <span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">try</span>
<span style="color: #ff0033; font-weight: bold;">end</span> <span style="color: #ff0033; font-weight: bold;">if</span></pre></div></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://chrishaynie.com/2008/11/bluetooth-proximity-lock-for-macbook/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
