Subscript Paste Macro [₀₆.₁₆.₂₀]

Hello,

Does anyone know how to create a trigger that paste the current date in unicode subscript? i.e. Converting 6.16.20 to "₀₆.₁₆.₂₀"

I've been using this website to convert but would love to be able to quickly convert using KM.

This is the closest I've come but since it it not unicode the text does not appear in subscript in certain fields.

Thanks!

Date From Typed String Macro (v9.0.4) doesn't quite get you there (it prints the whole year) but you can easily fix that.

Thanks @mrpasini for sending that. I'm still a bit unclear on how to convert it to subscript unicode. Would you mind explaining that part?

Find this action (up top) and change the format to match this:

ss-416

When you type =td you'll get 06.16.20.

This is not subscript. Which is what the author is looking for.

Maybe this

That does look like it would work. Can you please send a link to it?

I began to mirror what you suggested but I want to make sure it’s identical.

@Zachary_Schulze

Thanks, Zachary. I completely missed that spec.

This isn't as elegant as @Zachary_Schulze's script, but it seems to get the job done:

Subscript Date.kmmacros (3.2 KB)

I wonder if this could be tidied up by noting both the unsubscripted and sub scripted character code points are contiguous. So a calculation could be done.

Date to Subscript.kmmacros (2.4 KB)

@Jarett Here you are, now just assign a trigger and you'll have ₀₆.₁₇.₂₀₂₀ at your fingertips.

I simplified the JS as well to look like as well

var kme = Application("Keyboard Maestro Engine");

var normalDate = kme.getvariable('tempdate');
var subscript = {
    "0": "₀",
    "1": "₁",
    "2": "₂",
    "3": "₃",
    "4": "₄",
    "5": "₅",
    "6": "₆",
    "7": "₇",
    "8": "₈",
    "9": "₉",
    ".": "."
};

kme.setvariable('donedate', { to: normalDate.split('').map(c => subscript[c]).join('') });

Thank you so much @Zachary_Schulze! It works perfectly.

1 Like