我正尝试使用 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
if Finder window 1 exists then
。揭示命令:将指定的对象带入视图,如adayzdone的答案中所述,使用“open”命令。 - jackjr300