【问题标题】:Launch Mac Application on Event day by Terminal通过终端在活动当天启动 Mac 应用程序
【发布时间】:2017-05-01 21:50:57
【问题描述】:

我有一个任务是在特定的日期和时间创建事件我必须自动打开任何示例应用程序到目前为止我已经在日期和时间创建了一个事件但我不知道如何添加脚本来启动应用程序

这里是我的示例代码:

osascript -e 'tell application "iCal" to make new event at end of calendar 1 with properties {start date:date "12, 19, 2016 1:02:00 PM", summary:"Demo"}'

这是我发现的另一个代码,可以在单个命令中打开任何应用程序:

open -a iTunes 

上面的代码是在终端上测试的,事件是在日历上创建的

现在我真正需要的是可以将这两个脚本组合在一个命令中并测试它吗?(即在特定日期我想自动启动我的应用程序)

【问题讨论】:

    标签: javascript macos events terminal scheduled-tasks


    【解决方案1】:

    您基本上需要创建一个“打开文件警报”,其中包含一些打开应用程序的 Applescript 的路径:

    tell application "iCal"
       tell calendar "My Calendar"
          set theEvent to event 1
          set theDate to (current date) - 3 * days
          tell theEvent
             make new open file alarm at end with properties {trigger date:theDate, 
                filepath:theFile}
          end tell
       end tell
    end tell
    

    见example。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-26
      • 1970-01-01
      • 1970-01-01
      • 2019-04-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多