Bluetooth Proximity Detection on OS X
Submitted by ingo on Mon, 2007-03-19 10:07.
Del.icio.us pointed me to these great Apple Scripts posted here using the Proximity tool which monitors the proximity of configured Bluetooth devices and executes custom AppleScripts when the device goes out of range or comes into range of your computer.
Unfortunately, the Apple Scripts on the mentioned sites are not available to download and/or cut and paste. I therefore wrote them down and they are now available for download here.
I also included the compiled C Program including the source code.
Although I tested it, I cannot be made responsible for any kind of data loss resulting from executing posted code/applications.
Have Fun

Lock Computer Using DeskShade
I am an avid user of DeskShade and love the ability to lock my machine without using the Screen Saver. When i saw this wonderful article I was impressed by the great ideas. After using it for a few days though, I did notice a few problems with the Screen Saver lock which can be found here. I replaced the lines of code for the Screen Saver lock with ones that will make use of DeskShade's lock feature instead. This also eliminates the need for the notif file as well. I hope this helps some of you DeskShade users out there.
- Anthony
Entering Proximity.scpt
tell application "DeskShade"
unlock
end tell
Leaving Proximity.scpt
tell application "DeskShade"
lock
end tell
Elegant!
Thanks so much for your Desk Shade alternative. Much less involved for the purposes I require (and my knowledge level with coding.)
Thank you!
Thanks a bunch for posting the compiled notif. I wasn't looking forward to installing the developer tools to compile 5 lines of code! Thanks again :)
Thanks!
First off thanks! Could you post the Applescript's uncompiled? I need to remove the iSync part but cant edit the script. You may want to .zip or .tar.gz the notif app, Safari appends .html to it and that may screw some people up.
-KRS Juan-
uncompile Apple Scripts
I added the plain text verison of the 2 Apple Scripts. They can be found at the same location.
novice complier
If you do not have a compiler, can you simply use the notify file or notify.c file that you posted.
I put these two files in my home (~/notify) but now when I run the scripts I get the following error message:
sh: line 1: /Users/tal/notif: Permission denied
Any advice
- Tal
compiler issue
you do not have execute permission on the binary. run the following command in a terminal window:
chmod 755 /Users/tal/notif
that will do it.
Cheerio
-Meckimac
chmod'ing the directory
didn't work for me, any other suggestions?
--KrisInJapan.com
chmod
don't 'chmod' the directory - chmod the executable. Try running 'notif' from the command line like this:
- 'cd' into the directory where 'notif' is located, presumable your home-dir.
- run it like this: ./notif
if everything is fine, it will just run without giving any output - if it produces output, send it.
Let me know how it goes.
that flipped the switch for
that flipped the switch for me! Thanks tons, works like a charm ;)
--KrisInJapan.com
I am having the same problem
I am having the same problem and it outputs:
-bash: ./notif: cannot execute binary file
notif permission problems
please post the output of following command:
ls -l ./notif
-rwxr-xr-x 1 Hoag Hoag
-rwxr-xr-x 1 Hoag Hoag 13496 Mar 19 03:54 ./notif
same problem
Hey
I had the same problem with the compiled version of notif that was posted. Chmod'd it and everything and kept getting a non-executable error from Script Editor. I had to compile the .c file itself to get it to work on my system. FYI i run a Powerbook 12" with OSX 10.4.9, i dunno what everybody else in this situation is running. just thought it might be of interest.
Cheers!
non-executable errors
I compiled the posted 'notif' executable on an Intel MacBook Pro running 10.4.9 - you won't be able to run it on a PowerPC Mac. I will try to build a Universal Binary and will post it.
working notif file
http://digg.com/apple/Bluetooth_Proximity_Detection_on_OS_X#c5752438
I tried to compile and I got
I tried to compile and I got this:
sh: line 1: gcc: command not found (127)
failed to compile
You do not have Xcode installed. You can find it on your OS X Install DVD.
Permission denied
Anyone with a Universal Binary or PPC version of the .c file?
Thanx!!