【问题标题】:Finder window setup in AppleScript - small bugAppleScript 中的 Finder 窗口设置 - 小错误
【发布时间】:2012-10-10 14:31:27
【问题描述】:

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

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

【问题讨论】:

    标签: macos applescript finder


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

      -- 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  
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-09-30
        • 2023-03-16
        • 1970-01-01
        • 1970-01-01
        • 2014-07-20
        • 2017-03-31
        相关资源
        最近更新 更多