Double clink including "-"

I have routines works for double clicking like xxx-yyy-zzzz.
I wonder if keyboard Maestro can help to grab/copy at once for xxx-yyy-zzz type of text by double clicking. Keyboard make me happy for reducing a lot of routine work so hope here is solution with keyboard Maestro to solve.
Please advise if there is other way can grab xxx-yyy-zzzz type of text by double clicking at once.
I am usually working such on Chrome browser. Wondering if other browser can support such. xxx_yyy_xxx working, not

If you're always going to be working with text that has exactly two hyphens, then just double click the first part (xxx), then use OPTION-SHIFT-RIGHT ARROW twice (either manually or by setting up a macro to do it).

Good advice. I could enhance that a little but the main problem is that KM can't trigger based on a double click. Or even a click. If glore agreed to using a hotkey instead of a double click, (or maybe a different mouse button) then I think we could make that work, but that's not what he asked for.

His questions was quite reasonable. I'm sure many people would benefit from this if there was a solution. I would guess that the browser isn't relevant here, as double click is probably handled by macOS.

Many thanks for prompt advise.
I would like to see a solution for just double clicking to grab once.
Original text is Order# xxx-yyy-zzzzzz.
Is there some way to make hot key by detecting Order# through Keyboard Maestro and grab xxx-yyy-zzzzzz automatically for copy and paste purpose.
Many thanks for advise - opt+shift+key works well but still not handy

hot key is very good as well insteps of doublicking. Thanks.

Here's an alternative idea that may help in the meantime. Most people do't know about this feature. If you select text, either short or long sequences of text, and let go of the button, you can still extend the selection by clicking a second time within the selected region in order to extend it. This works in most apps. It's not what you asked for, but it may be helpful to you in similar cases.

Wold you be willing to press a keyboard hotkey (rather than the primary mouse button) in order to get this effect? (EDIT: I see you said yes.) Or alternatively, would you be willing to get a mouse with extra buttons and use those buttons to double click instead of using the primary mouse button? We might be able to get that to work. I'm testing this idea out right now on my multi-button mouse.

Thanks Sleepy! Great! Let go works but still not what I wanted. I am using multi button mouse, logitec MX master 2 witch can assign hot key or macro, so both can work for me, keyboard and mouse.

BTW, I have little code experience long time ago. What would you recommend to master KM? Could you also recommend other tools which is helpful for automation on Mac. Especially, together with Excel, Keyboard and Mouse productivity.

Once again, very much appreciate for quick advice.


In no particular order:

Step 1. Tinker with the actions that you can figure out on your own. Maybe create a loop with a Prompt User for Input and try to create a number guessing game.

Step 2. Read through other people's macros for ideas and examples. On this forum there is a page where people upload their examples. Most of the examples contain some very complex code, but you will make some great discoveries there.

Step 3. Find the "single page" version of the KM documentation and read as much of it as you can. This is the single most important thing I've done. That is an extremely important resource. But it cheats, because it's not complete. There are a couple of other pages of equal importance such as and These are the pages I visit most often.

Step 4. If you don't have any experience with the languages that are related to KM, like AppleScript, Javascript, Swift, HTML, just ignore actions that deal with them. They are essentially powerful extensions to KM and for most of our purposes they aren't necessary.

Step 5. One of the things that took me a couple of weeks was to understand the difference between text and number fields. I still get thrown off by this from time to time. When you click inside a box there's now a little T or V or C appearing in the upper right corner of the box to assist with this trickiness. That little symbol is your best friend. It tells you whether you can use variables directly, eg, "Counter", or whether you have to indicate whether you are using a variable, eg, "%Variable%Counter%". And in certain cases you indicate variables like this: "$KMVAR_Counter".

One more idea that takes time to understand: I don't know how it's implemented at a low level, but there seems to be a quasi-compiler to it. When you edit an action, there's an invisible compilation process that occurs approximately one second after you type it (after you stop typing, apparently). So if you are typing something and the macro gets triggered while you are typing (eg, a timer trigger), your most recent changes won't be executed because it takes some time for KM to decide when to compile and then to do the compiling. Most people will never have to understand the underlying mechanisms here but I find it has enriched my programming life to have figured this out. I wish it was better documented. Sometimes I wish I could turn off this auto-compile feature because it frequently causes my KM Editor to pause. It's probably the most annoying thing about KM. The pauses are always less than half a second, usually less than 0.2 seconds, but I find them extremely noticeable. But it's a small price to pay for programming perfection.

Well, maybe not perfection, but pretty good. It could probably use some enhancements like data more structures (although it did just introduce JSON which I haven't got under control yet), functions (we can always hope - perhaps instead of "functions" we could create a macro that compiles into a customized action? That would be pretty cool), more actions to support more ways to output data (eg, an action to put output into the system menu), and so on.

Apple doesn't have a stellar track record in the automation department, so I think Apple would be wise to make the author of KM an "offer he can't refuse" (a good one, not a bad one) and then pour more resources into this product so that we could have things like functions, inheritance, portability, etc. The current owner of KM has to have a plan for what happens to this product after he dies (which is never, I hope) and perhaps that plan is to make it public domain, or to give it to one of the super-elites on this forum, or to auction it off to the highest bidder: I don't know. If it was me, I'd auction it off to the highest bidder.

If you are satisfied with either a mouse or hotkey, I think I wrote a hotkey solution for you yesterday but it doesn't appear that I uploaded it. Let me check my code folder and see if I can upload it.

I'm retesting the code now and it seems to have a bug. I have to re-read my code to find the bug.

EDIT: Ok it works again. Let me attach the code below. In my case the trigger is F3. Of course you can change that. We can also make it trigger on a mouse button, but I'll explain that later. Try it out. I can't guarnatee it's bug-free. Move the mouse over a telephone number FIRST then press F3. Or change that hotkey to something else.

My code uses four global variables. These probably should be converted to Local variables. It's sloppy programming here to use global variables. My code puts the number into the clipboard, and I decided also to display the number in the uppwer right corner of the screen. You can get rid of that if you want to. Here are some phone numbers you can test on right now: 555-555-1212. And (555-555-3434). And 12-34-56-78. And 534-6534-6543. And 54-543-543-543. Hmm, my code doesn't work if the phone number spans two separate lines, but that's probably okay for now. That would be fixable but would at least quadruple the amount of code. NOTE!!! -- Hmm, it was working on this page when I was drafting this message, but now it doesn't work on the final web page. There must be something about web pages I don't understand. This macro should work for other apps like Pages, but I may have to investigate why it won't work on certain kinds of web pages. You didn't indicate above whether this code had to work on Pages or on Safari or what applications.

Select phone number.kmmacros (7.8 KB)

Dear Sleepy,
I am on trip so I will try. Million thanks for your kind advise.
Will come back if any.
Best Regards,