Finderウィンドウのツールバー設定例(全部入れ)
【スクリプトエディタで開く】 |
設定.scpt | ソース |
|---|
| 001 | #!/usr/bin/env osascript |
| 002 | #coding: utf-8 |
| 003 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7-- |
| 004 | (* |
| 005 | Finder Windowの上部ツールバーの値のバックアップ |
| 006 | と |
| 007 | 設定の追加 |
| 008 |
|
| 009 |
|
| 010 | com.cocolog-nifty.quicktimer.icefloe *) |
| 011 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7-- |
| 012 | use AppleScript version "2.8" |
| 013 | use scripting additions |
| 014 |
|
| 015 | set recordSystemInfo to (system info) as record |
| 016 | set strUID to (short user name of recordSystemInfo) as text |
| 017 | set strPlistPath to ("/Users/" & strUID & "/Library/Preferences/com.apple.finder.plist") as text |
| 018 |
|
| 019 | set listTBitem to {"com.apple.finder.BACK", "com.apple.finder.PATH", "com.apple.finder.INFO", "com.apple.finder.TRSH", "com.apple.finder.ARNG", "com.apple.finder.SWCH", "com.apple.finder.NFLD", "com.apple.finder.PTGL", "com.apple.finder.ACTN", "com.apple.finder.AirD", "com.apple.finder.SHAR", "com.apple.finder.AddP", "com.apple.finder.CNCT", "com.apple.finder.QUIK", "com.apple.finder.BURN", "com.apple.finder.EJCT", "com.apple.finder.LABL", "com.apple.finder.APPS", "com.apple.finder.HOME", "com.apple.finder.DOCS", "com.apple.finder.PBLC", "com.apple.finder.SRCH"} as list |
| 020 |
|
| 021 | repeat with itemTB in listTBitem |
| 022 | set strTBitem to itemTB as text |
| 023 | set strPath to (":'NSToolbar Configuration Browser':'TB Item Identifiers':") as text |
| 024 | set strCmd to ("/usr/libexec/PlistBuddy -c \"Add " & strPath & " string " & strTBitem & "\" \"" & strPlistPath & "\"") as text |
| 025 | try |
| 026 | set strStdOut to (do shell script strCmd) as text |
| 027 | end try |
| 028 | end repeat |
| 029 |
|
| 030 |
|
| 031 | set strCmd to ("/usr/libexec/PlistBuddy -c \"Save\" \"" & strPlistPath & "\"") as text |
| 032 | set strStdOut to (do shell script strCmd) as text |
| 033 |
|
| 034 | return |
| 035 |
|
| 036 |
|
| 037 |
|
| 038 |
|
| 039 | ########################## |
| 040 | #このような方法で追加もアリ |
| 041 | try |
| 042 | do shell script "/usr/bin/defaults write com.apple.finder 'NSToolbar Configuration Browser' '{\"TB Default Item Identifiers\" = (\"com.apple.finder.BACK\",\"com.apple.finder.SWCH\",NSToolbarSpaceItem,\"com.apple.finder.ARNG\",NSToolbarSpaceItem,\"com.apple.finder.SHAR\",\"com.apple.finder.LABL\",\"com.apple.finder.ACTN\",NSToolbarSpaceItem,\"com.apple.finder.SRCH\");\"TB Display Mode\" = 2;\"TB Icon Size Mode\" = 1;\"TB Is Shown\" = 1;\"TB Item Identifiers\" = (\"com.apple.finder.BACK\",\"com.apple.finder.PATH\",\"com.apple.finder.INFO\",\"com.apple.finder.TRSH\",\"com.apple.finder.ARNG\",\"com.apple.finder.SWCH\",\"com.apple.finder.NFLD\",\"com.apple.finder.PTGL\",\"com.apple.finder.ACTN\",\"com.apple.finder.AirD\",\"com.apple.finder.SHAR\",\"com.apple.finder.AddP\",\"com.apple.finder.CNCT\",\"com.apple.finder.QUIK\",\"com.apple.finder.BURN\",\"com.apple.finder.EJCT\",\"com.apple.finder.LABL\",\"com.apple.finder.APPS\",\"com.apple.finder.HOME\",\"com.apple.finder.DOCS\",\"com.apple.finder.PBLC\",\"com.apple.finder.SRCH\");\"TB Size Mode\" = 1;}'" |
| 043 | end try |
| 044 |
|
| AppleScriptで生成しました |
|---|