Re: Send a message between computers
Re: Send a message between computers
- Subject: Re: Send a message between computers
- From: "S. J. Cunningham via AppleScript-Users" <email@hidden>
- Date: Wed, 10 Aug 2022 07:20:31 -0400
> On Aug 9, 2022, at 4:56 PM, Gil Dawson via AppleScript-Users
> <email@hidden> wrote:
>
> Hi--
>
> I wish to send to send a short message from an AppleScript stay-open app on
> one Mac to another stay-open app on another Mac, both on our LAN, and receive
> a reply.
>
> What is the Applescript syntax for this?
>
> —Gil
Remote Applications
A script can target an application on a remote computer if remote applications
are enabled on that computer, and if the script specifies the computer with an
eppc-style specifier.
Enabling Remote Applications
For a script to send commands to a remote application, the following conditions
must be satisfied:
The computer that contains the application and the computer on which the script
is run must be connected to each other through a network.
Remote Apple Events (set in the Sharing preferences pane) must be enabled on
the remote computer and user access must be provided (you can allow access for
all users or for specified users only).
If the specified remote application is not running, you must run it.
You must authenticate as admin when you compile or run the script.
eppc-Style Specifiers
An eppc-style specifier takes the following format:
eppc://[user[:password]@]IP_address
ip_address
Either a numeric IP address in dotted decimal form (four numbers, from 0 to
255, separated by periods; for example, 123.23.23.123) or a hostname. A
hostname can be a Bonjour name.
The following are examples of valid eppc-style specifiers. If you supply the
user name and password, no authentication is required. If you do not supply it,
authentication may be required.
"eppc://myCoolMac.local" -- hostname, no user or pwd
"eppc://myUserName:email@hidden" -- user, pwd, and hostname
"eppc://123.23.23.123" -- IP address, no user or pwd
"eppc://myUserName:email@hidden" -- user, pwd, and IP address
"eppc://email@hidden" -- server address, user
Important: If a part of the eppc-style specifier contains non-UTF-8 characters
or white space, it must be URL-encoded: for example, here is a user name that
contains a space:
John Smith.
Targeting Remote Applications
You can target an application that is running on a remote machine and you can
launch applications on remote machines that are not currently running.
The following example uses an eppc-style specifier to target the Finder on a
remote computer. It includes a user name and password, so no authentication is
required.
set remoteMachine to "eppc://userName:email@hidden"
tell app "Finder" of machine remoteMachine to close front window
Important: If you compile an erroneous eppc-style address, you will have to
quit and relaunch Script Editor for changes to that address to take effect.
In some cases, you’ll need to use a using terms from
<https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_control_statements.html#//apple_ref/doc/uid/TP40000983-CH6g-SW1>
statement to tell AppleScript to compile against the local version of an
application. The following example uses that technique in telling the remote
Finder application to open the TextEdit application:
set remoteFinder to application "Finder" of machine ¬
"eppc://myUserName:email@hidden"
using terms from application "Finder"
tell remoteFinder
open application file id "com.apple.TextEdit"
end tell
end using terms from
If you omit the password (pwd) in the previous script, you will have to
authenticate when you run the script.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden