Alternatives to Accomplish a Select All / Delete in Uncooperative Text Environment

I work from home, remoting in to a Windows 10 box. I'm paid to correct oodles of badly optical-char-recognized scanned-in form text in an application called Teleform Verifier.

I spend a lot of time nuking text that looks like a drunken cat walked across the keyboard and then macro-entering boilerplate organization name or address or whatever (which are stored in macros of course). It's the select existing garbage / delete that's causing the current problems.

Stupid ^$@!#@ app doesn't have a Select All function. You'd think Ctrl-A would be universal on text-centric Windows apps. What is supported is Home key (positions cursor at left of current line) followed by Shift-End (positions cursor at far end of current line and selects all in between), followed (where necessary) by an up-arrow (moves to next line up if there is one, pulls a line of text up to the cursor if there are only lines below current line) and repeat, with deletes after each selection.

Recently, the IT folks changed how they have us remoting in -- it was previously via a Java-based mini-app that combined VPN with remote access all in one package, now it has to be separate Pulse VPN and Microsoft Remote Desktop Connection to remote in. Under the old connection routine, I had a working macro that did Home / Shift-End / Delete, and a more complex one that called that over and over with up-arrow keys in between. But the new combo they require somehow causes Keyboard Maestro to be unable to send the Home key or arrow keys. (same macro works fine when aimed at my local text editor).

Anyone got any suggestions for how to implement a "delete existing text" macro in this multi-dependency environment? (NOTE: the Windows environment itself is pretty locked down; I'm not going to be able to install software although it might be possible to store a command-line cmd or something)

Up until para #4, all you mentioned was Windows apps. Then you refer to Keyboard Maestro. I'm not sure what's happening yet. Are you on a Mac with KM? Are you using a web browser or some other app to access a remote Windows machine? I'm not able to put the pieces together yet.

The computer I sit at is a Mac, running Mojave.

On it is an application called Pulse Secure which establishes a VPN Connection.

Also on it is Microsoft Remote Desktop Connection — it connects to a Windows box elsewhere and lets you run it, using your own screen and keyboard and mouse, much like Apple's own product Remote Desktop, or like Timbuktu Pro, LogMeIn, GoToMyPC, Splashtop, VNC, and a host of other remote access apps, although it's a bit unusual in that it's actually establishing a separate "session" of that account being logged in on that piece of PC hardware rather than remotely controlling the session that you'd see if you were standing there.

Keyboard Maestro is installed on my Mac and sends its macros to the application Microsoft Remote Desktop Connection, not to the Windows apps (which can't be distinguished and identified from the Mac environment). In this way it is like setting up a macro and aiming it at Parallels or VMWare when you actually intend to control an individual app within the virtual machine -- it works as long as the applicaton in question is the frontmost app.

Hope that clarifies things --?

I think that clarified, but now I have to ponder this to see if I'm able to offer ideas.

I love the kind of work you have to do. Dealing with badly formatted text and finding ways to automate text processing. Sounds like a dream job to me.

So this is the problem. Those keys aren't being sent. It might be helpful if you can show us your macro. It can be hard to troubleshoot a bug if we can't see the code. Sometimes we can, but there are so many variables in this case that the code might be needed. But even if you can't share it, I still have some questions and ideas....

  • This might be a timing issue. Can you consider placing PAUSE statements between your actions? Some apps cause problems by flushing the input buffer from time to time, so PAUSE statements might be needed.
  • Have you tested to see exactly which keys KM is able to send? If we saw the list, something might ring a bell. Perhaps you can write a macro that tests all the keys individually.
  • Have you tried sending the keystrokes manually since they changed your software? (This seems so obvious, but I don't want to assume anything. Maybe you didn't try it.)
  • Are you using an Apple Keyboard? Does it have a dedicated HOME button? I'm not sure if this is relevant but I want to ask.

Those are my ideas for now. If one of them solves the problem, great. If not, I'll try again, or maybe someone with more experience can chime in.

Weirdly, the macros I set up started working, shortly after I tested it in Notepad to see if the key presses were indeed not being sent. It deleted text just fine out of Notepad. So that left me thinking "Hmmph, it's some weirdness with that Teleform program, and it's going to be nearly impossible to debug since Keyboard Maestro is sending the key presses".

But then it started working in Teleform as well. newbie question: I know I can screenshot my macro and host that and post a link to it, but I suspect this forum has an easier way to post macros, yes? How's it done?

There is an explanation of how to post macros here:

More info:

The triggering keystroke definitely makes a difference. When the multi-step macro is set to Ctrl-Option-clear, somehow the Windows environment is seeing and reacting to the Option (Alt) key and doing Windows-esque things with that. The same macro behaves itself when the trigger is changed to Shift-Clear.

To add to the weirdness, OTHER macros that make use of Ctrl-Alt-whatever are working normally.

That means my second idea in my four bullet list is still a very good thing for you to investigate. I can't investigate it because I don't have your software.

Perhaps you will be satisfied just by switching to a shortcut key that works.

Here is the simple & elegant version of Delete Field Contents that ought to work but simply doesn't:

Delete Field Contents Debugtext Macro (v10.0.1)

Delete Field Contents Debugtext.kmmacros (3.3 KB)

Here is the klunky but functional replacement that DOES work, when called by itself, to nuke a single line of text:

Delete Field Contents Macro (v10.0.1)

Delete Field Contents.kmmacros (10 KB)

Where the wheels really fall off is calling a script that tries to get rid of a multi-line "paragraph" of garbage text.

This actually works when the hotkey that calls it is Shift-Clear but starts trying to invoke Windows pull-down menus instead when the hotkey is Control-Option-Clear:

kill a bunch of text Macro (v10.0.1)

kill a bunch of text.kmmacros (11 KB)

I downloaded your first macro. It doesn't have a trigger. Was that intentional? In your screen shot it says it "triggers on Click" but I don't know what that means. Click on what? I don't know how you managed to upload a macro that doesn't match its screen shot.

Your second macro contains the same action about 20 times in a row. Did you know you can put that in a Repeat action so that you can reduce that code? When you say "you call it by itself" I presume you mean you call it using the trigger. If so, good. It works.

Your third macro works for one hot key but doesn't work for a different hotkey. Well, are you satisfied with using the hotkey that works (shift-clear)? Or do you really need the other hotkey to work (Ctrl-Opt-Clear)? It wouldn't bother me too much if I had to switch to a different hotkey to fix a problem.

Perhaps someone else here can spot what's wrong with the macros you uploaded, but without your third party apps, I can't test. However I did give you a list of four ideas for troubleshooting and the first 2 (or 3) ideas from my list are still worth your consideration. Did you try them? The best way to try idea #1 is to use the KM action "Set Between Actions Delay for this Macro" to some test number, say 0.2, and see if that changes anything. If that changes your symptoms, it's probably a timing issue.

The first macro has its trigger disabled at the moment because it does not work. I had it tied to Ctrl-Option-End, same as the second ("klunky") macro.

A strong clue is that an "insert text by typing" macro that's supposed to do "2nd ave @ 4th st" instead inserts "2nd ave 2 4th st". When replaced with "insert text by pasting", it results simply in "v".

Clearly the Microsoft Remote Desktop Connection's relationship to my actual hardware keyboard is different from its relationship to the keypress signals that Keyboard Maestro is sending along.

That sounds like the all-too familiar timing problem: KM is typing faster that MS Remote can keep up with. If it really is that, then try inserting a Set Action Delay action (action:Set Action Delay [Keyboard Maestro Wiki]) and change the Simulate Normal Keystroke Delay to something a bit bigger than the default of 0.001 seconds - maybe 0.01?

Gave it a try. Delays of 0.01, 0.1, 0.5 seconds each tried, no difference.

The Windows application all this is going into is Teleform Verifier which renders anything typed in as ALL CAPS, it's an upper case only text environment. I notice now, while using Notepad to test, that the shift key is always ignored. A macro set to insert 2180 3rd AVE instead inserts 2810 3rd ave.

Macros that attempt to use other modifier keys don't work either. A macro set to insert text by pasting instead puts in a v. (I guess Keyboard Maestro is attempting to automate pasting by doing command-v? it's ignoring the command key and just deploying the v key by itself). Weirdly, though, macros to which I've assigned hot keys that include the control or option keys tend to misfire, with the MS RDC environment behaving as if I'd typed Alt-something and invoked a Windows application's dropdown menu. Fortunately, Shift-something doesn't do that.

Oh well - it was worth a shot :upside_down_face: