AppleScript的:打开在Finder中文件夹 [英] Applescript: Open a Folder in Finder

查看:2041
本文介绍了AppleScript的:打开在Finder中文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我米试图打开使用AppleScript在Finder中的文件夹。以下是我的code。我想要的文件夹工作在Finder中打开,但打开父文件夹 /卷/ MyMacDrive /玛尼和亮点在工作文件夹中。我想工作文件夹的内容,但所有我得到是它的父文件夹的内容。我在这里缺少什么......?

 属性the_path:/卷/ MyMacDrive /玛尼/工作台/
设置the_folder为(POSIX文件the_path)的别名
告诉应用程序发现者
    启用
    如果那么窗口1存在
        窗口1集目标the_folder
    其他
        揭示the_folder
    万一
告诉结束


解决方案

虽然我已经搜查远,似乎没有办法打开文件夹,而不是仅仅突出的AppleScript文件夹。所以我用:

 做shell脚本开/卷/ MyMacDrive /玛尼/工作台/

它的工作对我很好,但请更新我,如果我错了。

I m trying to open a folder in Finder using AppleScript. The following is my code. I want the folder WorkSpace to open in Finder, but it opens the Parent Folder /Volumes/MyMacDrive/Mani and highlights the WorkSpace folder. I want the contents of WorkSpace folder, but all I'm getting is its Parent Folder's Contents. What am i missing here ..?

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

解决方案

As far as I've searched, there seems to be no way to open the folder rather than just highlighting the folder in AppleScript. So I have used:

do shell script "open /Volumes/MyMacDrive/Mani/WorkSpace/"

It worked fine for me but please update me if i'm wrong.

这篇关于AppleScript的:打开在Finder中文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆