Repetitive tasks: macros?

I’m doing an operation quite often.

Is there a way to invoke a macro to do repetitive tasks?

For example, I want to move a mesh to align with a point (or points) on another mesh.

Currently I pick the mesh to move, change into edit mode to select points, move the 3dCursor to the points (or point), change out of edit mode and move the mesh’s origin to the 3dcursor, then click the second mesh, change to edit mode, select the point that I want the second mesh to move to, move the 3d cursor to that point, exit edit mode, select the first mesh and select “move selected to 3d cursor”.

Would a macro be the answer?

Or does anyone have a simpler way of achieving this?

Better to have a specific example so clear what you want.

Have you tried using the snapping options (magnet icon on 3d view header)

If you want a macro you’ll have t write your own python script.

Thanks for the response.

I’ve looked into writing a python script to automate this, but am having difficulty finding how to get the location of the mouse cursor.

I’m looking at bpy.context.screen.areas, but I can’t see a method of getting the mouse coordinates.

Then I’ll need to convert the mesh vertices into screen coordinates…