Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.3: Add a burger locator to Address Book Apps
Giving credit where it's due, this was originally posted on the Apple Discussions forum by b.neely. Address Book now supports plug-ins for the rollover action menus in the card. They can be written in Carbon, Cocoa, or AppleScript. The remainder of the hint has a sample AppleScript plugin. See the steps below the script for installing it on your computer.

[robg adds: This is the first of two hints today containing sample Address Book plug-ins created using AppleScript. This extensibility could be very useful...]

2005 Update: Please see the comment by magnamous below for an updated script that works in 2005 (as the company website has changed).


--burger time! 
using terms from application "Address Book" 
  on action property 
    return "address" 
  end action property 

  on action title for p with e 
    if zip of e is missing value then 
      return "In-n-Out Burger locator (zipcode required)" 
    else 
      return "In-n-Out Burger locator for zipcode " & zip of e 
    end if 
  end action title 

  on should enable action for p with e 
    if zip of e is missing value then 
      return false 
    else 
      return true 
    end if 
  end should enable action 

  on perform action for p with e 
    set burgerURL to ¬
   "http://www.in-n-out.com/cgi-bin/zipsearch.pl?zipcode=" & zip of e 
    tell application "Safari" 
      set browser to make new document 
      tell browser 
        set URL to burgerURL 
      end tell 
    end tell 
    return true 
  end perform action 
end using terms from 
To install on your computer:
  1. Copy the script above, between the dotted lines
  2. Open /Applications -> AppleScript -> Script Editor.app
  3. Paste the script into the top of a new script window
  4. Save the script using these settings: Save As: in-n-out burger locator, Where: ~/Library -> Address Book Plug-Ins/; File Format: Script; Options: [x] Run only
After installing the plug-in and re-launching Address Book, you will see a new menu item in the rollover menu for a postal address. Note that this is intended for addresses in the United States that have a zip code. I recommend having Safari already running when you use it.
    •    
  • Currently 1.75 / 5
  You rated: 2 / 5 (8 votes cast)
 
[27,254 views]  

10.3: Add a burger locator to Address Book | 16 comments | Create New Account
Click here to return to the '10.3: Add a burger locator to Address Book' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Add a burger locator to Address Book
Authored by: zedwards on Nov 16, '03 11:13:37AM

OK, so this is pretty cool...Now, are there other URL's that could be used for something a bit more worldwide and lo-cal?? ;)

I am trying to think of something, but am in need of some coffee first. How about a non-starbucks coffee place? Or a wireless location?



[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: zedwards on Nov 16, '03 11:33:48AM

By replacing zip with state, and the URL "http://www.in-n-out.com/cgi-bin/zipsearch.pl?zipcode=" with "http://www.ezgoal.com/hotspots/wireless/list.asp?points=" yeilds almost what I want.



[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: mervTormel on Nov 16, '03 01:16:41PM

small note: rollover is misleading; it implies no mouse button (e.g., the yellow "tool tips" boxes are a rollover effect).

it should be stated that the result of this script is a contextual menu item, and requires a right/control click on an address to see the effect.



[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: aranor on Nov 16, '03 05:58:08PM

Actually, a left-click on the address title works just as well.



[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: sjmills on Nov 16, '03 10:18:35PM

This didn't work for me until I added .scpt to the end of the file name. I hate that! It's a Mac, not a DOS box. iCAR has the same bug.



[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: aranor on Nov 17, '03 02:47:42AM

Did it have a filetype/creator set appropriately? I'd venture that it didn't, at which point, without an extension, there's no way to tell that it's an AppleScript.

Besides, I much prefer extensions to filetypes - much easier to tell what it is and easier to change (not to mention easier to deal with as a programmer)



[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: sjmills on Nov 17, '03 11:46:35PM

Yes, it was set correctly. I use Script Debugger, which always sets the type/sig.



[ Reply to This | # ]
re: extensions
Authored by: gopes on Nov 17, '03 05:09:59PM

When I tried the hint, the default was set to hide the file extension, meaning that Script Editor added the extension for me, then hid it in the Finder. I imagine it's just a fluke.



[ Reply to This | # ]
10.3: Applescript to Dail with Modem
Authored by: ces3001 on Nov 19, '03 06:50:33PM
I'm looking for a (free) way to use an AppleScript plug-in in Address Book to dial the a phone number with my modem, so that I can then just pick up the receiver on my phone to talk with the person. I've looked far and wide and there are no OSAX or other freeware programs that do this with AppleScript, as far as I can tell.

Javier Díaz Reinoso provides a Cocoa "dial with modem" program, with source. Any one care to make it AppleScriptable?

[ Reply to This | # ]

10.3: Applescript to Dail with Modem
Authored by: Venturia on Apr 28, '04 02:57:11PM

Hi, I found this which could help out:

http://homepage.mac.com/javier_diaz_r/dialModemOSAX.dmg

I only wish someone could make a custom version where calling cards etc could be handled.



[ Reply to This | # ]
10.3: Applescript to Dail with Modem
Authored by: davec on May 03, '04 01:46:52PM

Then there is the excellent (applescriptable?) "AB Dialer"

http://www.macronsoft.com/pages/en/abdialer.html



[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: Don Faulkner on May 05, '04 02:05:23PM

I discovered that In-n-out's web locator doesn't understand zip+5 formatted zip codes. As such, I've made a few modifications to the script. In essence, checking for zip of e is fine if all you're concerned about is whether it's defined or not. When actually referring to it, you only want characters 1 thru 5, but for some reason characters 1 thru 5 of zip of e doesn't work. So, I do the following instead:


set zipFull to zip of e
set zipFirstFive to characters 1 thru 5 of zipFull
return "In-n-Out Burger locator for zipcode " & zipFirstFive

...

set zipFull to zip of e
set zipFirstFive to characters 1 thru 5 of zipFull
set burgerURL to ¬
   "http://www.in-n-out.com/cgi-bin/zipsearch.pl?zipcode=" & zipFirstFive

I'm just getting started with apple script, so I'm sure there's a more efficient way than calculating the first 5 characters twice as I've done here, but it's not currently worth my time to figure it out. Of course, if someone wants to enlighten me, I'd be very appreciative.



[ Reply to This | # ]
Script modified to use 192.com
Authored by: jasonpkitcat on May 28, '04 02:40:38AM
I've modified this script to form a plug-in to look up UK phone numbers using 192.com, the editable script can be downloaded at: http://www.j-dom.org/h/n/LINKS/HOME/ALL/54/

[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: disappearinjon on Nov 26, '04 09:51:44PM
I've used this plug-in as the basis for a zip-code locator plug-in for US addresses. It can certainly use some work, but you can find it in my blog.

[ Reply to This | # ]
10.3: Add a burger locator to Address Book
Authored by: alajuela on Nov 29, '04 03:21:18PM

Heck, we could probably make a list of search URLs and start spitting these out for lots of vendors. I started to check the Starbuck's site for the search input form, but got interrupted. Anyone have more locator URLs?



[ Reply to This | # ]
Updated for 2005
Authored by: magnamous on Jul 12, '05 04:15:49AM
I updated the script in this hint because the company's website changed. The new version works fine on my computer in 10.4.

--burger time! 
--locate the nearest In-n-Out Burger joint
using terms from application "Address Book"
 on action property
            return "address"
      end action property
   
      on action title for p with e
          if zip of e is missing value then
                     return "In-n-Out Burger locator (zipcode required)"
           else
                  return "In-n-Out Burger locator for zipcode " & zip of e
              end if
        end action title
      
      on should enable action for p with e
          if zip of e is missing value then
                     return false
          else
                  return true
           end if
        end should enable action
      
      on perform action for p with e
                set burgerURL to "http://www.in-n-out.com/locations.asp?transaction=search&country=us&template=map_search&pWidth=450&radius=20&x=0&y=0&postalCode=" 
& zip of e
         tell application "Safari"
                     set browser to make new document
                      tell browser
                          set URL to burgerURL
                  end tell
              end tell
              return true
   end perform action
end using terms from


[ Reply to This | # ]