Shortcut to execute a Macro or Script
Here's a quick example adapted from the ObjectCursorArray tutorial in the API documentation.

You should be able to run this in the text editor, and then pressing Numpad 0 in Object view should result in the "do work here" text printing to the console window (in OSX/Linux you have to launch Blender from the terminal to see the console output).

Note: once you copy this script into blender, you may want to check that the tab structure is still correct for each line.

bl_info = {
    "name": "Work Macro",
    "category": "Object",
}

import bpy


class WorkMacro(bpy.types.Operator):
    """Work Macro"""
    bl_idname = "object.work_macro"
    bl_label = "Work Macro"
    bl_options = {'REGISTER', 'UNDO'}


    def execute(self, context):

        print("do work here")

        return {'FINISHED'}


# store keymaps here to access after registration
addon_keymaps = []


def register():
    bpy.utils.register_class(WorkMacro)

    # handle the keymap
    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
    kmi = km.keymap_items.new(WorkMacro.bl_idname, 'NUMPAD_0', 'PRESS', ctrl=False, shift=False)
    addon_keymaps.append(km)

def unregister():
    bpy.utils.unregister_class(WorkMacro)

    # handle the keymap
    wm = bpy.context.window_manager
    for km in addon_keymaps:
        wm.keyconfigs.addon.keymaps.remove(km)
    # clear the list
    del addon_keymaps[:]


if __name__ == "__main__":
    register()