It came from down the rabbit hole: Phone number transformations on the fly

Sometimes you copy and paste a phone number from somewhere and the format isn't right for what you need. Reformatting a phone number takes mere seconds, but I wanted it to take FEWER seconds and I didn't want to have to click the stupid mouse so damn much.

During execution, each macro repeatedly selects text to the left of the cursor to check the format and act accordingly, including a final check for "+1" to strip that out. If you care, the DIGIT STRING macro will strip off the +1 from a string like +15555561212.

2021 03.27 MACRO GIF

I had time on my hands. What can I say? Enjoy!

These three macros (disabled by default) are triggered by a typed string at the end of the phone number, in whatever format:

  1. Converts to a 10 digit string format.

PHONE NUMBER - DIGIT STRING (STRING TRIG).kmmacros (58.0 KB)

image

  1. Converts to a dash format: 123-456-7890.

PHONE NUMBER - DASHES (STRING TRIG).kmmacros (47.8 KB)

image

  1. Converts to the parens format: (123) 456-7890.

PHONE NUMBER - PARENS (STRING TRIG).kmmacros (49.9 KB)

image


I just made these. I have done limited testing, but they seem to work successfully, repeatedly. However, caveat emptor, as always.
3 Likes