applescript - 在查找器中显示不适用于连接字符串
问题描述
为什么会这样:
tell application "Finder"
activate
reveal POSIX file ("/Users/Torben/Library/Mobile Documents/com~apple~CloudDocs/MyFolder/file.png")
end tell
...但不是这个
tell application "Finder"
activate
reveal POSIX file ("/Users/Torben/Library/Mobile Documents/com~apple~CloudDocs/MyFolder/" & "file.png")
end tell
如果我想用变量(字符串)加入路径(字符串),我该如何让它工作?
解决方案
我建议使用相对 HFS 路径。第一行指向library
当前用户的文件夹。
set libraryFolder to path to library folder from user domain as text
tell application "Finder"
reveal file (libraryFolder & "com~apple~CloudDocs:MyFolder:" & "file.png")
end tell
推荐阅读
- angularjs - MVC Core 中的 Angular 模板不安装 npm 包
- angular - 如何在提交角度 5 时从 ngx-modal 检索数据
- linux - 如何在 redhat linux 上安装特定版本的 netCore
- javascript - 有没有办法用纹理一次上传 obj 和 mtl 文件
- awk - 使用 awk 交换由给定字符串分隔的两组单词
- service - 定义自定义托管服务失败
- raspberry-pi - 未解析的行 - 'LCONF_VERS ION = "6" '
- r - geom_bar 删除了 3 行缺失值
- azure-ad-b2c - getUser 返回名称未定义的对象
- php - 文件包括混淆和错误