applescript 摆脱完整路径
我的 AppleScript 中有一个选择文件
。当我运行脚本并选择一个文件时,输出始终是完整文件路径,末尾带有文件扩展名。例如:
Macintosh HD:Developer:About Xcode.pdf
是我不想要的。我只想:
About Xcode
当其中有多个 .
时,Kassym Dorsel
的以下答案不起作用。
Lri 的以下回答不适用于 set x to select file
:
error "Can’t make quoted form of alias \"Macintosh HD:Applications:Firefox.app:\" into type Unicode text." number -1700 from quoted form of alias "Macintosh HD:Applications:Firefox.app:" to Unicode text
I've got a choose file
in my AppleScript. When I run the script and choose a file, the output is always the full file path with the file extension on the end. For example:
Macintosh HD:Developer:About Xcode.pdf
is what I don't want. I only want:
About Xcode
The below answer by Kassym Dorsel
doesn't work when there is more than one .
in it.
The below answer by Lri doesn't work with set x to choose file
:
error "Can’t make quoted form of alias \"Macintosh HD:Applications:Firefox.app:\" into type Unicode text." number -1700 from quoted form of alias "Macintosh HD:Applications:Firefox.app:" to Unicode text
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Finder 来操作 Finder 项目的名称:
You can use the Finder to manipulate the names of Finder items:
这将起作用:
给出 =>
关于.Xcode
This will work :
Gives =>
About.Xcode