[Wacom]ユーザー設定等をまとめてゴミ箱へ
あくまでも参考にしてください
行番号 | ソース |
---|---|
001 | #! /usr/bin/env osascript |
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
003 | #com.cocolog-nifty.quicktimer.icefloe |
004 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
005 | use AppleScript version "2.8" |
006 | use framework "Foundation" |
007 | use framework "AppKit" |
008 | use framework "UniformTypeIdentifiers" |
009 | use scripting additions |
010 | |
011 | property refMe : a reference to current application |
012 | |
013 | |
014 | set listBundleID to {"com.wacom.DataStoreMgr", "com.wacom.FirmwareUpdater", "com.wacom.IOManager", "com.wacom.MultiTouch", "com.wacom.ProfessionalControlPanel", "com.wacom.RemoveTabletHelper", "com.wacom.RemoveWacomTablet", "com.wacom.TabletDriver", "com.wacom.TabletHelper", "com.wacom.UpdateHelper", "com.wacom.UpgradeHelper", "com.wacom.Wacom-Desktop-Center", "com.wacom.Wacom-Display-Settings", "com.wacom.WacomCenter", "com.wacom.WacomCenterPrefPane", "com.wacom.WacomExperienceProgram", "com.wacom.WacomTabletDriver", "com.wacom.WacomTouchDriver", "com.wacom.displayhelper", "com.wacom.wacomtablet", "com.wacom.DisplayMgr"} as list |
015 | |
016 | set appFileManager to refMe's NSFileManager's defaultManager() |
017 | set ocidHomeDirURL to appFileManager's homeDirectoryForCurrentUser() |
018 | |
019 | |
020 | |
021 | ############## |
022 | set ocidChkDirPathURL to (ocidHomeDirURL's URLByAppendingPathComponent:("Library/Containers")) |
023 | repeat with itemBundleID in listBundleID |
024 | set ocidTargetPathURL to (ocidChkDirPathURL's URLByAppendingPathComponent:(itemBundleID)) |
025 | # |
026 | set ocidTargetPath to ocidTargetPathURL's |path|() |
027 | #有無チェック |
028 | set boolDirExists to (appFileManager's fileExistsAtPath:(ocidTargetPath) isDirectory:(true)) |
029 | if boolDirExists = true then |
030 | log (ocidTargetPath as text) & ": をゴミ箱に入れる" |
031 | set aliasChkDirPath to (ocidTargetPathURL's absoluteURL()) as alias |
032 | tell application "Finder" |
033 | move aliasChkDirPath to the trash |
034 | end tell |
035 | end if |
036 | end repeat |
037 | |
038 | ############## |
039 | set ocidChkDirPathURL to (ocidHomeDirURL's URLByAppendingPathComponent:("Library/Caches")) |
040 | repeat with itemBundleID in listBundleID |
041 | set ocidTargetPathURL to (ocidChkDirPathURL's URLByAppendingPathComponent:(itemBundleID)) |
042 | # |
043 | set ocidTargetPath to ocidTargetPathURL's |path|() |
044 | #有無チェック |
045 | set boolDirExists to (appFileManager's fileExistsAtPath:(ocidTargetPath) isDirectory:(true)) |
046 | if boolDirExists = true then |
047 | log (ocidTargetPath as text) & ": をゴミ箱に入れる" |
048 | set listDone to (appFileManager's trashItemAtURL:(ocidTargetPathURL) resultingItemURL:(ocidTargetPathURL) |error| :(reference)) |
049 | if (item 2 of listDone) ≠ (missing value) then |
050 | set strDirPath to (ocidTargetPathURL's |path|()) as text |
051 | set strErrorMes to (item 2 of listDone)'s localizedDescription() as text |
052 | # |
053 | set strMes to ("【エラー】\n" & strDirPath & "\n" & strErrorMes) as text |
054 | log strMes |
055 | else if (item 1 of listDone) is true then |
056 | log "正常終了 : " & (ocidDirPathURL's |path|()) as text |
057 | end if |
058 | end if |
059 | end repeat |
060 | |
061 | |
062 | ############## |
063 | set ocidChkDirPathURL to (ocidHomeDirURL's URLByAppendingPathComponent:("Library/WebKit")) |
064 | repeat with itemBundleID in listBundleID |
065 | set ocidTargetPathURL to (ocidChkDirPathURL's URLByAppendingPathComponent:(itemBundleID)) |
066 | set listDone to (appFileManager's trashItemAtURL:(ocidTargetPathURL) resultingItemURL:(ocidTargetPathURL) |error| :(reference)) |
067 | if (item 2 of listDone) ≠ (missing value) then |
068 | set strDirPath to (ocidTargetPathURL's |path|()) as text |
069 | set strErrorMes to (item 2 of listDone)'s localizedDescription() as text |
070 | # |
071 | set strMes to ("【エラー】\n" & strDirPath & "\n" & strErrorMes) as text |
072 | log strMes |
073 | else if (item 1 of listDone) is true then |
074 | log "正常終了 : " & (ocidDirPathURL's |path|()) as text |
075 | end if |
076 | end repeat |
077 | |
078 | ############## |
079 | set ocidChkDirPathURL to (ocidHomeDirURL's URLByAppendingPathComponent:("Library/Saved Application State")) |
080 | repeat with itemBundleID in listBundleID |
081 | set ocidTargetPathURL to (ocidChkDirPathURL's URLByAppendingPathComponent:(itemBundleID)) |
082 | set listDone to (appFileManager's trashItemAtURL:(ocidTargetPathURL) resultingItemURL:(ocidTargetPathURL) |error| :(reference)) |
083 | if (item 2 of listDone) ≠ (missing value) then |
084 | set strDirPath to (ocidTargetPathURL's |path|()) as text |
085 | set strErrorMes to (item 2 of listDone)'s localizedDescription() as text |
086 | # |
087 | set strMes to ("【エラー】\n" & strDirPath & "\n" & strErrorMes) as text |
088 | log strMes |
089 | else if (item 1 of listDone) is true then |
090 | log "正常終了 : " & (ocidDirPathURL's |path|()) as text |
091 | end if |
092 | end repeat |
093 | |
094 | |
095 | ############## |
096 | set ocidChkDirPathURL to (ocidHomeDirURL's URLByAppendingPathComponent:("Library/HTTPStorages")) |
097 | repeat with itemBundleID in listBundleID |
098 | set ocidTargetPathURL to (ocidChkDirPathURL's URLByAppendingPathComponent:(itemBundleID)) |
099 | set listDone to (appFileManager's trashItemAtURL:(ocidTargetPathURL) resultingItemURL:(ocidTargetPathURL) |error| :(reference)) |
100 | if (item 2 of listDone) ≠ (missing value) then |
101 | set strDirPath to (ocidTargetPathURL's |path|()) as text |
102 | set strErrorMes to (item 2 of listDone)'s localizedDescription() as text |
103 | # |
104 | set strMes to ("【エラー】\n" & strDirPath & "\n" & strErrorMes) as text |
105 | log strMes |
106 | else if (item 1 of listDone) is true then |
107 | log "正常終了 : " & (ocidDirPathURL's |path|()) as text |
108 | end if |
109 | end repeat |
110 | |
111 | |
112 | ############## |
113 | set ocidChkDirPathURL to (ocidHomeDirURL's URLByAppendingPathComponent:("Library/Group Containers")) |
114 | repeat with itemBundleID in listBundleID |
115 | set ocidTargetPathURL to (ocidChkDirPathURL's URLByAppendingPathComponent:(itemBundleID)) |
116 | set listDone to (appFileManager's trashItemAtURL:(ocidTargetPathURL) resultingItemURL:(ocidTargetPathURL) |error| :(reference)) |
117 | if (item 2 of listDone) ≠ (missing value) then |
118 | set strDirPath to (ocidTargetPathURL's |path|()) as text |
119 | set strErrorMes to (item 2 of listDone)'s localizedDescription() as text |
120 | # |
121 | set strMes to ("【エラー】\n" & strDirPath & "\n" & strErrorMes) as text |
122 | log strMes |
123 | else if (item 1 of listDone) is true then |
124 | log "正常終了 : " & (ocidTargetPathURL's |path|()) as text |
125 | end if |
126 | end repeat |
127 | |
AppleScriptで生成しました |
| 固定リンク