In last Friday ’s web log , we discussed how to safely use modified Dashboard widgets . When you localize a copy inyour user pamphlet / Library / gizmo folder , OS X uses the replicate thingmabob instead of the original stock widget . This week , we ’re going to use that antic to make a qualify version of the Address Book doohickey .
The Address Book widget is quite utilitarian . Not only can you crop and research your contacts , but with a press the tangency ’s address , your nonpayment internet browser displays aMapQuestmap ( the screenshot to the leftover , below this paragraph ) to that location . MapQuest is a fine service , but it lacks some of the coolheaded features that “ new kid on the block”Google Mapssupports , such as soda water - up balloon with locating information and the ability to scroll through the map with the mouse . Would n’t it be nice if you could employ Google ’s single-valued function service ( pictured on the rightfulness , below ) with the Address Book widget ? I mean , really , which mapping would you rather apply ?
Obviously , you could , or I would n’t be sharing this pinch with you today ! Although today ’s tip is comparatively long , it ’s really not that hard — I’ve just endeavor to thoroughly explicate each stair in the process .
Getting started
The first matter to do is to make a written matter of Apple ’s Address Book widget , per last workweek ’s blog incoming . Open two Finder windows . In the first windowpane navigate to the top - level /Library / Widgets pamphlet . In the second , navigate toyour user folder / Library / Widgets brochure ( create a Widgets brochure here , if necessary ) . Now just drag the Address Book widget from the top - level doohickey window into your exploiter ’s Widgets folder . OS X protect the top - level directory , so the scheme will automatically make a copy of the thingummy rather of moving it . You ’ve now got a dependable fill-in ( the original widget file , in its original fix ) along with a written matter that we ’ll apply for this hint .
Replacing the mathematical function server in the Address Book widget is n’t as trivial as changing a school text string in a preferences filing cabinet . That ’s because Apple has hoard the code ( which means it ’s in binary human body ) that contains the MapQuest universal resource locator — and compiled code ca n’t simply be edit like a neat text data file . or else , you have to apply ahexeditor , and be very , very careful when making changes . If you make even one pocket-sized misprint , then you ’ll kill the program for trusted . gratefully , we do n’t have to do any of that stuff and nonsense , as a macosxhints.com reader has done the strong work already . rather , we ’ll just have to do a bit of piece of work with Terminal ( /Applications / Utilities ) to create a script .
create the script
The easiest way to create the script on your own simple machine is to view the already - written source computer code in your web browser . Then use the web internet browser ’s Save menu item ( in Safari it ’s File : Save As ; in Firefox , it ’s File : Save Page As ) to save a written matter locally . The file should be named abwidgetmap.sh ; if OS X kindly point out that your school text file is missing a .txt extension , donotadd one :
As for where to save the file , it probably wo n’t matter , give that you may not use this program very often . Find a folder within your Documents leaflet , if you wish . If you have other hand saved in another positioning , you could salvage this one there , too . If you ’re a stickler for Unix booklet structures , deliver it to your user’sbinfolder , or to / usr / local / bin . In short , it does n’t really weigh ; just think where you put it .
So now you ’ve got a bunch of building complex - look Unix computer code write as a data file on your Mac . So what ’s this computer code do ? This script toggles your copy of Address Book ’s mapping service between MapQuest and Google Maps . Since the thingamajig uses MapQuest by default , the first run will interchange it to Google Maps . For most of you , that ’s the only fourth dimension you ’ll require this hand . But if you ever need the MapQuest maps back — if , for instance , you ’re um , oh , I do n’t bonk , a Mac technology author who needs a screenshot of the default Address Book mapping service — you’re able to just extend the playscript again , and you ’ll have the MapQuest maps back .
So how does it lick ? Quite aboveboard , it ’s a number like magic to me , too , and a full breakdown of the script ’s functionality is well beyond the cathode-ray oscilloscope of this hint , not to mention my Department of Education . But basically , the hand creates a backup written matter of some codification within the widget , checks to see what the current doojigger is set to do , then expend a Unix programme calledxxdto insert the proper hunting URL ( Google Maps or MapQuest ) in a binary - encode form into the file . Each time you execute the script , the single-valued function service alternates between Goole Maps and MapQuest .
Using the hand
Before you’re able to use the handwriting , you need to order your Mac that this particular collection of text is an actual program , not just a textbook Indian file . Open Terminal , and usecdto sail to the directory where you saved the file . For example , if you bring through it to a folder named Scripts in your user ’s Documents directory , you ’d typewrite :
After you press Return , Terminal will move into that folder . Once there , expend this command to make the code executable :
Now you ’re ready to apply the script . To do so , just eccentric :
The./at the front is take because you ’re running the script from the directory you ’re currently in . you could run it from anywhere else you need , by just supplying the full path:~/Documents / Scripts / abwidgetmap.sh . If you find yourself doing this a lot , and you have some Unix experience , just move the script to a folder that ’s on your path .
The first fourth dimension you operate the handwriting , you should see this yield in the Terminal :
AddressBook Widget replaced - now using the Google single-valued function waiter Run this script again to revert it back to MapQuest Do n’t forget in order for the variety to take effect you must re - launch the AddressBook Widget in Dashboard . Just freshen the thingummy via Command - R wo n’t push the changes to take effect . you may also have two copies of the Address Book run - one with MapQuest the other with Google .
Important note
To make the change take effect , you have to close up the Address Book widget first ( in the Dashboard layer , obligate down choice , hover over the widget , and clack the close-fitting box ) . Just reloading it via Command - R wo n’t work . As observe above , this means you could actually have both mapping services useable . Just enter the Address Book thingamajig prior to running the script , incline the script , then open up another transcript of the thingummy from the Dashboard taproom .
There you have it — Google Maps in the Address Book contraption , easily two-sided , and you have n’t even modified the received widget at all !