« [acrobat]起動方法を選ぶ(署名画面と共有メッセージ) | トップページ | [NSUserName]現在のユーザー名(ショートユーザー名) »

[Office]SaveAsAdobePDF.ppam が読み込めませんでした。(修正版)

SaveAsAdobePDF.ppam が読み込めませんでした。
SaveAsAdobePDF.xlam が読み込めませんでした
linkCreation.dotm が読み込めませんでした 対応用

基本的には『リセットツール』を使えば解決できるのですが

Factory Reset Package
Complete Removal Package
Word Reset Package
Excel Reset Package
PowerPoint Reset Package
Outlook Reset Package
Outlook Data Removal Package
OneNote Reset Package
OneDrive Reset Package
Teams Reset Package
Skype For Business Removal Package
AutoUpdate Reset Package
License Reset Package
Zoom Outlook Plugin Removal Package
WebEx Tools Removal Package

https://office-reset.com/
リセットツールはプラグインを削除はしてくれるが、再インストールはしないので

ダウンロード - movetotrashmsjunk.dmg


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.6"
use framework "Foundation"
use scripting additions


property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()

set listBundleID to {"com.microsoft.Powerpoint", "com.microsoft.Word", "com.microsoft.Excel"} as list


################################
#### Cachesリセット
set strBaseDirPath to "~/Library/Caches"
set ocidBaseDirPathStr to refMe's NSString's stringWithString:(strBaseDirPath)
set ocidBaseDirPath to ocidBaseDirPathStr's stringByStandardizingPath()
repeat with itemBundleID in listBundleID
  set strBundleID to itemBundleID as text
  set ocidGoToTrashDirPath to (ocidBaseDirPath's stringByAppendingPathComponent:(strBundleID))
  set boolDone to doMoveToTrash(ocidGoToTrashDirPath)
  log boolDone as boolean
end repeat
################################
#### plistリセット
set strBaseDirPath to "~/Library/Preferences"
set ocidBaseDirPathStr to refMe's NSString's stringWithString:(strBaseDirPath)
set ocidBaseDirPath to ocidBaseDirPathStr's stringByStandardizingPath()
repeat with itemBundleID in listBundleID
  set strBundleID to itemBundleID as text
  set ocidBaseFilePath to (ocidBaseDirPath's stringByAppendingPathComponent:(strBundleID))
  set ocidGoToTrashDirPath to (ocidBaseFilePath's stringByAppendingPathExtension:("plist"))
  set boolDone to doMoveToTrash(ocidGoToTrashDirPath)
  log boolDone as boolean
end repeat
################################
#### Containersリセット
set strBaseDirPath to "~/Library/Containers"
set ocidBaseDirPathStr to refMe's NSString's stringWithString:(strBaseDirPath)
set ocidBaseDirPath to ocidBaseDirPathStr's stringByStandardizingPath()
repeat with itemBundleID in listBundleID
  set strBundleID to itemBundleID as text
  set ocidGoToTrashDirPath to (ocidBaseDirPath's stringByAppendingPathComponent:(strBundleID))
  set boolDone to doMoveToTrash(ocidGoToTrashDirPath)
  log boolDone as boolean
end repeat
################################
#### Application Scriptsリセット
set strBaseDirPath to "~/Library/Application Scripts"
set ocidBaseDirPathStr to refMe's NSString's stringWithString:(strBaseDirPath)
set ocidBaseDirPath to ocidBaseDirPathStr's stringByStandardizingPath()
repeat with itemBundleID in listBundleID
  set strBundleID to itemBundleID as text
  set ocidGoToTrashDirPath to (ocidBaseDirPath's stringByAppendingPathComponent:(strBundleID))
  set boolDone to doMoveToTrash(ocidGoToTrashDirPath)
  log boolDone as boolean
end repeat

################################
#### temporaryDirectory T リセット
set ocidTemporaryDirPathURL to appFileManager's temporaryDirectory
repeat with itemBundleID in listBundleID
  set strBundleID to itemBundleID as text
  set ocidGoToTrashDirPathURL to (ocidTemporaryDirPathURL's URLByAppendingPathComponent:(strBundleID))
  set boolDone to doMoveToTrash(ocidGoToTrashDirPathURL)
  log boolDone as boolean
end repeat

################################
#### temporaryDirectory C リセット
set ocidTemporaryDirPathURL to appFileManager's temporaryDirectory
set ocidContainerDirPathURL to ocidTemporaryDirPathURL's URLByDeletingLastPathComponent()
set ocidCPathURL to ocidContainerDirPathURL's URLByAppendingPathComponent:"C"
repeat with itemBundleID in listBundleID
  set strBundleID to itemBundleID as text
  set ocidGoToTrashDirPathURL to (ocidCPathURL's URLByAppendingPathComponent:(strBundleID))
  set boolDone to doMoveToTrash(ocidGoToTrashDirPathURL)
  log boolDone as boolean
end repeat


################################
###Startup.localized クリーニング
set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Word/~$nkCreation.dotm"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)

set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Excel/~$SaveAsAdobePDF.xlam"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)


set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Powerpoint/~$SaveAsAdobePDF.ppam"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)

################################
###Startup.localized クリーニング
set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Word/nkCreation.dotm"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)

set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Excel/SaveAsAdobePDF.xlam"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)


set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Powerpoint/SaveAsAdobePDF.ppam"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)



################################
####Add-Ins.localized クリーニング
set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Add-Ins.localized/Word/~$nkCreation.dotm"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)

set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Add-Ins.localized/Excel/~$SaveAsAdobePDF.xlam"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)

set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Add-Ins.localized/Powerpoint/~$SaveAsAdobePDF.ppam"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
set boolDone to doMoveToTrash(ocidFilePathURL)
################################

set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/mip_policy"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set boolDone to doMoveToTrash(ocidFilePath)
set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/FontCache"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set boolDone to doMoveToTrash(ocidFilePath)
set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/ComRPC32"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set boolDone to doMoveToTrash(ocidFilePath)
set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/TemporaryItems"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set boolDone to doMoveToTrash(ocidFilePath)
set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/MicrosoftRegistrationDB.reg"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set boolDone to doMoveToTrash(ocidFilePath)
set strFilePath to "~/Library/Group Containers/UBF8T346G9.Office/Microsoft Office ACL [English]"
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set boolDone to doMoveToTrash(ocidFilePath)

####新しいファイルをコピーする

set ocidUserShotName to refMe's NSUserName()
set strUserName to ocidUserShotName as text

set strDtomFilePath to "/Library/Application Support/Adobe/MACPDFM/DC/linkCreation.dotm"
set strPpamFilePath to "/Library/Application Support/Adobe/MACPDFM/DC/SaveAsAdobePDF.ppam"
set strXlamFilePath to "/Library/Application Support/Adobe/MACPDFM/DC/SaveAsAdobePDF.xlam"

set strDistDtomFilePath to "/Users/" & strUserName & "/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Word/linkCreation.dotm"
set strDistPpamFilePath to "/Users/" & strUserName & "/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Powerpoint/SaveAsAdobePDF.ppam"
set strDistXlamFilePath to "/Users/" & strUserName & "/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Excel/SaveAsAdobePDF.xlam"


set strCommandText to ("/usr/bin/ditto \"" & strDtomFilePath & "\" \"" & strDistDtomFilePath & "\"") as text
do shell script strCommandText
set strCommandText to ("/usr/bin/ditto \"" & strPpamFilePath & "\" \"" & strDistPpamFilePath & "\"") as text
do shell script strCommandText
set strCommandText to ("/usr/bin/ditto \"" & strXlamFilePath & "\" \"" & strDistXlamFilePath & "\"") as text
do shell script strCommandText

set strCommandText to ("/bin/chmod 755 \"" & strDistDtomFilePath & "\"") as text
do shell script strCommandText
set strCommandText to ("/bin/chmod 755 \"" & strDistPpamFilePath & "\"") as text
do shell script strCommandText
set strCommandText to ("/bin/chmod 755 \"" & strDistXlamFilePath & "\"") as text
do shell script strCommandText



################################
####User Content.localizedを開く
set strDirFilePath to "~/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized"
set ocidFilePathStr to refMe's NSString's stringWithString:(strDirFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:true
set appShardWorkspace to refMe's NSWorkspace's sharedWorkspace()
appShardWorkspace's openURL:ocidFilePathURL

################################
####ゴミ箱に入れるサブ
to doMoveToTrash(argFilePath)
  ###ファイルマネジャー初期化
  set appFileManager to refMe's NSFileManager's defaultManager()
  #########################################
  ###渡された値のClassを調べてとりあえずNSURLにする
  set refClass to class of argFilePath
  if refClass is list then
return "エラーリストは処理しません"
  else if refClass is text then
    log "テキストパスです"
    set ocidArgFilePathStr to (refMe's NSString's stringWithString:argFilePath)
    set ocidArgFilePath to ocidArgFilePathStr's stringByStandardizingPath
    set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
  else if refClass is alias then
    log "エイリアスパスです"
    set strArgFilePath to (POSIX path of argFilePath) as text
    set ocidArgFilePathStr to (refMe's NSString's stringWithString:strArgFilePath)
    set ocidArgFilePath to ocidArgFilePathStr's stringByStandardizingPath
    set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
  else
    set refClass to (className() of argFilePath) as text
    if refClass contains "NSPathStore2" then
      log "NSPathStore2です"
      set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:argFilePath)
    else if refClass contains "NSCFString" then
      log "NSCFStringです"
      set ocidArgFilePath to argFilePath's stringByStandardizingPath
      set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
    else if refClass contains "NSURL" then
      set ocidArgFilePathURL to argFilePath
      log "NSURLです"
    end if
  end if
  #########################################
  ###
  -->false
  set ocidFalse to (refMe's NSNumber's numberWithBool:false)'s boolValue
  -->true
  set ocidTrue to (refMe's NSNumber's numberWithBool:true)'s boolValue
  #########################################
  ###NSURLがエイリアス実在するか?
  set ocidArgFilePath to ocidArgFilePathURL's |path|()
  set boolFileAlias to appFileManager's fileExistsAtPath:(ocidArgFilePath)
  log ocidArgFilePath as text
  ###パス先が実在しないなら処理はここまで
  if boolFileAlias = false then
    log "処理中止"
return false
  end if
  #########################################
  ###NSURLがディレクトリなのか?ファイルなのか?
  set listBoolDir to ocidArgFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsDirectoryKey) |error|:(reference)
  if (item 2 of listBoolDir) = ocidTrue then
    #########################################
    log "ディレクトリです"
    ##内包リスト
    set listResult to appFileManager's contentsOfDirectoryAtURL:ocidArgFilePathURL includingPropertiesForKeys:{refMe's NSURLPathKey} options:0 |error|:(reference)
    ###結果
    set ocidContentsPathURLArray to item 1 of listResult
    ###リストの数だけ繰り返し
    repeat with itemContentsPathURL in ocidContentsPathURLArray
      ###ゴミ箱に入れる
      set listResult to (appFileManager's trashItemAtURL:itemContentsPathURL resultingItemURL:(missing value) |error|:(reference))
    end repeat
  else
    #########################################
    log "ファイルです"
    ###念のためFilderでも調べる
    tell application "Finder"
      set aliasArgFilePath to ocidArgFilePathURL as alias
      set strPathKind to (kind of aliasArgFilePath) as text
    end tell
    ###/tmpのような特殊フォルダの場合は処理しない
    if strPathKind is "フォルダ" then
return "特殊ディレクトリかシンボリックリンクなので処理しません"
    else
      ###ファイルをゴミ箱に入れる
      set listResult to (appFileManager's trashItemAtURL:ocidArgFilePathURL resultingItemURL:(missing value) |error|:(reference))
    end if
  end if
return true
end doMoveToTrash

|

« [acrobat]起動方法を選ぶ(署名画面と共有メッセージ) | トップページ | [NSUserName]現在のユーザー名(ショートユーザー名) »

AppleScript Microsoft」カテゴリの記事

Admin Tools」カテゴリの記事