• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Hoping for some advice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hoping for some advice


  • Subject: Re: Hoping for some advice
  • From: "S. J. Cunningham" <email@hidden>
  • Date: Mon, 14 Mar 2016 17:59:54 -0400

On Mar 12, 2016, at 3:30 PM, email@hidden wrote:

> I have a need for sending apple events over a local network.
>
> What I’ve done in the past is simply installed appleScript applets on the remote macs with the commands or scripts I want to execute and then remotely tell the finder on the remote mac to open the applet.
>
> But now I have a very simple set of commands I’ll want to send.
>
> Restart the mac
> Kill an application and re-launch it
> Display a URL
> Replace text in a text file
>
> The first one has no parameters, so that’s easy, I’ll send a shell command.
> The second has one parameter, the name of the application.
> The third is sending text to a specific application
> The last one is sending text.
>
> So my question is do people find sending appleEvents over the network to be reliable? And what’s the best method?

I have several scripts which run on remote headless Mac Minis which I control from my laptop.  I haven't had any problems except timing problems.  You can't talk to an app which isn't open so, as you have figured out, you have to open it with the Finder or, say, launchd.  Then it will have to be a stay-open app lest it quit before you send it the follow up command.  Finally, I find that you have to wait for the "activate" step to complete before sending the actual command.  I found 1 sec works in most cases.

There was a lot of trial and error involved and trying different approaches, launchd vs Finder for example, but once I got it working, I haven't had a problem.

One technique I found helpful for an application which I didn't want to stay open or one which didn't have a user interface because it is a launch agent, was to write a "relay" stay-open application on the remote machine which handled the conversation between my machine and the target remote application.


Steve
------------------
OS X 10.6.8, AppleScript 2.1.2


 _______________________________________________
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


References: 
 >Hoping for some advice (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: Weird problem with a script?
  • Next by Date: Re: Problem getting Standard Doc Properties in Word 2011
  • Previous by thread: Hoping for some advice
  • Next by thread: Deleting a Custom Property in Word 2011
  • Index(es):
    • Date
    • Thread