2016-12-16 27 views
0
終端

事件節推出的Mac應用程序,我有一個任務來創建特定的日期和時間,我必須自動打開任何樣本應用程序事件到目前爲止,我做了創建日期和時間的事件,但我DONO如何添加腳本啓動應用程序

這裏我的示例代碼:

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 

這是對終端測試,並在日曆中創建活動現在

我真正需要上面的代碼,這是有可能在單個命令這兩腳本結合並測試它?(即在特定日期我希望自動啓動我的應用程序)

回答

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

+0

這個代碼不工作在終端 – batMan007