【发布时间】:2012-06-30 23:15:39
【问题描述】:
我正在尝试使用 AppleScript 在 Finder 中打开一个文件夹。以下是我的代码。我希望文件夹 WorkSpace 在 Finder 中打开,但它会打开父文件夹 /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
【问题讨论】:
-
使用
Finder window类而不是window如果这些窗口之一打开(信息窗口、首选项窗口、剪辑窗口和视图选项窗口)不会出现错误。--> @ 987654328@ 。显示命令:将指定的对象带入 view,使用open命令,如 adayzdone 的答案。
标签: applescript directory finder