Is there a way to check last character at text cursor in the if then else condition?

Application: Pages
I have assigned a hotkey to add some id in the format "#1234"
Sometimes my text will already have a placeholder "#" I want to automate the process of checking for the "#" at current cursor position and just add "1234" if "#" already exists.

KM has impressed me so far. Let's just hope there's a solution for this!

Thanks in anticipation

Yes. Here's an example macro to get you started.
It does nothing but test for the character. You need to add the actions you want.
I tested using TextEdit, but it should work the same in any app, including Pages.

MACRO:   Test For Character Just Prior to Text Cursor [Example]

~~~ VER: 1.0    2018-07-14 ~~~


Test For Character Just Prior to Text Cursor [Example].kmmacros (5.1 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.




Oh wait, I think I didn't explain it right. I meant that the Pages document already has the # not the system clipboard

I understand. Did you try the macro?
It selects the last character in the app, copies it to the clipboard, and then tests for the character. Read the macro. :wink:


1 Like

Oh sweet. Nice. Thanks

Works like a charm!
You're the man!
Thanks a lot!

1 Like