2012-10-10 36 views
1

我使用了一個方便的Finder窗口,設置了Sal Soghoian的AppleScript 1-2-3書中的腳本(如下)效果很好,但如果我增加設置的兩個窗口中第二個的側邊欄寬度,則沒有響應該變化 - 它保持145; (第一個窗口響應寬度更改)註釋?AppleScript中的Finder窗口設置 - 小錯誤

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 

回答

0

我發現,如果你提高你的第二個窗口的寬度,如預期它會奏效。例如,我用{560,80,1500,675}作爲第二個窗口的邊界(注意1500)。在這些邊界處,側邊欄寬度是正確且可改變的。所以這肯定會影響窗口寬度以及Apple在Finder窗口中應用的一些自動設置。祝你好運。

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 

查找器側欄寬度是相對於查找器窗口的寬度。

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