I want to send a line of text from one Mac to another. Both have KM. I'm not aware of any particular action that supports this sort of thing. It would be nice if there was an action similar to Send SMS Message that took the network name of the destination computer, and then maybe a trigger on the receiving computer for incoming messages. But I don't think this exists.
What method might work best? I'm aware of the Web Server feature of KM. Could I set up some sort of macro to receive the text as a parameter, and some sort of KM action on the other machine to trigger the macro on the remote web server? Maybe the Set URL action? What's the easiest way to send a line of text out from one Mac to another, using KM at both ends?
I hadn't thought of that approach, thanks for the tip.
In your case the trigger generation appears to be on an iOS device but I would like my trigger to be a KM action on macOS, so are you thinking I could create the trigger file one the first machine and pass the text inside the body of the file and trigger on the file's creation on the second mac?
I haven't set up a shared macOS drive yet, but I'm guessing it could be on one of those instead of on iCloud. That might work faster, I imagine.
Will this work for you?
Write clipboard to the file
read the file
write and read clipboard to iCloud.kmmacros (4.2 KB)
I use this to copy and paste between my mac's that have the same iCloud.
You could make a notification with a trigger like when folder adds a file. Then the rtfd document that i write to should be alone in a folder.
Use a Remote trigger, and Remote Trigger action, which can take a parameter.
I think that will work. It looks perfect. I don't understand the underlying technology since it isn't using the KM web server, but that's okay, I don't need to understand how KM works, only that it does. I never noticed (or understood?) that trigger before. KM is always pulling magical rabbits out of its hat.
In order to try to figure out how KM achieves this magic, I just ran a port scan using the builtin macOS "Network Utility" and it didn't see anything at 80 (http) or 443 (https). It did pick up the KM web server at 4490 and 4491. It also picked up two standard Apple port numbers, and one unknown port (that suddenly makes me really scared.) I'm going to pay more attention to my open ports going forward.
Maybe I should write a macro that performs this macOS port scan once a day and notifies me if the ports have changed. That would be a really great KM macro. Yes, I will do that. EDIT: I've done it. Now I need to test it for a while before I post it.
There are a number of solutions discussed here:
Send a message to another mac over LAN
Those are some interesting ideas. I recall using the mesg command at work once. But it seems that the recipient in all these examples is the user. As my original post said, I wanted KM to be the sender and the recipient of the message. I originally wrote "using KM at both ends" but maybe that wasn't clear. Peter explained a solution above that uses KM at both ends. I'm going to consider that solution but right now I'm putting finishing touches on a KM macro that monitors the results of a port scan on my Mac and sends me an SMS message whenever it detects a change.
Cool, i made a macro using that Remote Trigger with Parameter: %SystemClipboard%.
To send just raw ascii it works great.
To send a .jpg, i upload the image on my iCloud and on the receiving mac it is triggered because something has been added to that folder.
I occasionally use AppleScript to send simple messages between two machines that have sharing preferences set to enable remote Apple Events from specific users:
tell application "Finder" of machine "eppc://user:pw@CK.local" to ¬
display notification "Sent from CK-mac.local"
I'm quite annoyed Apple removed Bonjour messaging from the Messages.app, which was always a great way to communicate over a LAN.
I appreciate that info. It's interesting. Still, since my question was about sending messages using KM on one machine and receiving it on KM on another machine, I'm going to flag Peter's answer has having "answered" it.
It included the use of KM as a speculative option, but was not about using KM specifically:
But I wrote:
which stated that I wanted to use KM as both sending tool and receiving tool.
Kind of, but no. It was posed as an enquiry at the end that, without any indication otherwise, gives its lowest significance in the overall context of what is being asked. It's also asked in isolation from the main query, which is given by the opening question (and the post's title), and is actually clear in its construction (which wasn't your intention) that it has no specific context.
It's equivalent to "By the way, what would be the easiest way to do this with KM", as opposed to "So, basically, what I'm wanting to know is what is the easiest way to do this with KM," which both ask the same question, but only one makes an assertion.
Sorry, it's not a big deal at all, and I think I need to learn how not to comment on things that aren't inviting a deconstructive analysis. I wasn't nitpicking, I just find this stuff interesting (language in scripting and programming terms is inherently related to language in verbal and communication terms, so it's all part of the same concept that I enjoy a bit too much).