applescript oneliner

标签 applescript

是否可以将 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/

相关文章:

python - 尝试使用 RegEx 理解更简单的方法

macos - Applescript:无需打开即可获取.app的路径

terminal - 如何在applescript终端中更改带有空格的目录?

python - Applescript - 从 python 获取返回

objective-c - NSAppleEventDescriptor 到 NSArray

objective-c - 使用 AppleScript 解锁 OS-X (Mavericks) 后键盘没有响应

cocoa - 使用 ScriptingBridge 框架与 Entourage 进行通信

macos - 如何从命令行创建 Macintosh Finder 别名?

applescript - 从 AppleScript 获取文件路径

xcode - applescript 中的 "Do Shell Script"命令在脚本编辑器中有效,但在我的 cocoa applescript 应用程序中无效