open programs with applescript

后端 未结 6 588
刺人心
刺人心 2021-02-02 10:39

2 part question:

I\'m simply trying to run programs using applescript from the terminal, so I tried:

$ osascript tell application \"iTunes\" to activate
         


        
6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-02 11:19

    In a bash shell (like in Terminal), you can send multiple lines to osascript by using a "here document".

    osascript -e "tell application \"iTunes\"" -e "activate" -e "end tell"
    

    becomes

    osascript <

    As an old-skool Unix hacker, I save these little snippets in my $HOME/bin directory and call them from the command line. Still learning the particulars, though.

    Alan

提交回复
热议问题