Re: How to script the launching of a script at a specific time...


2551phil
 

If it’s correct, it means what you think it means, but I’d still argue that unless that's officially documented, it is better not to rely on it.



Best


Phil
@sqwarq


On 7 Dec 2017, at 16:37, Jean-Christophe Helary <jean.christophe.helary@...> wrote:



On Dec 7, 2017, at 17:34, 2551phil <2551phil@...> wrote:

Good work! I shall retweet that.

BTW, you don’t need to specify both Program and Program Arguments in your plist. If you leave out the Program key (and the osascript string that follows it), launchd will take the first item in the Program Arguments array as the Program (which you correctly have as the path to osascript).

The way you’re doing it, you’re technically passing /usr/bin/osascript as the first argument to /usr/bin/osascript, which you don’t really want to do.

Ok, I found where I got this idea. It's in the http://www.launchd.info link:

When you provide both keys, the value of Program is the executable to be started. The first string in ProgramArguments will show up as argv[0] in the executable. If this makes no sense to you, just think that launchd will ignore it.

And indeed, it did not make sense to me :) But since it works I thought my comments in the code were not entirely wrong.

JC


Join applescript@apple-dev.groups.io to automatically receive all group messages.