You can invoke a shortcut by way of an app’s Services menu, and this allows the user to run a shortcut on text selected in many apps. For example, the following shortcut replaces left and right quotation marks with regular quotation marks. It also removes all whitespace before and after each paragraph.
These shortcuts will show in an app’s Services menu only if text is selected.
These shortcuts worked reliably on my Sonoma computer with TextEdit, IA Writer Classic, Notes, FSNotes, Stickies, and Script Editor. The shortcut worked with Script Debugger except that the Clean Text shortcut would not remove leading whitespace. The shortcut did not work reliably with the Mail app.
The following is a revision of the Number Text shortcut. It differs in that it removes all leading whitespace from selected text, and it does not number any paragraphs that are blank or contain whitespace only.
This shortcut is similar to that above, differing in that a bullet character instead of a number is added to the beginning of each paragraph of selected text.
Occasionally a forum member will post a script without the required code formatting (3 backtick characters), which can cause errors. This shortcut fixes some of those errors by replacing:
left and right single quotation marks with single quotes;
left and right double quotation marks with double quotes; and
en dashes with two consecutive dashes.
Please note:
The shortcut trims whitespace from the beginning and end of each paragraph, but this can be removed.
I tested this shortcut on the script in post 9 of the thread (here).
The shortcut is probably best run by way of the app’s Services menu. Text must be selected in the app for the shortcut to be visible in the Services menu.
This shortcut works as a toggle to add or remove comment characters from the start of paragraphs of selected code. It is intended for use with Script Editor, Script Debugger, and Script Geek.
I edited three of the above shortcuts to fix issues. The following shortcuts number or add bullets to the beginning of paragraphs of selected text. Paragraphs that are blank or that contain whitespace only are skipped.