我正在尝试在重复循环中更改 Finder 的背景颜色。
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
我知道我在这里缺少一些简单的东西。我让它在其他上下文中工作(循环之外)......
如果您手动关闭并重新打开 Finder 窗口,背景会发生变化!根据这个问题是昨天的 https://stackoverflow.com/questions/29135878/what-is-the-quickest-way-to-toggle-hide-show-hidden-files-on-a-mac-os-x-yosemite解决方案是重新打开窗口(也称为打开新窗口并关闭旧窗口)以“refresh“ 风景:
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
享受吧,迈克尔/汉堡
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)