Insert time by typing doesn't include colon

I just updated to Catalina (10.15.1) and I have KM 9.0.3. I'm getting a very strange bug with this macro:

If I select "by Typing" this is what I get: 1747
If I select "by Pasting" this is what I get: 17:47

If I use %LongTime% instead, I get 1747:34 :thinking:

I fiddled a bit with Insert Token and at some point the text box turned white, then it worked correctly. I don't really know what I did, but it no longer works.

I tried this on mine, I have a very similar macro. I use it a lot. It seems to be working ok on mine, I tried the options you use. Changing the trigger can help too, Sometimes you can create conflicts with native shortcuts and so on. I would maybe try another shortcut. I use a text string trigger actually. "x t t " is mine. no spaces obviously!
Try though using the ICU formats direct so to speak.

Paste this in to the 'insert text by typing' box.

%ICUDateTime%HH:mm%

That should get the format you are looking for. There is a list of ICU formats, which are quite intuitive and you can guess them sometimes.

https://wiki.keyboardmaestro.com/token/ICUDateTime

Thanks, Tudor. Unfortunately, it still doesn't work.

Try deleting the macro altogether and then re doing it after a a restart, other than that I haven't got anything to suggest. Partly because it is working ok on my machine. I tried the exact macro you use, I couldn't find "%ShortTime%" in the token list by the way but I wrote it in. Like I said I use the format I suggested to you for my own version of this.

What I get from your macro, unless I have made some error, it is hard to be sure one copies something exactly sometimes, is this anyway, so I am not getting the result you are in any case.

15:10 PM

The "PM" being redundant though and it is wrong to my eyes.
The direct format I gave you gives what you want I assume which is

15:14

I am on 10.15.1 and the current Keyboard Maestro.

1 Like

This is a link to all the options, from the wiki page by the way

http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax

The ShortTime token should basically be based off your System Preferences, Language & Region, time settings:

But given it is Apple, who knows - probably look at whatever the heck iOS does and see if they have changed the Mac behaviour to match that.

2 Likes

Ahh obviously; that should have occured to me to look there. It is nice to know how it works though. I will have a good look at it for future reference. Dates are one of things one gets asked about most, well, what I get asked. I have mine set to 24 hour time in a tickbox and it seems that that is supposed to show as 00:00 AM So my %ShortDate% is working 'right' according to how Apple thinks it should anyway. I always used the 0000 format for time.

If you go into 'advanced' on the same pane you can adjust the elements of the date/time set up. Maybe @Nacho_Caballero might try that. Just go to where @peternlewis eter showed you in other words. On mine AM was up by default, I just knocked it off to try and %ShortTime% worked like you want it too.

I will continue to use the ICU codes direct as it were. They work fanastically well. I will say @peternlewis that I didn't find %ShortTime% in my tokens. I just typed it in. I didn't spend too much time on this though. I think @Nacho_Caballero has another kind of glitch. My dates work fine in the exact set up he has. If that is any use to you and I couldn't recreate his problem.

Thanks for the help, Tudor. I check the Language & Region format and those looked normal. The glitch is coming from somewhere else, but I've given up for now. I'll just stick to pasting instead of typing

1 Like

Just in case try again. I understand that 'typing' and 'pasting' should, and does for me, give the exact same results from all formats I tried and the native preferences ones. I checked, it was an useful excercise for me. Do you have any 'snippets' or shortcuts using the < : > as a trigger? If so you might check those to see if some snippet is being triggered when you type. A 'delete' action for example?

Worth going again to the native short time format. Though I can't see off hand, it could work.
Look again and rewrite the blue tags you will see in the window. Go to Preferences > Language and Regions > General > Advanced

click the Advanced button another dialogue box will appear. Click "Times" like @peternlewis showed in his reply. Go to 'Short' and put the cursor in the box and delete the blue tag things. All of them, then re enter in the order you want by dragging the elements you need into the box.
You will need to WRITE IN YOURSELF the separators you want < : > in your case and that is what %ShortTime% will show. I know this is unlikely to help but sometimes a full rewrite can repair a glitch without one ever knowing what it was.

Why do you want to type instead of paste anyway? IF is is because you don't want to clutter a clipboard with things you don't need, try using the "Delete Past Keyboard" action. I found this very useful. My clipboards were so cluttered with dates and snippets that I was pasting that I turned to typing macro. But I found that the Delete Past Keyboard action solved that for me. I know some password boxes and so on will only take typing. I think there are other contexts maybe where one would prefer. I like actually to have things type. I don't know why. Sometimes it eases formats and so on?

Correct. And I am sure it is for @Nacho_Caballero too - Keyboard Maestro first determines what it will insert, and then later determines how to insert it, so certainly regardless of pasting or typing Keyboard Maestro will endeavour to insert the same thing.

So if they are producing different results, it will be caused by something that is happening in the different processes. Several things could generate different results. For example, an application could capture ⌘V and do something different, and then Insert Text by Pasting will do something different. Or the typed characters could mean something special, for example return or tab characters could easily change fields, but they would not be processed with Insert Text by Pasting.

In this case, if Insert Text by Typing and Insert Text by Pasting are getting different results, and the Pasting one is getting the colon and the Typing one is not, then something is swallowing the colon - maybe a hot key, maybe some sort of typing shortcut, maybe just bad processing of text (eg typing in to a web page will often lose characters if the web app is messing with the field while Keyboard Maestro is typing).

1 Like

Thanks for the under-the-hood information @peternlewis I had the notion that something like that could be happening not the details though. Would it help @Nacho_Caballero if he checks his own self-authored triggers and snippets then; as I said? Just in case so to speak.

I get it I think. If you pasted in a string trigger it wouldn't 'work' as a trigger in other words, but if you type it in, even using an insert text by typing action, it will. I experimented and saw that is what happens and that was interesting. You could in fact paste something in you normally use as a trigger string and leave it intact as it were. I can't see any situation where I would need to do that though and it gets very complicated, from an user point of view, very quickly.