Keyboard Maestro “Install TFTP server” Macro issue

Hey, all! Please see the below Macro. Certainly not fancy like I've seen you guys do :wink:
I have this macro that runs on an Ubuntu 14 server. It simply installs the TFTP capabilities for me so I don't have to manually paste everything in.
What I run into is when we get to the Insert Text by Pasting area that starts with "service ftp" - no matter what I choose, like format text, type text (instead of paste) the service will fail to start. If I delete that file and paste it in manually, it works perfectly.
The logs on the server will state that there are invalid arguments in the bad port or bad protocol, etc. But I can destroy the file, paste the exact same text in and save the file, start the service and it runs perfectly. I've tried this on countless VM's and the results are the same.
Have you guys ran into anything similar? I also have the issue on Windows servers. I have other macros that will type or paste something and simulate the return key or a carriage return. The result is that the command won't take.
As an example, I can start a remote desktop session, run a macro that will simply type in a valid command and hit return...and it won't work on the RDP session. Then I type the command and hit enter and it works just fine. That's another topic, but certainly shares the issues I've been having with the topic at hand.
Is there a better way to accomplish what I'm doing? These commands are all sent via SSH, error-free.

Keyboard Maestro “Install TFTP server” Macro

Install TFTP server.kmmacros (5.7 KB)

Rather than destroy the file, move the file out of the way, and then do a binary diff on the two files to see what is different.

My guess would be line endings.

Ah, thank you for the suggestion. I’m going to give that a shot on the next one I try and I’ll post back on the results. :slight_smile:

Hey Brian,

You’re using Zoc Terminal on macOS to do this?

You can talk directly to Zoc with AppleScript:

set cmdStr to "ls -l^M"

tell application "zoc7"
   start conversation
   end conversation
end tell


Thanks, Chris - you’re indeed correct. I do use the zoc button capabilities, but figured I could get a bit more ileage out of using KM instead of just the buttons themselves. Using the sub-groups inside of palettes has been pretty stellar for organizing all my command snippets. And it gives me a few more capabilities with an app I’m familiar with instead of just doing plain text commands or REXX scripting, which I have no desire to learn.
I am interested if it is a line ending problem. I did scrub all my text before pasting it, using both apps, so I’d be surprised, but it would still make sense.
I’ll post back once I give it a whirl. I think I might do it tomorrow, Wednesday latest.
In this case, it would likely work to do the entire operation as you’ve laid out. Maybe I’ll test it if I can’t make any headway on the diff test.
I appreciate the response!

Hey Brian,

It sounds to me like you're failing to understand that Keyboard Maestro can send AppleScript commands using the Execute an AppleScript action.

Sending a command directly to your Zoc session is much better than brute-forcing the UI.


Oh, I see how it works in that fashion. That does seem like a pretty great way to accomplish what I'm after. I'll check out some Applescript examples for the macro I posted in this thread. Thanks for the additional information. Looks like it would be pretty nice to have the script saved and then call it when needed, making small tweaks when necessary. Excellent suggestion, and much better than what I posted. Thanks for the pointers!