我正在尝试使用AppleScript在查找器中打开一个文件夹。以下是我的代码。我希望在Finder中打开文件夹WorkSpace,但它会打开父文件夹/Volumes/MyMacDrive/Mani并突出显示WorkSpace文件夹。我想要WorkSpace文件夹的内容,但我得到的只是其父文件夹的内容。我错过了什么..?
property the_path : "/Volumes/MyMacDrive/Mani/WorkSpace/"
set the_folder to (POSIX file the_path) as alias
tell application "Finder"
activate
if window 1 exists then
set target of window 1 to the_folder
else
reveal the_folder
end if
end tell发布于 2012-09-27 00:42:48
实际上,它比看起来的要简单:
tell application "Finder" to open ("/Volumes/MyMacDrive/Mani/WorkSpace/" as POSIX file)或者使用冒号提供AppleScript路径:
tell application "Finder" to open "MyMacDrive:Mani:WorkSpace"这样你就有了一个打开的窗口
https://stackoverflow.com/questions/11261516
复制相似问题