2013-11-22 131 views
2

所以,幾年前有一些討論關於在mac上使用applescript創建視頻牆效果來生成應用程序,但代碼似乎不再反映QT在小牛隊工作。你會將一串視頻剪輯「拖放」到應用程序上,它會自動調整它們的大小並循環它們以在屏幕上創建一個很酷的「視頻牆馬賽克」效果 - 非常酷,如果你輸出到大型電視機或投影機到牆使用QuickTime創建一個「平鋪的視頻牆」或「視頻馬賽克」

任何想法如何更新/修復此代碼,以生成在特立獨行的QT修復?這裏是最近的迭代中,但如果你下的AppleScript編輯器測試它似乎沒有工作...

on open filelist 
    tell application "QuickTime Player" to open filelist 
    run 
end open 
on run 
    tell application "QuickTime Player" 
     set ratio to 4/3 

     tell application "Finder" to set display_bounds to bounds of window of desktop 
     set display_width to (item 3 of display_bounds) 
     set display_height to (item 4 of display_bounds) - 42 -- menu height + title bar 
     set window_count to count of windows 
     set max_pixels to 0 
     repeat with potential_cols from 1 to window_count -- try all possibilities - hardly optimal but who cares. 
      set potential_rows to round (window_count - 1)/potential_cols + 1 rounding toward zero 
      set {potential_window_width, potential_window_height} to {round display_width/potential_cols rounding toward zero, round display_height/potential_rows rounding toward zero} 
      if potential_window_width/potential_window_height < ratio then 
       set {potential_window_width, potential_window_height} to {potential_window_width, round potential_window_width/ratio rounding toward zero} 
      else 
       set {potential_window_width, potential_window_height} to {potential_window_height * ratio, potential_window_height} 
      end if 
      set used_pixels to potential_window_width * potential_window_height * window_count 
      if used_pixels > max_pixels then 
       set {window_width, window_height, cols, rows} to {potential_window_width, potential_window_height, potential_cols, potential_rows} 
       set max_pixels to used_pixels 
      end if 
     end repeat 

     set {x, y} to {0, 0} 
     set wins to (get every window) 
     repeat with win in wins 
      set doc to document of win 
      set «class mctl» of doc to «constant playnone» 
      set looping of doc to true 
      set {wi, hi} to natural dimensions of doc 
      if wi/window_width > hi/window_height then 
       set «class pdim» of doc to {window_width, hi/(wi/window_width)} 
      else 
       set «class pdim» of doc to {wi/(hi/window_height), window_height} 
      end if 
      set x to x + 1 
      if x = cols then set {x, y} to {0, y + 1} 
     end repeat 

     set {x, y} to {0, 0} 
     set wins to (get every window) 
     repeat with win in wins 
      set {wi, hi} to natural dimensions of doc 
      if wi/window_width > hi/window_height then 
       set bounds of win to {window_width * x, 22 + window_height * y, window_width * x + window_width, 22 + window_height * y + hi/(wi/window_width)} 
      else 
       set bounds of win to {window_width * x, 22 + window_height * y, window_width * x + wi/(hi/window_height), 22 + window_height * y + window_height} 
      end if 
      set x to x + 1 
      if x = cols then set {x, y} to {0, y + 1} 
     end repeat 
     set wins to (get every window) 
     repeat with win in wins 
      play document of win 
     end repeat 
     activate 
    end tell 
end run 
+0

可能是劇本不好反正這就是爲什麼沒有找到真正的版本。 – 2013-11-22 17:14:40

+0

@DigiMonk這實際上是一個很酷的腳本。 – Mark

+0

是的,我不知道這個腳本是爲QuickTime Player 7而設計的。我們必須重寫它才能使用QuickTime Player。 – 2013-11-23 21:58:28

回答

2

這個腳本工作正常使用QuickTime Player 7

蘋果仍然使得它可以彌補用於最近版本中的所有缺失功能。

如果它不是已經在你的機器上試試這個下載http://support.apple.com/kb/DL923

然後在腳本重命名所有的「QuickTime播放器」引用「QuickTime播放器7」

+0

很酷。我忘了QTP7。所以我們可以在我承擔的小牛隊上安裝這個 - – 2013-11-23 22:10:28