IvanMathy / Boop

A scriptable scratchpad for developers. In slow yet steady progress.
https://boop.okat.best
MIT License
3.84k stars 356 forks source link

Automatic script execution on each space, key or shortcut press? #291

Open federicocandiago opened 3 years ago

federicocandiago commented 3 years ago

Hi Ivan, hi team,

While I understand you value performance and such a feature would have a limited use scenario, I'd find it very useful to use Boop for real-time text analysis (e.g. word count, start case) without the need to press cmd + B + function name each time.

Maybe there's already a way to do that and I didn't see it on the documentation, but otherwise I wonder if it could make sense to either:

Since in many cases I end up using the integrated text editor directly more than what I copy\paste, I assume* such a feature would save me (and probably, many of us end users) a lot of time, but it couldn't be integrated as a script.

Thanks for the amazing job!

gustaf71 commented 3 years ago

You could try shift + cmd + B or you could use the menu bar item Re-execute Last Script

federicocandiago commented 3 years ago

Thank you!! I already tried that, but it passed under the radar as the recalculation will be executed

I don't know if it's expected or a very specific problem only affecting my platform - I'm using Version 1.3.1 (18) on a MacOS 11.4 2017 Intel MacBook Air - as I see no issues or recent PR addressing this. In case it's not expected, would it be useful if I built the project and tried to log it? My knowledge of Swift if next to nil

gustaf71 commented 3 years ago

Maybe I didn't understood you, the test case I made was.

'hello world!'

and use Add Slashes, the first time I use cmd + B and type add slashes and return next, remove the text and write a new string 'hello world again!' and use shift + cmd + B to apply the last function 'Add Slashes' for me it works.

I use Mojave but I find other issues with the function Add Slashes...

federicocandiago commented 3 years ago

You're right, I tried with most of the text transformation scripts and the problem appears to be only with the count words\strings\characters cases.

If it can help, here's a quick video.

gustaf71 commented 3 years ago

If you like to try other approach you could do the same in Automator with Run AppleScript Action. You could set a shortcuts to execute the services from any Editor there you type text and like to know the count of selected text.

Quick Action, text input

on run {input, parameters} set {theChars, theWords, theParagraph} to {count character of item 1 of input, count words of item 1 of input, count paragraph of item 1 of input} display dialog "Count every Character, Words and Paragraph of Selected Text" & linefeed & linefeed & "Character: " & theChars & linefeed & "Words: " & theWords & linefeed & "Paragraph: " & theParagraph end run