AlomWare Toolbox Forum

General Category => Tips and Tricks => Topic started by: oblivion on May 28, 2026, 09:12:47 PM

Title: Case modification anywhere
Post by: oblivion on May 28, 2026, 09:12:47 PM
If you're anything like me -- half-decent typist but have to look at the keyboard more than a touch typist would -- you might get similar issues to one of my greatest bugbears -- hitting Caps Lock, forgetting it's on and typing a load of text with the case inverted.

lIKE THIS.

Last time I did it, I felt fairly sure that there was an action in Toolbox's default library that could deal with this -- and I couldn't find it. But there are script actions that can handle all that stuff, so I wrote one.

One caveat: it won't work if Toolbox isn't running as Admin -- or it won't for me, anyway.

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 Window: Assign active ""
0002 Clipboard: Clear all content ""
0003 ;Keyboard: Copy ""
0004 Macro: Type keys or use mouse "{z200}{ctrldown}{z200}c{z200}{ctrlup}{z200}"
0005 Action: Abort if no clipboard text ""
0006 String: Assign from clipboard text ""
0007 Alert: Ask for a choice "Case modification type?~iNVERT~lower case~Sentence case~Title Case~AL¬
L CAPS~"
0008 Action: Do next step if "alert$=iNVERT"
0009   String: Case swap ""
0010 Action: Do next step if "alert$=Title Case"
0011   String: Case title ""
0012 Action: Do next step if "alert$=Sentence case"
0013   String: Case sentence ""
0014 Action: Do next step if "alert$=lower case"
0015   String: Case lower ""
0016 Action: Do next step if "alert$=ALL CAPS"
0017   String: Case upper ""
0018 Clipboard: Assign text "string$"
0019 ;Keyboard: Paste ""
0020 Macro: Type keys or use mouse "{z200}{ctrldown}{z200}v{z200}{ctrlup}{z200}"
(End)

The sharp-eyed will probably wonder why I used a couple of macro steps to replace the commented-out 
Keyboard: Copy 
and 

Keyboard: Paste
commands. I think it's an idiosyncracy of my PC -- they don't work reliably for me, so I've used the macro steps to replicate copy and paste with some fifth-of-a-second delays plugged in, which DOES seem to be solid on my kit. By all means experiment: just use the "right click, toggle disabled step" on steps 3, 4, 19 and 20 to swap the Macro approach with the Keyboard approach to see if it'll work better for you that way. The baked in version is definitely easier to read!

The menu in step 7 can also be modified to present the options in the order you prefer: I have the option I use most at the top, but because of the way the rest of the code works, if you change the order of the options, as long as you don't change the text of the entries, it'll work fine.

The super sharp-eyed among you will wonder why I missed out an option for MiXeD cAsE. Simples: I never use it. If you do, by all means amend line 7 to

[font=Verdana, Arial, Helvetica, sans-serif]0007 Alert: Ask for a choice "Case modification type?~iNVERT~lower case~Sentence case~Title Case~AL¬[/font]
L CAPS~MiXeD cAsE"

and add another action block at line 18 like this:

0018 Action: Do next step if "alert$=MiXeD cAsE"
0019  String: Case mixed ""

And obviously assign the action to a memorable hotkey. 

So the usage is: highlight the text you want to modify, activate the hotkey you've chosen and pick the modification of choice from the popup menu. In my setup, because the Invert option is first, that's the default so all I have to do is press the Enter key if that's what I want.
Title: Re: Case modification anywhere
Post by: Paul (Lead Developer) on May 28, 2026, 10:44:00 PM
Hi oblivion. :)

Quote from: oblivionOne caveat: it won't work if Toolbox isn't running as Admin -- or it won't for me, anyway.

That would normally be if Toolbox has been run as standard and you're trying to do something on an admin window. I'm considering forcing Toolbox to always run as admin by default in a future update, to avoid these issues.

Quote from: oblivionI think it's an idiosyncracy of my PC -- they don't work reliably for me, so I've used the macro steps to replicate copy and paste with some fifth-of-a-second delays plugged in, which DOES seem to be solid on my kit.

I've emailed you a test version that should make "Keyboard: Cut", "Keyboard: Copy" and "Keyboard: Paste" work better. Please let me know by replying in this topic. Thanks!

Quote from: oblivionhitting Caps Lock, forgetting it's on and typing a load of text with the case inverted.

There's a system tweak in "Settings" that can partially assist with that:

(https://www.alomware.com/images/forum/caps-lock-auto-off.png)
Title: Re: Case modification anywhere
Post by: oblivion on May 30, 2026, 12:56:46 AM
The test version has a fair chance of replacing the selected text with C, which is what I was seeing previously too (maybe V depending on what was happening at the time.)

So my macro can't press C without the control key down and doesn't release the control key until C's been pressed, whereas -- presumably -- keyboard: copy works differently?

Oh, one observation: it's a capital C that gets typed, when I use keyboard: copy. Should it be ctrl-c rather than ctrl-C? Or shouldn't that matter?
Title: Re: Case modification anywhere
Post by: Paul (Lead Developer) on May 30, 2026, 03:51:22 PM
I can't reproduce the problem here. :(

As a test, can you change the hotkey trigger for your action to NOT use the Ctrl key, and report back? Set the hotkey to just be F9 or something. Or maybe the action still sees the Ctrl key being held down, so you might need to use the "Wait: For action hotkey to be released" step first at the start of your action.
Title: Re: Case modification anywhere
Post by: oblivion on May 31, 2026, 10:08:29 PM
Ah. Now that gave me an idea.

Adding

Wait: For action hotkey to be released ""
at step 2 fixed it. :)
Title: Re: Case modification anywhere
Post by: oblivion on May 31, 2026, 10:13:02 PM
The updated version of the code -- and I've added in the MiXeD cAsE block because removing unwanted blocks is easier than adding them -- is here:

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 Window: Assign active ""
0002 Wait: For action hotkey to be released ""
0003 Clipboard: Clear all content ""
0004 Keyboard: Copy ""
0005 Action: Abort if no clipboard text ""
0006 String: Assign from clipboard text ""
0007 Alert: Ask for a choice "Case modification type?~iNVERT~lower case~Sentence case~Title Case~AL¬
L CAPS~MiXeD cAsE"
0008 Action: Do next step if "alert$=iNVERT"
0009  String: Case swap ""
0010 Action: Do next step if "alert$=Title Case"
0011  String: Case title ""
0012 Action: Do next step if "alert$=Sentence case"
0013  String: Case sentence ""
0014 Action: Do next step if "alert$=lower case"
0015  String: Case lower ""
0016 Action: Do next step if "alert$=ALL CAPS"
0017  String: Case upper ""
0018 Action: Do next step if "alert$=MiXeD cAsE"
0019  String: Case mixed ""
0020 Clipboard: Assign text "string$"
0021 Keyboard: Paste ""
(End)