使用 mac os x 上的文件管理器路径查找器,我想使用 python 检索选定的文件/文件夹py-appscript。py-appscript 是一个高级事件桥,允许您从 Python 控制可编写脚本的 Mac OS X 应用程序。
在applescript中它会像
tell application "Path Finder"
set selection_list to selection -- list of fsItems (fsFiles and fsFolders)
set _path to posix path of first item of selection_list
do shell script "python " & quoted form of _path
end tell
在python中,它会改为
from appscript import *
selectection_list = app('Path Finder').selection.get() # returns reference, not string
那么,如何将 selection_list 中的引用转换为 python-strings?