是否可以将 applescript 行合并为一个(在 ruby 中可以使用 ;
完成)?
最佳答案
不是真的。最多可以做的是将一个简单的 if-then
语句放在一行中......
if (variable) then
return true
end if
...成为...
if (variable) then return true
如果要在 shell 脚本中包含 osascript
命令,则多行脚本必须用 -e
分隔...
osascript -e 'if (variable) then' -e 'return true' -e 'end if'
但这就是它的范围。 Applescript 文件不像大多数其他编程语言那样是简单的文本文件(不幸的是),我们必须依靠其专门的编辑器来进行行管理。
关于applescript oneliner,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4108808/