Finderウィンドウを同じサイズ再作成して、ちょっとずらして新規WIndowで開く
【スクリプトエディタで開く】 |
Clone Window.app.scpt | ソース |
|---|
| 001 | #!/usr/bin/env osascript |
| 002 | use AppleScript version "2.8" |
| 003 | use scripting additions |
| 004 |
|
| 005 |
|
| 006 | tell application "Finder" |
| 007 | set numCntWindow to (count of every window) as integer |
| 008 | end tell |
| 009 | if numCntWindow = 0 then |
| 010 | return "Windowがありません" |
| 011 | end if |
| 012 | tell application "Finder" |
| 013 | set listSelection to selection |
| 014 | tell front Finder window |
| 015 | # properties |
| 016 | try |
| 017 | set aliasFolderPath to (its target) as alias |
| 018 | on error |
| 019 | set aliasFolderPath to (path to desktop folder from user domain) as alias |
| 020 | end try |
| 021 | set listPosition to position as list |
| 022 | set listBounds to bounds as list |
| 023 | set objCurrentView to current view |
| 024 | set boolToolbar to toolbar visible as boolean |
| 025 | set boolStatusbar to statusbar visible as boolean |
| 026 | set boolPathbar to pathbar visible as boolean |
| 027 | set numSidebarWidth to sidebar width as integer |
| 028 | end tell |
| 029 | end tell |
| 030 |
|
| 031 | set {pL, pT} to listPosition as list |
| 032 | set {bL, bT, bR, bB} to listBounds as list |
| 033 |
|
| 034 | set listPosition to {(pL + 25), (pT + 25)} as list |
| 035 | set listBounds to {(pL + 25), (pT + 25), (bR + 25), (bB + 25)} as list |
| 036 |
|
| 037 |
|
| 038 | tell application "Finder" |
| 039 | make new Finder window |
| 040 | tell front Finder window |
| 041 | set target to aliasFolderPath |
| 042 | set position to listPosition |
| 043 | set bounds to listBounds |
| 044 | set current view to objCurrentView |
| 045 | set toolbar visible to boolToolbar |
| 046 | set statusbar visible to boolStatusbar |
| 047 | set pathbar visible to boolPathbar |
| 048 | set sidebar width to numSidebarWidth |
| 049 | end tell |
| 050 | set selection to listSelection |
| 051 | end tell |
| 052 | return |
| AppleScriptで生成しました |
|---|