A script to send MapQuest directions via Bluetooth

Aug 05, '04 10:46:00AM

Contributed by: Anonymous

This script sends MapQuest directions to a BlueTooth-enabled Nokia phone. This script has been tested with a Nokia 3620 model. Copy the following script into a text editor, and save as mapquest.pl.

#!/usr/bin/perl

print "Enter filename for parsing:";

my $filename = <STDIN>;
my $outfile = "writeout";
open MYHANDLE, "<$filename";
open WRITEFILE, ">$outfile";
$i =1;
while(<MYHANDLE>)
{
     chomp($name = $_);
     print WRITEFILE "$name";
     if($i %5==0)
     {
	 print WRITEFILE "\n";
     }
      $i++;
}
close MYHANDLE;
close WRITEFILE;
system "cp $outfile $filename"; 
system "open -a /Applications/Utilities/Bluetooth\\ File\\ Exchange.app/ $filename";
exit(0);
In the Terminal, type the following to make the script executeable:
chmod 755 mapquest.pl
Now go to MapQuest's directions page and enter driving directions. Click on the Print link. Highlight only the directions (start highlighting at number 1 until you get to the last step in the directions) -- do not highlight map! Copy and paste into a text editor, and then save it to your hard drive.

Finally, run the script you created above (mapquest.pl). The script will ask for the directions file, and then send the file to the Bluetooth-enabled phone.

[robg adds: I haven't tested this one; I usually just use the "Send File to Bluetooth Device" system service from the Finder, but this script could save a step or two...]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040804182812579