1

我正在使用 Sal Soghoian 的 AppleScript 1-2-3 书中的一个方便的 Finder 窗口设置脚本(如下);效果很好,但如果我增加设置的两个窗口中第二个窗口的侧边栏宽度,则对更改没有响应 - 它保持 145;(第一个窗口响应宽度变化)评论?

tell application "Finder"
close every window
-- first window
open folder "Webclients" of folder "Documents" of home
set toolbar visible of the front Finder window to true
set the sidebar width of the front Finder window to 145
set the current view of the front Finder window to column view
set the bounds of the front Finder window to {16, 80, 550, 675}
-- second window
open folder "Documents" of home
set toolbar visible of the front Finder window to true
set the sidebar width of the front Finder window to 145
set the current view of the front Finder window to column view
set the bounds of front Finder window to {560, 80, 1000, 675}
select the last Finder window
end tell
4

2 回答 2

0

我发现如果您增加第二个窗口的宽度,它将按预期工作。例如,我使用 {560, 80, 1500, 675} 作为第二个窗口的边界(注意 1500)。在这些范围内,侧边栏的宽度是正确且可变的。所以这一定是与窗口宽度和Apple应用于Finder窗口的一些自动设置有关。祝你好运。

于 2012-10-10T15:19:57.143 回答
0

首先设置窗口的边界,然后增加侧边栏的宽度。

-- second window
open folder "Documents" of home
set toolbar visible of the front Finder window to true
set the bounds of front Finder window to {560, 80, 1000, 675}
set the sidebar width of the front Finder window to 200
set the current view of the front Finder window to column view
select the last Finder window
end tell  

Finder 侧边栏宽度是相对于 Finder 窗口的宽度而言的。

tell application "Finder"
    get sidebar width of window 1
        --> 136 //maximum value
    get bounds of window 1
        --> {-1, 44, 327, 235}//327-136 =191
end tell

tell application "Finder"
    get sidebar width of window 1
        --> 563 //maximum value
    get bounds of window 1
        --> {-1, 44, 754, 235}//754-563=191
end tell
tell application "Finder"
    get sidebar width of window 1
        --> 843 //maximum value
    get bounds of window 1
        --> {-1, 44, 1034, 235}//1034 -843 =191
end tell  
于 2012-10-11T06:14:09.957 回答