如何刷新Finder窗口中的浏览器视图(mac os 10.5)?

发布于 2024-12-31 23:56:55 字数 361 浏览 5 评论 0原文

我想刷新 mac os 10.5 上 finder 的 NSBrowserView 中的所有 NSTableView。为了刷新图标视图、列表视图和流列表视图,我使用苹果脚本。

@"tell application \"Finder\" to update every item in front window"

在浏览器视图中,此脚本仅刷新最后一列。

例如,此脚本仅刷新第三列(icns-copy.m......)。

在此处输入图像描述 有人可以帮我吗?

I want to refresh all NSTableView in NSBrowserView of finder on mac os 10.5. For refreshing icon view , list view and flow list view, i am using apple script.

@"tell application \"Finder\" to update every item in front window"

In browser view this script is only refreshing last column.

For example , this script is refreshing only third column(icns-copy.m.....).

enter image description here
Can anyone please help me out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮光沉寂 2025-01-07 23:56:55

它仅刷新最后一列,因为每个 Finder 窗口一次只有一个目标文件夹(其内容显示在最后一列中)。解决方案是沿着文件夹层次结构向上移动并更新父文件夹。

tell application "Finder"
    set t to front window's target
    repeat
        try
            update every item in t
            set t to t's parent -- go one level up
        on error                -- e.g. when you reach root
            exit repeat
        end try
    end repeat
end tell

这是一个快速但肮脏的解决方案,因为它一直上升到磁盘的根目录。理想情况下,它会停在最左边一列中显示的文件夹处,但我不知道如何确定它是哪个文件夹。

It's only refreshing the last column because every Finder window has exactly one target folder at a time (whose content is displayed in the last column). The solution is to walk up the folder hierarchy and update the parent folders as well.

tell application "Finder"
    set t to front window's target
    repeat
        try
            update every item in t
            set t to t's parent -- go one level up
        on error                -- e.g. when you reach root
            exit repeat
        end try
    end repeat
end tell

This is a quick'n'dirty solution since it goes up all the way to the disk's root. Ideally, it would stop at the folder which is displayed in the leftmost column, but I couldn't figure out how to determine which ohe it is.

淡淡的优雅 2025-01-07 23:56:55
tell application "Finder"
    set view to (get current view of front window as string)
    if view is equal to "column view" then
        set t to front window's target
        set p to folder "Myfolder" of folder "parag" of folder "Users" of startup disk as string
        repeat
            if (t as string) begins with p then
                try
                    update every item in t
                    set t to t's parent -- go one level up
                on error -- e.g. when you reach root
                    exit repeat
                end try
            else
                exit repeat
            end if
        end repeat
    end if
end tell
tell application "Finder"
    set view to (get current view of front window as string)
    if view is equal to "column view" then
        set t to front window's target
        set p to folder "Myfolder" of folder "parag" of folder "Users" of startup disk as string
        repeat
            if (t as string) begins with p then
                try
                    update every item in t
                    set t to t's parent -- go one level up
                on error -- e.g. when you reach root
                    exit repeat
                end try
            else
                exit repeat
            end if
        end repeat
    end if
end tell
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文