如何缩进AppleScript oneliner
我有一个AppleScript oneliner,我想缩进。但我想知道如何做到这一点 以下是oneliner:如何缩进AppleScript oneliner,applescript,Applescript,我有一个AppleScript oneliner,我想缩进。但我想知道如何做到这一点 以下是oneliner: 告诉应用程序“系统事件”,告诉外观首选项将暗模式设置为非暗模式 以下是我如何努力实现这一目标的: tell application "System Events" to tell appearance preferences to set dark mode to not dark mode end tell end tell 看来这行不通 我遗漏
告诉应用程序“系统事件”,告诉外观首选项将暗模式设置为非暗模式
以下是我如何努力实现这一目标的:
tell application "System Events" to
tell appearance preferences to
set dark mode to not dark mode
end tell
end tell
看来这行不通
我遗漏了什么?如果您希望将命令保留为“一行”,但将其分割为多行,那么您需要使用行连续字符,在AppleScript中,该字符由
、
表示。可以通过按或在脚本编辑器中输入⌥输入,或按⌥L
然后,您可以像这样拆分一行:
tell application "System Events" to ¬
tell appearance preferences to ¬
set dark mode to not dark mode
您可以尝试在不同位置放置行连续字符,以实现不同类型的缩进,例如:
tell application "System Events" to tell ¬
appearance preferences to set ¬
dark mode to not dark mode
如果要将一行代码(称为简单的tell
命令)更改为复合tell
命令,即以end tell
结尾的命令,则应在希望复合的每个tell
之后将省略为
:
tell application "System Events"
tell appearance preferences
set dark mode to not dark mode
end tell
end tell
我一直用⌥我不知道⌥进来,回答得好+1.