更改搜索文件夹背景颜色的AppleScript [英] Change Finder folder background color AppleScript

查看:385
本文介绍了更改搜索文件夹背景颜色的AppleScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图改变一个重复循环中查找器的背景颜色。

I'm trying to change the background color of Finder within a repeat loop.

tell application "Finder"

    set windowCount to (count windows) 
    if windowCount > 0 then #check if windows are available

        set bgcolor to {65535, 0, 32896}

        repeat 10 times
            tell the icon view options of window 1
                set the background color to {some item of bgcolor, some item of bgcolor, some item of bgcolor}
                delay 0.1
            end tell
        end repeat

    end if
end tell

我知道我失去了一些东西简单在这里。我得到了它在其他环境中工作(外循环)...

I know I'm missing something simple here. I got it to work in other contexts (outside the loop)...

推荐答案

如果您关闭并重新打开Finder窗口手动背景的变化!据<一个href=\"http://stackoverflow.com/questions/29135878/what-is-the-quickest-way-to-toggle-hide-show-hidden-files-on-a-mac-os-x-yosemite\">this从昨天的问题解决办法是重新打开的窗口(又名打开一个新窗口,并关闭旧),以刷新的的观点:

If you close and reopen your Finder window manually the background changes! According to this question from yesterday the solution is to re-open the window (aka open a new window and close the old) to "refresh" the view:

tell application "Finder"
    set windowCount to (count windows)
    if windowCount > 0 then #check if windows are available
        set bgcolor to {65535, 0, 32896}
        repeat 10 times
            tell the icon view options of window 1
                set the background color to {some item of bgcolor, some item of bgcolor, some item of bgcolor}
            end tell
            try
                set w to front window
                tell (make new Finder window)
                    try
                        set target to (get target of w)
                    end try
                    set bounds to (bounds of w)
                    set current view to (current view of w)
                end tell
                tell w to close
            end try
            delay 0.1
        end repeat
    end if
end tell

享受,迈克尔/汉堡

Enjoy, Michael / Hamburg

这篇关于更改搜索文件夹背景颜色的AppleScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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