如何单击通知并从Apple脚本跳回到iterm2?

时间:2018-03-08 15:18:27

标签: notifications applescript

我有一个脚本在iterm2完成长时间运行的bash作业后通知我

on run argv
  tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
  if frontApp is not "iTerm2" then
      set notifTitle to item 1 of argv
      set notifBody to "succeded"
      set errorCode to item 2 of argv
      if errorCode is not "0"
        set notifBody to "failed with error code " & errorCode
      end if
      display notification notifBody with title notifTitle
    end if
  end tell

结束

令人讨厌的部分是当我点击通知时,它会打开苹果脚本编辑器。我想要实现的行为是将我重定向回iterm2。是否可以实施?

0 个答案:

没有答案