« Finder Windowの状態保存と保存したFinder Windowの状態を呼び出す(作成中) | トップページ | オーディオの入出力切り替え »

Finder Windowの複製(詳細版)


あくまでも参考にしてください

【スクリプトエディタで開く】 |

サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004# 前面Finder Windowの複製 詳細版
005#com.cocolog-nifty.quicktimer.icefloe
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007use AppleScript version "2.8"
008use scripting additions
009
010###ウィンドウの有無チェック
011tell application "Finder"
012  set numCntWindow to (count of every Finder window) as integer
013end tell
014if numCntWindow = 0 then
015  return "保存するウィンドウがありません"
016end if
017# Finder Window 前面のだけ処理する
018tell application "Finder"
019  tell front Finder window
020    set aliasTargetPath to target as alias
021    set listPosition to position as list
022    set listBounds to bounds as list
023    set numSideBarWidth to sidebar width as integer
024    set boolToolBarVisible to toolbar visible as boolean
025    set boolStatusBarVisible to statusbar visible as boolean
026    set boolPathBarVisible to pathbar visible as boolean
027    set boolZoomed to zoomed as boolean
028    set boolCollapsed to collapsed as boolean
029    set constantCurrentView to current view as constant
030  end tell
031  ##オプション分岐
032  if constantCurrentView is column view then
033    tell column view options of front Finder window
034      set numTextSize to text size as integer
035      set boolShowIcon to shows icon as boolean
036      set boolShowsIconPreview to shows icon preview as boolean
037      set boolShowsPreviewColumn to shows preview column as boolean
038      set boolDisClosesPreviewPane to discloses preview pane as boolean
039    end tell
040  else if constantCurrentView is icon view then
041    tell icon view options of front Finder window
042      set constantArrangement to arrangement as constant
043      set constantLabelPosition to label position as constant
044      set listBackgroundColor to background color as list
045      set numTextSize to text size as integer
046      set numIconSize to icon size as integer
047      set boolShowsItemInfo to shows item info as boolean
048      set boolShowsIconPreview to shows icon preview as boolean
049    end tell
050  else if constantCurrentView is list view then
051    tell list view options of front Finder window
052      set constantIconSize to icon size as constant
053      set columnSortColumn to sort column
054      set numTextSize to text size as integer
055      set boolCalculatesFolderSizes to calculates folder sizes as boolean
056      set boolShowsIconPreview to shows icon preview as boolean
057      set boolUsesRelativeDates to uses relative dates as boolean
058    end tell
059  end if
060end tell
061#####################
062#複製
063tell application "Finder"
064  set objNewWindow to (make new Finder window to folder aliasTargetPath)
065  tell objNewWindow
066    #右下方向に20ピクセルつづずらす
067    set numSetX to ((item 1 of listPosition) + 20) as integer
068    set numSetY to ((item 2 of listPosition) + 20) as integer
069    set listSetPosition to {numSetX, numSetY} as list
070    set position to listSetPosition
071    #右下方向に20ピクセルつづずらす
072    set numSetX to ((item 1 of listBounds) + 20) as integer
073    set numSetY to ((item 2 of listBounds) + 20) as integer
074    set numSetW to ((item 3 of listBounds) + 20) as integer
075    set numSetH to ((item 4 of listBounds) + 20) as integer
076    set listSetBounds to {numSetX, numSetY, numSetW, numSetH} as list
077    set bounds to listSetBounds
078    set sidebar width to numSideBarWidth
079    set toolbar visible to boolToolBarVisible
080    set statusbar visible to boolStatusBarVisible
081    set pathbar visible to boolPathBarVisible
082    set zoomed to boolZoomed
083    set collapsed to boolCollapsed
084    set current view to constantCurrentView
085  end tell
086  ##オプション分岐
087  if constantCurrentView is column view then
088    tell column view options of front Finder window
089      set text size to numTextSize
090      set shows icon to boolShowIcon
091      set shows icon preview to boolShowsIconPreview
092      set shows preview column to boolShowsPreviewColumn
093      set discloses preview pane to boolDisClosesPreviewPane
094    end tell
095  else if constantCurrentView is icon view then
096    tell icon view options of front Finder window
097      set arrangement to constantArrangement
098      set label position to constantLabelPosition
099      set background color to listBackgroundColor
100      set text size to numTextSize
101      set icon size to numIconSize
102      set shows item info to boolShowsItemInfo
103      set shows icon preview to boolShowsIconPreview
104    end tell
105  else if constantCurrentView is list view then
106    tell list view options of front Finder window
107      set icon size to constantIconSize
108      set sort column to columnSortColumn
109      set text size to numTextSize
110      set calculates folder sizes to boolCalculatesFolderSizes
111      set shows icon preview to boolShowsIconPreview
112      set uses relative dates to boolUsesRelativeDates
113    end tell
114  end if
115end tell
AppleScriptで生成しました

|

« Finder Windowの状態保存と保存したFinder Windowの状態を呼び出す(作成中) | トップページ | オーディオの入出力切り替え »

AppleScript Finder」カテゴリの記事