[365]Office365のフォントキャッシュをゴミ箱に入れる
削除は利用者に任せる系
フォントキャッシュ『限定』
通常のキャッシュはそのままにする
Group Containersの
FontCacheは、フォントファイルの『実態』が含まれているので、今回は削除の対象に入れなかった。
#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property refMe : a reference to current application
set objFileManager to refMe's NSFileManager's defaultManager()
###################################
########Libraryフォルダ
###################################
set ocidUserLibraryPath to (objFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
###LibraryフォルダURL
set ocidLibraryPathURL to ocidUserLibraryPath's firstObject()
###################################
########microsoftフォルダ
###################################
##################################################
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Outlook/Data/Library/Application Support/Microsoft/FontCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Outlook/Data/Library/Application Support/Microsoft/FontPreviewCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Outlook/Data/Library/Caches/com.microsoft.Outlook/fsCachedData/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Outlook/Data/Library/Caches/Microsoft/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
##################################################
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.onenote.mac/Data/Library/Application Support/Microsoft/FontCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.onenote.mac/Data/Library/Application Support/Microsoft/FontPreviewCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.onenote.mac/Data/Library/Caches/com.microsoft.onenote.mac/fsCachedData/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.onenote.mac/Data/Library/Caches/Microsoft/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
##################################################
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Excel/Data/Library/Application Support/Microsoft/FontCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Excel/Data/Library/Application Support/Microsoft/FontPreviewCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Excel/Data/Library/Caches/com.microsoft.Excel/fsCachedData/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Excel/Data/Library/Caches/Microsoft/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
##################################################
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Powerpoint/Data/Library/Application Support/Microsoft/FontCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Powerpoint/Data/Library/Application Support/Microsoft/FontPreviewCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Powerpoint/Data/Library/Caches/com.microsoft.Powerpoint/fsCachedData/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Powerpoint/Data/Library/Caches/Microsoft/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
##################################################
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Word/Data/Library/Application Support/Microsoft/FontCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Word/Data/Library/Application Support/Microsoft/FontPreviewCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Word/Data/Library/Caches/com.microsoft.Word/fsCachedData/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.Word/Data/Library/Caches/Microsoft/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
##################################################
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.to-do-mac/Data/Library/Application Support/Microsoft/FontCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.to-do-mac/Data/Library/Application Support/Microsoft/FontPreviewCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.to-do-mac/Data/Library/Caches/com.microsoft.to-do-mac/fsCachedData/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.to-do-mac/Data/Library/Caches/Microsoft/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
##################################################
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.rdc.macos/Data/Library/Application Support/Microsoft/FontCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.rdc.macos/Data/Library/Application Support/Microsoft/FontPreviewCache/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.rdc.macos/Data/Library/Caches/com.microsoft.rdc.macos/fsCachedData/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
#####チェックするディレクトリ
set ocidChkDirURL to ocidLibraryPathURL's URLByAppendingPathComponent:"Containers/com.microsoft.rdc.macos/Data/Library/Caches/Microsoft/"
###中身をゴミ箱に入れる
doGo2TrashDirContentsURL(ocidChkDirURL)
###################################
########ディレクトリの中身をゴミ箱へ
###################################
on doGo2TrashDirContentsURL(ocidDirUrl)
###ファイルマネージャー初期化
set objFileManager to refMe's NSFileManager's defaultManager()
################################
####渡された値がNSURL以外の場合の処理
try
set strClassName to class of ocidDirUrl as text
####渡された値がテキストだったら
if strClassName is "text" then
set strDirUrl to ocidDirUrl as text
####渡された値がエイリアスだったら
else if strClassName is "alias" then
set strDirPath to POSIX path of ocidDirUrl as text
end if
set ocidFilePath to (refNSString's stringWithString:strDirPath)
set ocidFilePathString to ocidFilePath's stringByStandardizingPath
set ocidDirPathURL to (refNSURL's alloc()'s initFileURLWithPath:ocidFilePathString isDirectory:true)
on error
######ocid形式の値だったら
set strClassName to ocidDirUrl's className() as text
###テキストなら
if strClassName contains "NSCFString" then
set ocidFilePathString to ocidDirUrl's stringByStandardizingPath
set ocidDirPathURL to (refNSURL's alloc()'s initFileURLWithPath:ocidFilePathString isDirectory:true)
###NSURLなら
else if strClassName is "NSURL" then
set ocidDirPathURL to ocidDirUrl
else
error "NSURLを指定してください" number -9999
return
end if
end try
################################
####渡されたパスが無い場合はエラー
set ocidFilePathString to ocidDirPathURL's |path|()
set boolFolderExists to (objFileManager's fileExistsAtPath:ocidFilePathString isDirectory:true)
if boolFolderExists is false then
log "パス先が実在しません"
####パス先ない場合は作っておく
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:511 forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to objFileManager's createDirectoryAtURL:(ocidDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
return
end if
################################
####ディレクトリか?の判断 ファイルならエラーで止める
set ocidResultArray to ocidDirPathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsDirectoryKey) |error|:(reference)
if (item 3 of ocidResultArray) is not (missing value) then
doGetErrorData(ocidNSErrorData)
end if
set ocidResultValue to item 2 of ocidResultArray
-->false
set ocidFalse to (refMe's NSNumber's numberWithBool:false)'s boolValue
if ocidResultValue is ocidFalse then
##error "パス先がファイルですディレクトリを指定してください" number -9999
log "パス先がファイルですディレクトリを指定してください"
return
end if
##################################
##内包リスト
set listResult to objFileManager's contentsOfDirectoryAtURL:ocidDirPathURL includingPropertiesForKeys:{refMe's NSURLPathKey} options:0 |error|:(reference)
###エラー発生時
if (item 2 of listResult) is not (missing value) then
doGetErrorData(item 2 of listResult)
end if
###結果
set ocidPathArray to item 1 of listResult
repeat with itemPathArray in ocidPathArray
set ocidPathArrayURL to itemPathArray
##ゴミ箱に入れる
set listResult to (objFileManager's trashItemAtURL:ocidPathArrayURL resultingItemURL:(missing value) |error|:(reference))
###エラー発生時
if (item 2 of listResult) is not (missing value) then
doGetErrorData(item 2 of listResult)
end if
end repeat
end doGo2TrashDirContentsURL
| 固定リンク
「Microsoft Office」カテゴリの記事
- 【メモ】Microsoft Office統合インストーラー利用時の留意点(2025.05.19)
- 【メモ】Outlook管理用ドキュメント(2025.05.03)
- [Outlook]未送信の下書きがあるか?(2025.04.26)
- Microsoft Officeインストーラー直リンクURLチェッカー(2025.04.21)
- Microsoft Office個別アプリ最新版ダウンロードインストール(2025.04.05)