1
我需要编写以下脚本内嵌内嵌苹果脚本
tell app "Spotify Queue"
addTrack "spotify:track:7sa1xOgT1c8xQfbSL5FrCe"
end tell
这样一个
sh('osascript -e \'tell app "Spotify" to playpause\'')
,但我无法得到它的权利。
我需要编写以下脚本内嵌内嵌苹果脚本
tell app "Spotify Queue"
addTrack "spotify:track:7sa1xOgT1c8xQfbSL5FrCe"
end tell
这样一个
sh('osascript -e \'tell app "Spotify" to playpause\'')
,但我无法得到它的权利。
你不需要多线:
tell app "Spotify Queue" to addTrack "spotify:track:7sa1xOgT1c8xQfbSL5FrCe"
如果你需要一个以上的线,osascript可以像这样使用:
osascript -e 'tell app "Finder"' -e 'display dialog "Multi-line"' -e 'end'
所以只是'SH('告诉应用程序“ Spotify队列“...')'应该做的伎俩呢? –
我不知道CoffeeScript的,但是从上面他的例子,它看起来像它应该工作 – adayzdone
的报价大多是像JavaScript这样你就可以把双引号的东西单引号字符串(反之亦然)内。该'-e'版本可能会与[块串]来做得最好(http://coffeescript.org/#strings),以避免报价逃逸废话,'“”“...‘’”'是更多或不像壳里的heredoc。 –