Scrolling ToolTip until User Presses Shift Macro (v11.0.3)

The Keyboard Maestro "Display Progress Bar" action truncates the text message after approximately 275 pixels (roughly 40 characters.) I decided to write a macro that will actually determine if the text message is wider than 275 pixels, and if so, "roll" that text through the window instead of simply truncating it. This makes sure that the message is always readable no matter how wide it is.

In addition, I went to a lot of work to make the scrolling as smooth as possible. So, for example, if the letters "M", "W", etc. appeared, the scrolling would take a little longer because those letters are wider, while letters like "i", "j", "1" would scroll a little faster. I'm not really sure if this was very effective or not, but it was fun to write.

You can adjust the speed of the rolling text by changing the value of the variable "LocalDelay" at the top of the macro. On my Mac, the best value seems to be 0.1, but you can increase that value to slow down the text, or decrease it to speed up the text.

I have another version of this macro that actually calculates the precise width of each ASCII character, instead of estimating it, but that requires a one-time initial font calculation macro which I don't think most people want to deal with.

This macro ends when the user presses the Shift key. I wasn't sure what was the best way to end this macro, since its very nature requires that it run in a loop. If you think of a more useful method of stopping it, I can update the macro to suit your requirements.

Sorry about the spelling error in the name of the macro!

Scrolling TooltTip until User Presses Shift Macro (v11.0.3)

Scrolling TooltTip until User Presses Shift.kmmacros (15 KB)

1 Like

I probably won't be using this, but I think the concept is really cool! I'll bet it was a lot of fun writing it. :slightly_smiling_face: It's the exact kind of thing that would grab my attention and get the juices flowing.

As for calculating the width of the text, it's too bad you can't do it in JavaScript in a browser, because you could easily write some code to get the system to calculate the exact width.

But I can't really imagine how to do that with your macro. The only reason I'm mentioning it is in case it spurs some other ideas.

Anyway, tres cool!

1 Like

I was able to do it by using the "Composite onto Image" action in KM, with the option "composite text". I would use that action to write 100 of each ASCII character onto the canvas and then use the Trim Image action to get the width of those letters.

1 Like

Creative! I'm pretty sure that's one of those actions I've never even heard of. :joy: