【发布时间】:2019-11-05 15:32:28
【问题描述】:
我在使用包含空格的文件夹路径执行 AppleScript 时遇到问题。我该如何解决这个问题?提前谢谢你。
tell application "Finder"
set myWin to window 1
set thePath to (quoted form of POSIX path of (target of myWin as alias))
tell application "Terminal"
activate
tell window 1
do script "/Users/johndoe/Company Dropbox/John Doe/Folder " & thePath
end tell
end tell
end tell
【问题讨论】:
-
你可以使用
quoted form of这个字符串,否则你需要对shell特殊的字符进行转义。 -
如何使用
quoted form of? -
类似
do script quoted form of ("/Users/johndoe/Company Dropbox/John Doe/Folder " & thePath)
标签: macos shell terminal applescript