Microsoft Office

【メモ】 縦書きのダブルクオテーション

正しくは無い記述方法なんだけど 一番違和感を感じない(私が)のはこの方法 202501210345321_2294x1578

|

[Microsoft Word]名前をつけて保存のPDFエクスポート

ワードからPDFに別名保存
Saveaspdf
手順としてはこれと同じ
202501150406012_2222x1080
結構WORDからPDFに変換する方法は多くて
1:Adobe PDF の作成および共有 からPDF作成
2:Document CloudボタンからPDF作成
3:名前を付けて保存からPDF作成(Microsoftオンライン)
4:名前を付けて保存からPDF作成(macOS 印刷に最適)
5:印刷画面からPDFで保存(Apple)
6:印刷画面からPDFで保存(AdobeのSaveAsPDF)
7:印刷画面からpostscript保存してAcrobat DistillerでPDF作成
8:共有からPDFを送信でPDF変換(たぶん3と同じ機能)
AppleScriptで実行されるのは4のquartzを使ったPDF保存になるのかなたぶん
基本的な流れは

AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002
003
004property strUTI : ("org.openxmlformats.wordprocessingml.document") as text
005
006
007#入力ファイルパス テキスト unix形式
008set strFilePath to ("/Library/Documentation/Acknowledgements.rtf") as text
009#入力ファイルパス エイリアス
010set aliasFilePath to (POSIX file strFilePath) as alias
011#ファイル名 テキスト
012tell application "Finder"
013  set strFileName to name of aliasFilePath as text
014end tell
015
016
017#保存ファイル名 テキスト
018set strSaveFileName to (strFileName & ".pdf") as text
019#出力先 デスクトップ エイリアス
020set aliasDesktopDirPath to (path to desktop folder from user domain) as alias
021#デスクトップ UNIXパス テキスト
022set strDesktopDirPath to (POSIX path of aliasDesktopDirPath) as text
023#ファイル名を繋げて 保存先UNIXパステキスト
024set strSaveFilePath to (strDesktopDirPath & strSaveFileName) as text
025#保存先 FURL エイリアス
026set aliasSaveFilePath to (POSIX file strSaveFilePath) as «class furl»
027
028
029tell application "Microsoft Word"
030  open aliasFilePath
031  save as active document file name aliasSaveFilePath file format format PDF
032  close active document saving no
033end tell
034
035
036
037
AppleScriptで生成しました

ドロップレットには向かないがファイル選択してPDFへ別名保存
AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004# ドロップレット形式で書いてありますが
005# Microsoft Office WORDのドロップレットは面倒なので
006# (毎回アクセス許可を問い合わせてくるケースがある)
007# 通常のスクリプトメニューからの実行がおすすめです
008# com.cocolog-nifty.quicktimer.icefloe
009----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
010use AppleScript version "2.8"
011use framework "Foundation"
012use framework "AppKit"
013use scripting additions
014property refMe : a reference to current application
015#WORD専用
016property strUTI : ("org.openxmlformats.wordprocessingml.document") as text
017
018
019#################################
020#【1】クリックでオープンした場合
021on run
022  #ダイアログ を前面に
023  set strName to (name of current application) as text
024  if strName is "osascript" then
025    tell application "Finder" to activate
026  else
027    tell current application to activate
028  end if
029  #デフォルトパス
030  set appFileManager to refMe's NSFileManager's defaultManager()
031  set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
032  set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
033  set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
034  set strMes to ("Microsoft Word ファイルを選んでください") as text
035  set strPrompt to ("Microsoft Word ファイルを選んでください") as text
036  try
037    #ダイアログ
038    set listChooseAliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) with multiple selections allowed without invisibles and showing package contents) as list
039  on error
040    log "エラーしました"
041    return "エラーしました"
042  end try
043  #ファイルリストを次の処理に渡す
044  set boolDone to doPathSender(listChooseAliasFilePath)
045  #戻り値チェック
046  if boolDone is false then
047    display alert "エラーが発生しました" message "エラーが発生しました"
048    return "エラー終了run"
049  else
050    return "処理終了run"
051  end if
052end run
053
054#################################
055#【2】ドロップした場合
056on open listDropAliasFilePath
057  #########UTIチェック
058  #親要素(この属性なら処理する)のUTType
059  set ocidChkUTType to refMe's UTType's typeWithIdentifier:(strUTI)
060  #サブルーチンに渡すリスト
061  set listAliasFilePath to {} as list
062  #ドロップされたアイテムの数だけ繰り返す
063  repeat with itemDropAliasFilePath in listDropAliasFilePath
064    #エイリアス
065    set aliasItemFilePath to itemDropAliasFilePath as alias
066    set strName to (name of current application) as text
067    if strName is "osascript" then
068      tell application "Finder"
069        #Finder情報を取得して
070        set recordInfoFor to info for aliasItemFilePath
071      end tell
072    else
073      tell current application
074        set recordInfoFor to info for aliasItemFilePath
075      end tell
076    end if
077    #ファイルタイプの確認
078    set strFileUTI to (type identifier of recordInfoFor) as text
079    if strFileUTI is strUTI then
080      log "処理対象"
081      #ドロップリストの後方から処理する場合
082      # set beginning of listAliasFilePath to aliasItemFilePath
083      #前方から処理する場合
084      set end of listAliasFilePath to aliasItemFilePath
085    else if strFileUTI is not strUTI then
086      log "処理対象外"
087    end if
088  end repeat
089  #########次工程に渡す
090  set boolDone to doPathSender(listAliasFilePath)
091  if boolDone is not true then
092    return false
093  else
094    return "処理終了open"
095  end if
096end open
097
098#################################
099#【3】1と2から
100#フォルダパスのエイリアスリストを受け取り
101#処理に順番に渡す
102to doPathSender(argListAliasFilePath)
103  set appFileManager to refMe's NSFileManager's defaultManager()
104  #1回でいい処理はここに記述する
105  
106  ####1フォルダパス毎本処理に渡す
107  repeat with itemAliasFilePath in argListAliasFilePath
108    #■本処理に渡す
109    set boolDone to doAction(itemAliasFilePath)
110    #戻り値がエラーだったら?
111    if boolDone is false then
112      tell application "Finder"
113        set strFileName to (name of itemAliasFilePath) as text
114      end tell
115      set strMes to (strFileName & "でエラーになりました") as text
116      display alert "エラーが発生しました" message strMes
117      return strMes
118      #エラーになったところで止める
119    end if
120  end repeat
121  return true
122end doPathSender
123
124#################################
125#【4】実際の処理は全てここ
126to doAction(argAliasFilePath)
127  #入力パス
128  set aliasFilePath to argAliasFilePath as alias
129  set strFilePath to (POSIX path of aliasFilePath) as text
130  set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
131  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
132  #出力パス
133  set ocidBaseFilePath to ocidFilePath's stringByDeletingPathExtension()
134  set ocidSaveFilePath to ocidBaseFilePath's stringByAppendingPathExtension:("pdf")
135  set ocidSaveFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidSaveFilePath) isDirectory:false)
136  set aliasSaveFilePath to (ocidSaveFilePathURL's absoluteURL()) as «class furl»
137  ###上書きチェック
138  set numCntNo to 1 as integer
139  ##上書きでなくなるまで  
140  repeat
141    set appFileManager to refMe's NSFileManager's defaultManager()
142    set boolExists to (appFileManager's fileExistsAtPath:(ocidSaveFilePath)) as boolean
143    if boolExists is true then
144      set strExtensionName to ((numCntNo as text) & ".pdf")
145      set ocidSaveFilePath to ocidBaseFilePath's stringByAppendingPathExtension:(strExtensionName)
146      set ocidSaveFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidSaveFilePath) isDirectory:false)
147      set aliasSaveFilePath to (ocidSaveFilePathURL's absoluteURL()) as «class furl»
148    else
149      exit repeat
150    end if
151    set numCntNo to numCntNo + 1 as integer
152  end repeat
153  ###
154  try
155    ######ここに本処理
156    tell application "Microsoft Word"
157      open aliasFilePath
158      save as active document file name aliasSaveFilePath file format format PDF
159      close active document saving no
160    end tell
161    
162  on error
163    #エラーになったらfalseを戻す
164    return false
165  end try
166  return true
167end doAction
AppleScriptで生成しました

|

Office-Reset(Microsoft Officeのライセンスリセットツール)

Microsoft Officeのリセットツール 202412070111461_1246x888
https://office-reset.com/

|

Microsoft Officeのメタデータ(作成者情報等)を一括削除する



ダウンロード - deletemetadata.zip




AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#  メタデータの削除 Microsoft Office XML形式対応版
005# Microsoft Officeファイルの作成者等のメタ情報を削除します
006#com.cocolog-nifty.quicktimer.icefloe
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "UniformTypeIdentifiers"
011use framework "AppKit"
012use scripting additions
013property refMe : a reference to current application
014
015
016set strName to (name of current application) as text
017if strName is "osascript" then
018  tell application "Finder" to activate
019else
020  tell current application to activate
021end if
022set appFileManager to refMe's NSFileManager's defaultManager()
023set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
024set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
025set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
026set listUTI to {"org.openxmlformats.spreadsheetml.sheet", "org.openxmlformats.presentationml.presentation", "org.openxmlformats.wordprocessingml.document"} as list
027set strMes to ("ファイルを選んでください") as text
028set strPrompt to ("ファイルを選んでください") as text
029
030try
031  set listAliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles, showing package contents and multiple selections allowed) as list
032on error
033  log "エラーしました"
034  return "エラーしました"
035end try
036
037#本処理
038repeat with itemAliasFilePath in listAliasFilePath
039  set aliasFilePath to itemAliasFilePath as alias
040  ##元ファイル
041  set strFilePath to (POSIX path of aliasFilePath) as text
042  set ocidFilePathStr to (refMe's NSString's stringWithString:(strFilePath))
043  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
044  set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
045  set ocidFileName to ocidFilePathURL's lastPathComponent()
046  set ocidExtensionName to ocidFilePathURL's pathExtension()
047  set ocidBaseFileName to ocidFileName's stringByDeletingPathExtension()
048  ##
049  set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
050  set strSetValue to ("処理済." & (ocidExtensionName as text))
051  set ocidSaveFilePathURL to (ocidBaseFilePathURL's URLByAppendingPathExtension:(strSetValue))
052  set strSaveFilePath to ocidSaveFilePathURL's |path|() as text
053  
054  ###テンポラリ 再起動時に自動削除
055  set appFileManager to refMe's NSFileManager's defaultManager()
056  set ocidTempDirURL to appFileManager's temporaryDirectory()
057  set ocidUUID to refMe's NSUUID's alloc()'s init()
058  set ocidUUIDString to ocidUUID's UUIDString
059  set ocidUUIDDirPathURL to (ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:(true))
060  set ocidTempDirPathURL to (ocidUUIDDirPathURL's URLByAppendingPathComponent:(ocidBaseFileName) isDirectory:(true))
061  set strTempDirPath to ocidTempDirPathURL's |path|() as text
062  #
063  set ocidAttrDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
064  (ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions))
065  set listDone to (appFileManager's createDirectoryAtURL:(ocidTempDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference))
066  #
067  set ocidTmpFilePathURL to (ocidUUIDDirPathURL's URLByAppendingPathComponent:(ocidFileName) isDirectory:(false))
068  set strTmpFilePath to ocidTmpFilePathURL's |path|() as text
069  #
070  set listDone to (appFileManager's copyItemAtURL:(ocidFilePathURL) toURL:(ocidTmpFilePathURL) |error| :(reference))
071  
072  ##########
073  #解凍
074  set strCommandText to ("/usr/bin/unzip \"" & strTmpFilePath & "\" -d \"" & strTempDirPath & "\"")
075  set strExec to ("/bin/zsh -c '" & strCommandText & "'") as text
076  
077  do shell script strExec
078  
079  ##########
080  #
081  set ocidAppPathURL to (ocidTempDirPathURL's URLByAppendingPathComponent:("docProps/app.xml") isDirectory:(false))
082  set ocidCorePathURL to (ocidTempDirPathURL's URLByAppendingPathComponent:("docProps/core.xml") isDirectory:(false))
083  
084  ####################
085  #core.xml
086  set ocidOption to (refMe's NSDataReadingMappedIfSafe)
087  set listResponse to (refMe's NSData's alloc()'s initWithContentsOfURL:(ocidCorePathURL) options:(ocidOption) |error| :(reference))
088  set ocidReadData to (item 1 of listResponse)
089  #
090  set ocidOption to (refMe's NSXMLNodePreserveAll) + (refMe's NSXMLDocumentTidyXML)
091  set listResponse to (refMe's NSXMLDocument's alloc()'s initWithData:(ocidReadData) options:(ocidOption) |error| :(reference))
092  set ocidReadXMLDoc to (item 1 of listResponse)
093  #削除は後ろから
094  set ocidRootElement to ocidReadXMLDoc's rootElement()
095  #set ocidChildArray to ocidRootElement's children()
096  set numCntChild to ocidRootElement's childCount()
097  # set numCntChild to ocidChildArray's |count|()
098  repeat with itemNo from (numCntChild - 1) to 0 by -1
099    (ocidRootElement's removeChildAtIndex:(itemNo))
100    # set itemChild to (ocidRootElement's childAtIndex:(itemNo))
101    # (itemChild's setStringValue:(""))
102  end repeat
103  
104  #【保存】
105  set ocidSaveData to (ocidReadXMLDoc's XMLDataWithOptions:(refMe's NSXMLNodePrettyPrint))
106  set listDone to (ocidSaveData's writeToURL:(ocidCorePathURL) options:(refMe's NSDataWritingAtomic) |error| :(reference))
107  
108  ####################
109  #app.xml
110  set ocidOption to (refMe's NSDataReadingMappedIfSafe)
111  set listResponse to (refMe's NSData's alloc()'s initWithContentsOfURL:(ocidAppPathURL) options:(ocidOption) |error| :(reference))
112  set ocidReadData to (item 1 of listResponse)
113  #
114  set ocidOption to (refMe's NSXMLNodePreserveAll) + (refMe's NSXMLDocumentTidyXML)
115  set listResponse to (refMe's NSXMLDocument's alloc()'s initWithData:(ocidReadData) options:(ocidOption) |error| :(reference))
116  set ocidReadXMLDoc to (item 1 of listResponse)
117  #削除は後ろから
118  set ocidRootElement to ocidReadXMLDoc's rootElement()
119  #set ocidChildArray to ocidRootElement's children()
120  set numCntChild to ocidRootElement's childCount()
121  # set numCntChild to ocidChildArray's |count|()
122  repeat with itemNo from (numCntChild - 1) to 0 by -1
123    (ocidRootElement's removeChildAtIndex:(itemNo))
124    # set itemChild to (ocidRootElement's childAtIndex:(itemNo))
125    # (itemChild's setStringValue:(""))
126  end repeat
127  #【保存】
128  set ocidSaveData to (ocidReadXMLDoc's XMLDataWithOptions:(refMe's NSXMLNodePrettyPrint))
129  set listDone to (ocidSaveData's writeToURL:(ocidAppPathURL) options:(refMe's NSDataWritingAtomic) |error| :(reference))
130  
131  ##########
132  #
133  set strExtension to (missing value)
134  set ocidOption to (refMe's NSDirectoryEnumerationSkipsHiddenFiles)
135  set ocidKeyArray to (refMe's NSMutableArray's alloc()'s initWithCapacity:(0))
136  (ocidKeyArray's addObject:(refMe's NSURLPathKey))
137  (ocidKeyArray's addObject:(refMe's NSURLPathKey))
138  set listResponse to (appFileManager's contentsOfDirectoryAtURL:(ocidTempDirPathURL) includingPropertiesForKeys:(ocidKeyArray) options:(ocidOption) |error| :(reference))
139  set ocidSubPathURLArray to (item 1 of listResponse)
140  set strPathNameList to ("") as text
141  repeat with itemSubPathURL in ocidSubPathURLArray
142    set strItemName to itemSubPathURL's lastPathComponent() as text
143    set strPathNameList to (strPathNameList & "\"" & strItemName & "\" ")
144    #拡張子判定 使ってないので削除してもいい
145    if strItemName is "xl" then
146      set strExtension to "xlsx" as text
147    else if strItemName is "ppt" then
148      set strExtension to "pptx" as text
149    else if strItemName is "word" then
150      set strExtension to "docx" as text
151    else if strItemName is "OPS" then
152      set strExtension to "epub" as text
153    end if
154  end repeat
155  if strExtension = (missing value) then
156    return "フォルダの構造に誤りがあります"
157  end if
158  
159  ##########
160  #
161  set strCommandText to ("/usr/sbin/dot_clean -n -m -v \"" & strTempDirPath & "\"") as text
162  set strExec to ("/bin/zsh -c '" & strCommandText & "'") as text
163  try
164    do shell script strExec
165  on error
166    return "dot_cleanでエラー"
167  end try
168  
169  set strCommandText to ("/usr/bin/find \"" & strTempDirPath & "\" -name \".DS_Store\" -type f -delete") as text
170  set strExec to ("/bin/zsh -c '" & strCommandText & "'") as text
171  try
172    do shell script strExec
173  on error
174    return "findでエラー"
175  end try
176  
177  set strCommandText to ("/usr/bin/cd \"" & strTempDirPath & "\"") as text
178  set strExec to ("/bin/zsh -c '" & strCommandText & "'") as text
179  try
180    do shell script strExec
181  on error
182    return "cdでエラー"
183  end try
184  ##########
185  set strCommandText to ("pushd  \"" & strTempDirPath & "\"") as text
186  set strExec to ("/bin/zsh -c '" & strCommandText & "'") as text
187  try
188    do shell script strExec
189  on error
190    return "pushdでエラー"
191  end try
192  ##########
193  set strCommandText to ("pushd \"" & strTempDirPath & "\" && \"/usr/bin/zip\" -rX \"" & strSaveFilePath & "\" " & strPathNameList & "") as text
194  set strExec to ("/bin/zsh -c '" & strCommandText & "'") as text
195  try
196    do shell script strExec
197  on error
198    return "zipでエラー"
199  end try
200  
201  
202end repeat
AppleScriptで生成しました

|

[Microsoft Office]スタートアップを停止する (マクロの警告)

以前の記事
『ドキュメントにはマクロが含まれています。
このアプリケーションのマクロ言語サポートは使用できないよう設定されています。VBA
を必要とする機能は使用できません。このドキュメントを読み取り専用で開きますか』
[Microsoft Office]スタートアップを停止するから
少し仕様に変更が入った
最新のMicrosoft Officeだと
ローカルドメインにテンプレートとしてインストールされるように変更になった

202411220306221_1680x462

Group Containersにコピーされたファイルは削除しても
復旧できるようになったようだ
なので
設定でどうするか?VBA使うのか?使わないのか?を決めて設定と削除を行うと良いかな


202411220300591_520x520

|

[List]Microsoft Officeアップデート履歴(macadmins.softwareからの転記)

Release DateVersionBuild DateKB Article / FixSuite Download
12/12/23 16.80.0 23121017 ReleaseHistoryDownload
11/28/23 16.79.2 23112723 Hotfix+weeklyupdateN/A
11/21/23 16.79.1 23111718 WeeklyUpdateN/A
11/17/23 16.79.1 23111614 FixforVisualBasic/add-in crashN/A
11/14/23 16.79.0 23111019 ReleaseHistoryDownload
10/31/23 16.78.3 23102801 ReleaseHistoryDownload
10/24/23 16.78.2 23092103 WeeklyUpdateN/A
10/17/23 16.78.1 23101305 WeeklyUpdateN/A
10/10/23 16.78.0 23100802 ReleaseHistoryDownload
09/19/23 16.77.1 23091703 WeeklyUpdateN/A
09/19/23 16.77.1 23091703 W/X/PHotfix:'On my Mac' not visible when user is not signed inN/A
09/12/23 16.77.0 23091003 ReleaseHistoryDownload
08/29/23 16.76.2 23082700 WeeklyUpdateN/A
08/24/23 16.76.1 23082301 Hotfix[Word:Some web add-ins won't run] [PPT: Crash when playing movies]N/A
08/22/23 16.76.1 23081800 WeeklyUpdateN/A
08/15/23 16.76.0 23081101 ReleaseHistoryDownload
07/25/23 16.75.2 23072301 WeeklyUpdateN/A
07/20/23 16.75.2 23071901 HotfixforChinesecharactersN/A
07/18/23 16.75.1 23071400 WeeklyUpdateN/A
07/11/23 16.75.0 23070901 ReleaseHistoryDownload
06/27/23 16.74.2 23062500 WeeklyUpdateN/A
06/20/23 16.74.1 23061800 WeeklyUpdateN/A
06/13/23 16.74.0 23061100 ReleaseHistoryDownload
05/30/23 16.73.2 23052700 WeeklyUpdateN/A
05/23/23 16.73.1 23052000 WeeklyUpdateN/A
05/16/23 16.73.0 23051401 ReleaseHistoryDownload
05/02/23 16.72.3 23043001 WeeklyUpdateN/A
04/25/23 16.72.2 23042300 WeeklyUpdateN/A
04/18/23 16.72.1 23041401 WeeklyUpdateN/A
04/11/23 16.72.0 23040900 ReleaseHistoryDownload
03/28/23 16.71.2 23032500 WeeklyUpdateN/A
03/21/23 16.71.1 23031800 WeeklyUpdateN/A
03/14/23 16.71.0 23031200 ReleaseHistoryDownload
02/14/23 16.70.0 23021201 ReleaseHistoryDownload
01/19/23 16.69.1 23011802 FixesNewOutlookcrashN/A
01/18/23 16.69.1 23011600 Fixescrashforconsumer license expiry scenarioN/A
01/10/23 16.69.0 23010700 ReleaseHistoryDownload
12/13/22 16.68.0 22121100 ReleaseHistoryDownload
11/15/22 16.67.0 22111300 ReleaseHistoryDownload
10/31/22 16.66.2 22102801 Fixforlargedatabase repair problem in legacy OutlookN/A
10/12/22 16.66.1 22101101 Fixescrashonlaunch scenarioDownload
10/11/22 16.66.0 22100900 ReleaseHistoryDownload
09/13/22 16.65.0 22091101 ReleaseHistoryDownload
08/16/22 16.64.0 22081401 ReleaseHistoryDownload
07/15/22 16.63.1 W/X/ON:22071301 P:22071401 W/X/P/ON:Chinesedisplay issue P:ThinkCell crashing fixN/A
07/12/22 16.63.0 22070801 ReleaseHistoryDownload
06/14/22 16.62.0 22061100 ReleaseHistoryDownload
05/23/22 16.61.1 22052000 Fix forcrashN/A
05/10/22 16.61.0 22050700 ReleaseHistoryDownload
04/12/22 16.60.0 22041000 ReleaseHistoryDownload
03/15/22 16.59.0 22031300 ReleaseHistoryDownload
02/17/22 16.58.0 22021501 ReleaseHistoryDownload
01/13/22 16.57.0 22011101 ReleaseHistoryDownload
12/14/21 16.56.0 21121100 ReleaseHistoryDownload
11/16/21 16.55.0 21111400 ReleaseHistoryDownload
10/12/21 16.54.0 21101001 ReleaseHistoryDownload
09/16/21 16.53.1 21091502 Fix forSharing UIN/A
09/14/21 16.53.0 21091200 ReleaseHistoryDownload
08/10/21 16.52.0 21080801 ReleaseHistoryDownload
07/13/21 16.51.0 21071101 ReleaseHistoryDownload
06/15/21 16.50.0 21061301 ReleaseHistoryDownload
05/11/21 16.49.0 21050901 ReleaseHistoryDownload
04/13/21 16.48.0 21041102 ReleaseHistoryDownload
03/25/21 16.47.1 21032301 Incorrect cellselection fixN/A
03/16/21 16.47.0 21031401 ReleaseHistoryDownload
02/16/21 16.46.0 21021202 ReleaseHistoryDownload
01/13/21 16.45.0 21011103 ReleaseHistoryDownload
12/15/20 16.44.0 20121301 ReleaseHistoryDownload
11/10/20 16.43.0 20110804 ReleaseHistoryDownload
10/13/20 16.42.0 20101102 ReleaseHistoryDownload
10/13/20 16.16.27 20101200 ReleaseHistoryDownload
09/15/20 16.41.0 20091302 ReleaseHistoryDownload
09/15/20 16.16.26 20091400 ReleaseHistoryDownload
08/11/20 16.40.0 20081000 ReleaseHistoryDownload
08/11/20 16.16.25 20081000 ReleaseHistoryDownload
07/14/20 16.39.0 20071300 ReleaseHistoryDownload
07/14/20 16.16.24 20071300 ReleaseHistoryDownload
06/16/20 16.38.0 20061401 ReleaseHistoryDownload
06/16/20 16.16.23 20061500 ReleaseHistoryDownload
05/12/20 16.37.0 20051002 ReleaseHistoryDownload
05/12/20 16.16.22 20050901 ReleaseHistoryDownload
04/14/20 16.36.0 20041300 ReleaseHistoryDownload
04/14/20 16.16.21 20041301 ReleaseHistoryDownload
03/10/20 16.35.0 20030802 ReleaseHistoryDownload
03/10/20 16.16.20 20030700 ReleaseHistoryDownload
02/11/20 16.34.0 20020900 ReleaseHistoryDownload
02/11/20 16.16.19 20021000 ReleaseHistoryDownload
01/14/20 16.33.0 20011301 ReleaseHistoryDownload
01/14/20 16.16.18 20011202 ReleaseHistoryDownload
12/10/19 16.32.0 19120802 ReleaseHistoryDownload
12/10/19 16.16.17 19120800 ReleaseHistoryDownload
11/12/19 16.31.0 19111002 ReleaseHistoryDownload
11/12/19 16.16.16 19111100 ReleaseHistoryDownload
10/15/19 16.30.0 19101301 ReleaseHistoryDownload
10/15/19 16.16.15 19101400 ReleaseHistoryDownload
09/18/19 16.29.1 19091700 Fix for Signin to access Recents listN/A
09/10/19 16.29.0 19090802 ReleaseHistoryDownload
09/10/19 16.16.14 19090900 ReleaseHistoryDownload
08/13/19 16.28.0 19081202 ReleaseHistoryDownload
08/13/19 16.16.13 19081100 ReleaseHistoryDownload
07/16/19 16.27.0 19071500 ReleaseHistoryDownload
07/16/19 16.16.12 19071500 ReleaseHistoryDownload
06/11/19 16.26.0 19060901 ReleaseHistoryDownload
06/11/19 16.16.11 19060902 ReleaseHistoryDownload
05/14/19 16.25.0 19051201 ReleaseHistoryDownload
05/14/19 16.16.10 19051200 ReleaseHistoryDownload
04/29/19 16.24.1 19042400 Japanese EraFont UpdateN/A
04/16/19 16.24.0 19041401 ReleaseHistoryDownload
04/16/19 16.16.9 19041201 ReleaseHistoryDownload
03/27/19 16.23.1 19032603 REST fix forShared CalendarsN/A
03/12/19 16.23.0 19030902 ReleaseHistoryDownload
03/12/19 16.16.8 19031202 ReleaseHistoryDownload
02/20/19 16.22.1 19022000 REST meetingfix and Google auth fixN/A
02/12/19 16.22.0 19021100 ReleaseHistoryDownload
02/12/19 16.16.7 19021001 ReleaseHistoryDownload
01/24/19 16.21.1 19012303 Accentedcharacter and localization fixN/A
01/16/19 16.21.0 19011500 ReleaseHistoryDownload
01/16/19 16.16.6 19011400 ReleaseHistoryDownload
12/11/18 16.20.0 18120801 ReleaseHistoryDownload
12/11/18 16.16.5 18120901 ReleaseHistoryDownload
11/13/18 16.19.0 18110915 ReleaseHistoryDownload
11/13/18 16.16.4 18111001 ReleaseHistoryDownload
10/16/18 16.18.0 18101400 ReleaseHistoryDownload
10/16/18 16.16.3 18101500 ReleaseHistoryDownload
09/11/18 16.17.0 18090901 ReleaseHistoryDownload
09/11/18 16.16.2 18091001 ReleaseHistoryDownload
08/15/18 16.16.1 18081402 ExcelhotfixN/A
08/14/18 16.16.0 18081201 ReleaseHistoryDownload
07/10/18 16.15.0 18070902 ReleaseHistoryDownload
06/14/18 16.14.1 18061302 Revert tofile-based delta updatesDownload
06/12/18 16.14.0 18061000 ReleaseHistoryDownload
05/24/18 16.13.1 18052304 Consent dialogfixArchived
05/15/18 16.13.0 18051301 ReleaseHistoryArchived
04/11/18 16.12.0 18041000 ReleaseHistoryArchived
03/19/18 16.11.1 18031900 Fixes hang onlaunchN/A
03/13/18 16.11.0 18031100 ReleaseHistoryArchived
02/13/18 16.10.0 18021001 ReleaseHistoryArchived
01/26/18 16.9.1 18012504 ReleaseHistoryN/A
01/18/18 16.9.0 18011602 ReleaseHistoryArchived
12/12/17 15.41.0 171205 ReleaseHistoryArchived
11/14/17 15.40.0 171108 ReleaseHistoryArchived
10/10/17 15.39.0 171010 ReleaseHistoryArchived
09/12/17 15.38.0 170902 ReleaseHistoryArchived
08/15/17 15.37.0 170815 ReleaseHistoryArchived
07/21/17 15.36.1 170721 GroupfixN/A
07/11/17 15.36.0 170702 ReleaseHistoryArchived
06/16/17 15.35.1 170616 ReleaseHistoryN/A
06/13/17 15.35.0 170610 ReleaseHistoryArchived
05/16/17 15.34.0 170515 ReleaseHistoryArchived
04/11/17 15.33.0 170409 ReleaseHistoryArchived
03/14/17 15.32.0 170309 ReleaseHistoryArchived
02/16/17 15.31.0 170216 ReleaseHistoryArchived
01/11/17 15.30.0 170107 ReleaseHistoryArchived
12/15/16 15.29.1 161215 Folder pathfixN/A
12/13/16 15.29.0 161209 ReleaseHistoryArchived
11/17/16 15.28.1 161117 Ex2010 PublicFolder fixN/A
11/15/16 15.28.0 161115 ReleaseHistoryArchived
10/11/16 15.27.0 161010 3193438Archived
09/16/16 15.26.1 160916 Public FolderfixN/A
09/13/16 15.26.0 160910 3186807Archived
08/26/16 15.25.1 160826 Macro fixN/A
08/22/16 15.25.0 160817 3179163Archived
08/22/16 15.25.0 160818 3179163Archived
07/12/16 15.24.0 160709 3170460Archived
06/25/16 15.23.2 160624 MRU ServiceHotfixN/A
06/18/16 15.23.1 160617 Japanese MacroHotfixN/A
06/14/16 15.23.0 160611 3165798Archived
05/13/16 15.22.1 160512 3155777N/A
05/10/16 15.22.0 160506 3155777Archived
04/12/16 15.21.1 160411 3142577Archived
03/16/16 15.20.0 160315 3138327N/A
02/16/16 15.19.1 160212 3134241Archived
01/12/16 15.18.0 160109 3133711Archived
12/17/15 15.17.1 151217 3127248N/A
12/10/15 15.17.0 151206 3119518Archived
11/10/15 15.16.0 151105 3102925Archived
10/13/15 15.15.0 151008 3097264Archived
09/15/15 15.14.0 150911 3088502Archived
08/11/15 15.13.1 150807 3082420Archived
07/28/15 15.12.3 150724 3074482Archived
07/09/15 15.11.2 150701 3074479Archived

|

Microsoft Officeバージョンチェッカー

色々制約があって思ったような形にならなかった…残念

ダウンロード - microsoft20officeverchk.zip




AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#com.cocolog-nifty.quicktimer.icefloe
004#
005----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
006use AppleScript version "2.8"
007use framework "Foundation"
008use framework "UniformTypeIdentifiers"
009use framework "AppKit"
010
011use scripting additions
012property refMe : a reference to current application
013
014
015set ocidDefDict to refMe's NSUserDefaults's alloc()'s initWithSuiteName:("com.cocolog-nifty.quicktimer.mschk")
016
017################## 
018#最新バージョン取得
019set recordLinkID to {|Microsoft 365|:"525133", |Microsoft 365 Pro|:"2009112", |Office 2021|:"525133", |Office 2021 Home|:"799520", |Word 365|:"525134", |Excel 365|:"525135", |PowerPoint 365|:"525136", |Outlook Weekly|:"525137", |Outlook 365|:"2228621", |OneNote|:"820886", |SkypeForBusiness|:"832978", |Company Portal|:"869655", |Edge Stable|:"2093504", |AutoUpdate|:"830196", |Remote Desktop|:"868963"} as record
020# カンパニーポータル=ポータル の更新が少し遅い場合
021#Link IDで853070や862280を利用するがこの場合バージョンが取れない
022set ocidLinkIDDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
023ocidLinkIDDict's setDictionary:(recordLinkID)
024set ocidLinkIDAllKeys to ocidLinkIDDict's allKeys()
025
026##########
027#バージョン取得用DICTを生成
028set ocidWebVerDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
029#URLコンポーネント初期化
030set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
031ocidURLComponents's setScheme:("https")
032ocidURLComponents's setHost:("go.microsoft.com")
033ocidURLComponents's setPath:("/fwlink/")
034
035repeat with itemKey in ocidLinkIDAllKeys
036  set ocidValue to (ocidLinkIDDict's valueForKey:(itemKey))
037  #
038  set ocidQueryItems to (refMe's NSMutableArray's alloc()'s initWithCapacity:(0))
039  (ocidQueryItems's addObject:(refMe's NSURLQueryItem's alloc()'s initWithName:("linkid") value:(ocidValue)))
040  (ocidURLComponents's setQueryItems:(ocidQueryItems))
041  set ocidOpenURL to ocidURLComponents's |URL|()
042  set strURL to ocidOpenURL's absoluteString() as text
043  log strURL
044  ################## 
045  #コマンド整形
046  set strCommandText to ("/usr/bin/curl -Lvs -I -o /dev/null -w '%{url_effective}' \"" & strURL & "\"") as text
047  #コマンド実行
048  set ocidComString to (refMe's NSString's stringWithString:(strCommandText))
049  set ocidTermTask to refMe's NSTask's alloc()'s init()
050  (ocidTermTask's setLaunchPath:("/bin/zsh"))
051  set ocidArgumentsArray to (refMe's NSMutableArray's alloc()'s initWithCapacity:(0))
052  (ocidArgumentsArray's addObject:("-c"))
053  (ocidArgumentsArray's addObject:(ocidComString))
054  (ocidTermTask's setArguments:(ocidArgumentsArray))
055  set ocidOutPut to refMe's NSPipe's pipe()
056  set ocidError to refMe's NSPipe's pipe()
057  (ocidTermTask's setStandardOutput:(ocidOutPut))
058  (ocidTermTask's setStandardError:(ocidError))
059  set listDoneReturn to (ocidTermTask's launchAndReturnError:(reference))
060  if (item 1 of listDoneReturn) is (false) then
061    log "エラーコード:" & (item 2 of listDoneReturn)'s code() as text
062    log "エラードメイン:" & (item 2 of listDoneReturn)'s domain() as text
063    log "Description:" & (item 2 of listDoneReturn)'s localizedDescription() as text
064    log "FailureReason:" & (item 2 of listDoneReturn)'s localizedFailureReason() as text
065  end if
066  #終了待ち
067  ocidTermTask's waitUntilExit()
068  #標準出力をログに
069  set ocidOutPutData to ocidOutPut's fileHandleForReading()
070  set listResponse to (ocidOutPutData's readDataToEndOfFileAndReturnError:(reference))
071  set ocidStdOut to (item 1 of listResponse)
072  set ocidStdOut to (refMe's NSString's alloc()'s initWithData:(ocidStdOut) encoding:(refMe's NSUTF8StringEncoding))
073  set ocidStdOutURL to (refMe's NSURL's alloc()'s initWithString:(ocidStdOut))
074  ##これが戻り値
075  set ocidFileName to ocidStdOutURL's lastPathComponent()
076  set ocidBaseFileName to ocidFileName's stringByDeletingPathExtension()
077  set ocidBaseFileName to (ocidBaseFileName's stringByReplacingOccurrencesOfString:("Microsoft_365") withString:(""))
078  set ocidOption to (refMe's NSRegularExpressionCaseInsensitive)
079  set listResponse to (refMe's NSRegularExpression's regularExpressionWithPattern:("[^0-9.]") options:(ocidOption) |error| :(reference))
080  set appRegex to (item 1 of listResponse)
081  set ocidLength to ocidBaseFileName's |length|()
082  set ocidRange to refMe's NSRange's NSMakeRange(0, ocidLength)
083  set ocidResult to (appRegex's stringByReplacingMatchesInString:(ocidBaseFileName) options:0 range:(ocidRange) withTemplate:(""))
084  set ocidSetDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
085  (ocidSetDict's setValue:(ocidStdOut) forKey:("URL"))
086  (ocidSetDict's setValue:(ocidResult) forKey:("VERSION"))
087  (ocidWebVerDict's setObject:(ocidSetDict) forKey:(itemKey))
088end repeat
089
090
091################## 
092#ローカルバージョン取得
093set recordBundleID to {|Microsoft 365|:"com.microsoft.office.suite.365", |Microsoft 365 Pro|:"com.microsoft.office.suite.365.businesspro", |Office 2021|:"com.microsoft.office.suite.2021", |Office 2021 Home|:"com.microsoft.office.suite.2021.home", |Word 365|:"com.microsoft.Word", |Excel 365|:"com.microsoft.Excel", |PowerPoint 365|:"com.microsoft.Powerpoint", |Outlook Weekly|:"com.microsoft.Outlook", |Outlook 365|:"com.microsoft.Outlook", |OneNote|:"com.microsoft.onenote.mac", |SkypeForBusiness|:"com.microsoft.SkypeForBusiness", |Company Portal|:"com.microsoft.CompanyPortalMac", |Edge Stable|:"com.microsoft.edgemac", |AutoUpdate|:"com.microsoft.autoupdate2", |Remote Desktop|:"com.microsoft.rdc.macos"} as record
094
095#バンドルIDのDICTから
096set ocidBundleIdDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
097ocidBundleIdDict's setDictionary:(recordBundleID)
098set ocidBundleIdAllKeys to ocidBundleIdDict's allKeys()
099
100#バージョン取得用の逆順DICTを生成
101set ocidLocalVerDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
102repeat with itemKey in ocidBundleIdAllKeys
103  set ocidValue to (ocidBundleIdDict's valueForKey:(itemKey))
104  (ocidLocalVerDict's setValue:("") forKey:(ocidValue))
105end repeat
106set ocidAllKeys to ocidLocalVerDict's allKeys()
107repeat with itemKey in ocidAllKeys
108  #
109  set ocidAppBundle to (refMe's NSBundle's bundleWithIdentifier:(itemKey))
110  if ocidAppBundle = (missing value) then
111    set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
112    set ocidAppPathURL to (appSharedWorkspace's URLForApplicationWithBundleIdentifier:(itemKey))
113    if ocidAppPathURL = (missing value) then
114      try
115        tell application "Finder"
116          set aliasAppApth to (application file id itemKey) as alias
117          set strAppPath to (POSIX path of aliasAppApth) as text
118        end tell
119        set strAppPathStr to (refMe's NSString's stringWithString:(strAppPath))
120        set strAppPath to strAppPathStr's stringByStandardizingPath()
121        set ocidAppPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(strAppPath) isDirectory:true)
122      on error
123        set ocidVersionIr to "未インストール" as text
124      end try
125    else
126      set ocidAppBundle to (refMe's NSBundle's bundleWithPath:(ocidAppPathURL's |path|))
127      if (itemKey as text) is "com.microsoft.rdc.macos" then
128        set ocidVersionIr to (ocidAppBundle's objectForInfoDictionaryKey:("CFBundleShortVersionString"))
129      else
130        set ocidVersionIr to (ocidAppBundle's objectForInfoDictionaryKey:("CFBundleVersion"))
131      end if
132    end if
133  else
134    set ocidAppPathURL to ocidAppBundle's bundleURL()
135    if (itemKey as text) is "com.microsoft.rdc.macos" then
136      set ocidVersionIr to (ocidAppBundle's objectForInfoDictionaryKey:("CFBundleShortVersionString"))
137    else if (itemKey as text) is "com.microsoft.CompanyPortalMac" then
138      set ocidVersionIr to (ocidAppBundle's objectForInfoDictionaryKey:("CFBundleShortVersionString"))
139    else if (itemKey as text) is "com.microsoft.edgemac" then
140      set ocidVersionIr to (ocidAppBundle's objectForInfoDictionaryKey:("CFBundleShortVersionString"))
141    else
142      set ocidVersionIr to (ocidAppBundle's objectForInfoDictionaryKey:("CFBundleVersion"))
143    end if
144  end if
145  if ocidVersionIr = (missing value) then
146    try
147      tell application "Finder"
148        set aliasAppApth to (application file id strBundleID) as alias
149        set strAppPath to (POSIX path of aliasAppApth) as text
150      end tell
151      set strAppPathStr to (refMe's NSString's stringWithString:(strAppPath))
152      set strAppPath to strAppPathStr's stringByStandardizingPath()
153      set ocidAppPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(strAppPath) isDirectory:true)
154    on error
155      set ocidVersionIr to "未インストール" as text
156    end try
157  end if
158  #
159  if ocidVersionIr is "未インストール" then
160    set strVersion to ocidVersionIr as text
161  else
162    set ocidInfoFilePathURL to (ocidAppPathURL's URLByAppendingPathComponent:("/Contents/Info.plist") isDirectory:(false))
163    set listResponse to (refMe's NSDictionary's alloc()'s initWithContentsOfURL:(ocidInfoFilePathURL) |error| :(reference))
164    set ocidInfoDict to (item 1 of listResponse)
165    if (itemKey as text) is "com.microsoft.rdc.macos" then
166      set ocidVersion to (ocidInfoDict's valueForKey:("CFBundleShortVersionString"))
167    else if (itemKey as text) is "com.microsoft.CompanyPortalMac" then
168      set ocidVersion to (ocidInfoDict's valueForKey:("CFBundleShortVersionString"))
169    else if (itemKey as text) is "com.microsoft.edgemac" then
170      set ocidVersion to (ocidInfoDict's valueForKey:("CFBundleShortVersionString"))
171    else
172      set ocidVersion to (ocidInfoDict's valueForKey:("CFBundleVersion"))
173    end if
174    if (ocidVersion as text) ≠ (ocidVersionIr as text) then
175      set strVersion to ((ocidVersion as text) & "※") as text
176      log "※:Launch Services Registerの値と相違がありました"
177    else
178      set strVersion to ocidVersion as text
179    end if
180  end if
181  
182  (ocidLocalVerDict's setValue:(strVersion) forKey:(itemKey))
183end repeat
184
185
186##############################
187# XML 生成開始
188##############################
189# タイトル
190set strTitleText to ("Microsoft Officeバージョンチェッカー") as text
191#サブタイトル
192set strSubTitle to ("インストール済みバージョンをチェックします") as text
193
194########################################
195#headerに渡すエレメント
196set ocidSetHeaderElement to (refMe's NSXMLElement's elementWithName:("div"))
197set ocidH3Element to (refMe's NSXMLElement's elementWithName:("h3"))
198##タイトルを入れる
199(ocidH3Element's setStringValue:(strTitleText))
200(ocidSetHeaderElement's addChild:(ocidH3Element))
201
202########################################
203#footerに渡すエレメント
204set ocidSetFooterElement to (refMe's NSXMLElement's elementWithName:("div"))
205#リンクをつける
206set ocidAElement to (refMe's NSXMLElement's elementWithName:("a"))
207set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("href") stringValue:("https://quicktimer.cocolog-nifty.com/"))
208(ocidAElement's addAttribute:(ocidAddNode))
209set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("target") stringValue:("_blank"))
210(ocidAElement's addAttribute:(ocidAddNode))
211set strContents to ("AppleScriptで生成しました") as text
212(ocidAElement's setStringValue:(strContents))
213(ocidSetFooterElement's addChild:(ocidAElement))
214
215########################################
216#articleに渡すエレメント
217set ocidSetArticleElement to (refMe's NSXMLElement's elementWithName:("div"))
218set ocidH3Element to (refMe's NSXMLElement's elementWithName:("h5"))
219(ocidH3Element's setStringValue:(strSubTitle))
220(ocidSetArticleElement's addChild:(ocidH3Element))
221
222########################################
223#テーブル部生成開始
224set ocidTableElement to (refMe's NSXMLElement's elementWithName:("table"))
225#########【caption】
226set ocidCaptionElement to (refMe's NSXMLElement's elementWithName:("caption"))
227(ocidCaptionElement's setStringValue:("※:Launch Services Registerの値と相違有り"))
228(ocidTableElement's addChild:(ocidCaptionElement))
229############
230#【colgroup】
231set ocidColgroupElement to (refMe's NSXMLElement's elementWithName:("colgroup"))
232#テーブルのタイトル部
233set listColName to {"行番号", "App名", "Bundle ID", "【Current】Version", "【Local】Version", "リンク"} as list
234set listColID to {"liineNO", "AppName", "BundleID", "currentVersion", "localVersion", "LinkIcon"} as list
235
236#項目数を取得して
237set numCntCol to (count of listColName) as integer
238#タイトル部の数だけ繰り返し
239repeat with itemNo from 1 to numCntCol by 1
240  set strItemName to (item itemNo of listColName) as text
241  #【col】col生成
242  set ocidAddElement to (refMe's NSXMLElement's elementWithName:("col"))
243  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(strItemName))
244  (ocidAddElement's addAttribute:(ocidAddNode))
245  (ocidColgroupElement's addChild:(ocidAddElement))
246end repeat
247#テーブルエレメントに追加
248(ocidTableElement's addChild:(ocidColgroupElement))
249log "COL部終了"
250
251############
252#【thead】
253set ocidTheadElement to (refMe's NSXMLElement's elementWithName:("thead"))
254######
255#TH フォルダ名 
256set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr"))
257#タイトル部の数だけ繰り返し
258repeat with itemNo from 1 to numCntCol by 1
259  set strItemName to (item itemNo of listColName) as text
260  set strItemID to (item itemNo of listColID) as text
261  #ここはTDではなくてTHを利用
262  set ocidAddElement to (refMe's NSXMLElement's elementWithName:("th"))
263  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(strItemName))
264  (ocidAddElement's addAttribute:(ocidAddNode))
265  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("id") stringValue:(strItemID))
266  (ocidAddElement's addAttribute:(ocidAddNode))
267  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
268  (ocidAddElement's addAttribute:(ocidAddNode))
269  #値を入れる
270  (ocidAddElement's setStringValue:(strItemName))
271  #TH→TRにセット
272  (ocidTrElement's addChild:(ocidAddElement))
273end repeat
274#TRをTHEADにセット
275(ocidTheadElement's addChild:(ocidTrElement))
276#THEADをテーブルにセット
277(ocidTableElement's addChild:(ocidTheadElement))
278log "THEAD部終了"
279
280############
281log "TBODY処理開始"
282#【tbody】
283set ocidTbodyElement to refMe's NSXMLElement's elementWithName:("tbody")
284#キーを取り出してソートしておく
285set ocidAllKeys to ocidBundleIdDict's allKeys()
286set ocidSortedAllKey to ocidAllKeys's sortedArrayUsingSelector:("localizedStandardCompare:")
287
288############
289set numCntLineNo to 0 as integer
290set listAppName to {"Microsoft 365", "Microsoft 365 Pro", "Office 2021", "Office 2021 Home", "Word 365", "Excel 365", "PowerPoint 365", "Outlook Weekly", "Outlook 365", "OneNote", "SkypeForBusiness", "Company Portal", "Edge Stable", "AutoUpdate", "Remote Desktop"} as list
291repeat with itemAppName in listAppName
292  set numCntLineNo to (numCntLineNo + 1) as integer
293  #
294  set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr"))
295  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("row"))
296  (ocidTrElement's addAttribute:(ocidAddNode))
297  #TD
298  set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
299  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(item 1 of listColID))
300  (ocidTdElement's addAttribute:(ocidAddNode))
301  (ocidTdElement's setStringValue:(numCntLineNo as text))
302  (ocidTrElement's addChild:(ocidTdElement))
303  #TD
304  set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
305  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(item 2 of listColID))
306  (ocidTdElement's addAttribute:(ocidAddNode))
307  (ocidTdElement's setStringValue:(itemAppName))
308  (ocidTrElement's addChild:(ocidTdElement))
309  
310  set ocidItemBundleID to (ocidBundleIdDict's valueForKey:(itemAppName))
311  log itemAppName as text
312  set ocidSubDict to (ocidWebVerDict's valueForKey:(itemAppName))
313  set ocidVersion to (ocidSubDict's valueForKey:("VERSION"))
314  set ocidLinkURL to (ocidSubDict's valueForKey:("URL"))
315  if ocidItemBundleID = (missing value) then
316    set ocidLocalVer to "" as text
317  else
318    set ocidLocalVer to (ocidLocalVerDict's valueForKey:(ocidItemBundleID))
319  end if
320  #TD
321  set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
322  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(item 2 of listColID))
323  (ocidTdElement's addAttribute:(ocidAddNode))
324  (ocidTdElement's setStringValue:(ocidItemBundleID))
325  (ocidTrElement's addChild:(ocidTdElement))
326  #TD
327  set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
328  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(item 3 of listColID))
329  (ocidTdElement's addAttribute:(ocidAddNode))
330  (ocidTdElement's setStringValue:(ocidVersion))
331  (ocidTrElement's addChild:(ocidTdElement))
332  #TD
333  set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
334  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(item 4 of listColID))
335  (ocidTdElement's addAttribute:(ocidAddNode))
336  (ocidTdElement's setStringValue:(ocidLocalVer))
337  (ocidTrElement's addChild:(ocidTdElement))
338  #TD
339  set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
340  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(item 5 of listColID))
341  (ocidTdElement's addAttribute:(ocidAddNode))
342  #A
343  set ocidAElement to (refMe's NSXMLElement's elementWithName:("a"))
344  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("target") stringValue:("_blank"))
345  (ocidAElement's addAttribute:(ocidAddNode))
346  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("href") stringValue:(ocidLinkURL))
347  (ocidAElement's addAttribute:(ocidAddNode))
348  #
349  set ocidImgElement to (refMe's NSXMLElement's elementWithName:("img"))
350  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("style") stringValue:("border: 0;"))
351  (ocidImgElement's addAttribute:(ocidAddNode))
352  set strSetPath to ("../icons/" & ocidItemBundleID & ".iconset/icon_16x16@2x.png") as text
353  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("src") stringValue:(strSetPath))
354  (ocidImgElement's addAttribute:(ocidAddNode))
355  #
356  (ocidAElement's addChild:(ocidImgElement))
357  (ocidTdElement's addChild:(ocidAElement))
358  (ocidTrElement's addChild:(ocidTdElement))
359  ########
360  (ocidTbodyElement's addChild:(ocidTrElement))
361end repeat
362(ocidTableElement's addChild:(ocidTbodyElement))
363
364
365############
366#【tfoot】 TRで
367set ocidTfootElement to (refMe's NSXMLElement's elementWithName:("tfoot"))
368set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr"))
369#colspan指定して1行でセット
370set ocidThElement to (refMe's NSXMLElement's elementWithName:("th"))
371set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("テーブルの終わり"))
372(ocidThElement's addAttribute:(ocidAddNode))
373set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("colspan") stringValue:(numCntCol as text))
374(ocidThElement's addAttribute:(ocidAddNode))
375set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("row"))
376(ocidThElement's addAttribute:(ocidAddNode))
377(ocidThElement's setStringValue:("Company Portalで相違が出る場合は: https://go.microsoft.com/fwlink/?linkid=862280"))
378#THをTRにセットして
379(ocidTrElement's addChild:(ocidThElement))
380#TRをTFOOTにセット
381(ocidTfootElement's addChild:(ocidTrElement))
382#TFOOTをテーブルにセット
383(ocidTableElement's addChild:(ocidTfootElement))
384
385##############################
386#HTMLにする
387##############################
388# 出来上がったテーブルをArticleエレメントにセット
389(ocidSetArticleElement's addChild:(ocidTableElement))
390#
391set ocidHTML to doMakeRootElement({ocidSetHeaderElement, ocidSetArticleElement, ocidSetFooterElement, strTitleText})
392
393
394##############################
395#保存
396##############################
397#読み取りやすい表示
398set ocidXMLdata to (ocidHTML's XMLDataWithOptions:(refMe's NSXMLNodePrettyPrint))
399#保存
400set aliasPathToMe to (path to me) as alias
401set strPathToMe to (POSIX path of aliasPathToMe) as text
402set ocidPathToMeStr to refMe's NSString's stringWithString:(strPathToMe)
403set ocidPathToMe to ocidPathToMeStr's stringByStandardizingPath()
404set ocidPathToMeURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidPathToMe) isDirectory:(false)
405set ocidContainerDirPathURL to ocidPathToMeURL's URLByDeletingLastPathComponent()
406set ocidSaveDirPathURL to ocidContainerDirPathURL's URLByAppendingPathComponent:("OutPut") isDirectory:(true)
407set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:("index.html") isDirectory:(true)
408
409set listDone to (ocidXMLdata's writeToURL:(ocidSaveFilePathURL) options:(refMe's NSDataWritingAtomic) |error| :(reference))
410set aliasFilePath to (ocidSaveFilePathURL's absoluteURL()) as alias
411####【6】ブラウザで開く
412tell application "Finder"
413  open location aliasFilePath
414end tell
415
416
417
418
419############################################################
420# 基本的なHTMLの構造
421(*
422doMakeRootElement({argHeaderContents, argArticleContents, argFooterContents,argTitleText})
423HTMLのBODY部
424header
425article
426footerにそれぞれAddchildするデータをリストで渡す
427戻り値はRootエレメントにセットされた
428NSXMLDocumentを戻すので 保存すればOK
429*)
430############################################################
431to doMakeRootElement({argHeaderContents, argArticleContents, argFooterContents, argTitleText})
432  #XML初期化
433  set ocidXMLDoc to refMe's NSXMLDocument's alloc()'s init()
434  ocidXMLDoc's setDocumentContentKind:(refMe's NSXMLDocumentHTMLKind)
435  # DTD付与
436  set ocidDTD to refMe's NSXMLDTD's alloc()'s init()
437  ocidDTD's setName:("html")
438  ocidXMLDoc's setDTD:(ocidDTD)
439  #
440  set ocidRootElement to refMe's NSXMLElement's elementWithName:("html")
441  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("lang") stringValue:("ja")
442  ocidRootElement's addAttribute:(ocidAddNode)
443  #
444  set ocidHeadElement to refMe's NSXMLElement's elementWithName:("head")
445  #
446  set ocidAddElement to refMe's NSXMLElement's elementWithName:("title")
447  ocidAddElement's setStringValue:(argTitleText)
448  ocidHeadElement's addChild:(ocidAddElement)
449  # http-equiv
450  set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta")
451  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("http-equiv") stringValue:("Content-Type")
452  ocidAddElement's addAttribute:(ocidAddNode)
453  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("text/html; charset=UTF-8")
454  ocidAddElement's addAttribute:(ocidAddNode)
455  ocidHeadElement's addChild:(ocidAddElement)
456  #
457  set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta")
458  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("http-equiv") stringValue:("Content-Style-Type")
459  ocidAddElement's addAttribute:(ocidAddNode)
460  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("text/css")
461  ocidAddElement's addAttribute:(ocidAddNode)
462  ocidHeadElement's addChild:(ocidAddElement)
463  #
464  set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta")
465  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("http-equiv") stringValue:("Content-Script-Type")
466  ocidAddElement's addAttribute:(ocidAddNode)
467  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("text/javascript")
468  ocidAddElement's addAttribute:(ocidAddNode)
469  ocidHeadElement's addChild:(ocidAddElement)
470  #
471  set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta")
472  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("name") stringValue:("viewport")
473  ocidAddElement's addAttribute:(ocidAddNode)
474  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("width=720")
475  ocidAddElement's addAttribute:(ocidAddNode)
476  ocidHeadElement's addChild:(ocidAddElement)
477  #
478  set ocidAddElement to refMe's NSXMLElement's elementWithName:("style")
479  ocidAddElement's setStringValue:("body { margin: 10px; background-color: #FFFFFF; } table { border-spacing: 0; caption-side: top; font-family: system-ui; } thead th { border: solid 1px #666666; padding: .5ch 1ch; border-block-width: 1px 0; border-inline-width: 1px 0; &:first-of-type { border-start-start-radius: .5em } &:last-of-type { border-start-end-radius: .5em; border-inline-end-width: 1px } } tbody td { word-wrap: break-word;max-width: 360px;border-spacing: 0; border: solid 1px #666666; padding: .5ch 1ch; border-block-width: 1px 0; border-inline-width: 1px 0; &:last-of-type { border-inline-end-width: 1px } } tbody th { border-spacing: 0; border: solid 1px #666666; padding: .5ch 1ch; border-block-width: 1px 0; border-inline-width: 1px 0; } tbody tr:nth-of-type(odd) { background: #F2F2F2; } .kind_string { font-size: 0.75em; } .date_string { font-size: 0.5em; } .tbody_th_title{text-align: left;} tfoot th { border: solid 1px #666666; padding: .5ch 1ch; &:first-of-type { border-end-start-radius: .5em } &:last-of-type { border-end-end-radius: .5em; border-inline-end-width: 1px } }")
480  ocidHeadElement's addChild:(ocidAddElement)
481  ocidRootElement's addChild:(ocidHeadElement)
482  #
483  #ボディエレメント
484  set ocidBodyElement to refMe's NSXMLElement's elementWithName:("body")
485  #ヘッダー
486  set ocidHeaderElement to refMe's NSXMLElement's elementWithName:("header")
487  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("header")
488  ocidHeaderElement's addAttribute:(ocidAddNode)
489  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_header")
490  ocidHeaderElement's addAttribute:(ocidAddNode)
491  ocidHeaderElement's addChild:(argHeaderContents)
492  ocidBodyElement's addChild:(ocidHeaderElement)
493  #アーティクル
494  set ocidArticleElement to refMe's NSXMLElement's elementWithName:("article")
495  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("article")
496  ocidArticleElement's addAttribute:(ocidAddNode)
497  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_article")
498  ocidArticleElement's addAttribute:(ocidAddNode)
499  ocidArticleElement's addChild:(argArticleContents)
500  ocidBodyElement's addChild:(ocidArticleElement)
501  #フッター
502  set ocidFooterElement to refMe's NSXMLElement's elementWithName:("footer")
503  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("footer")
504  ocidFooterElement's addAttribute:(ocidAddNode)
505  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_footer")
506  ocidFooterElement's addAttribute:(ocidAddNode)
507  ocidFooterElement's addChild:(argFooterContents)
508  ocidBodyElement's addChild:(ocidFooterElement)
509  #ボディをROOTエレメントにセット
510  ocidRootElement's addChild:(ocidBodyElement)
511  #ROOTをXMLにセット
512  ocidXMLDoc's setRootElement:(ocidRootElement)
513  #値を戻す
514  return ocidXMLDoc
515end doMakeRootElement
516
AppleScriptで生成しました

|

Microsoft Office for Mac Tools and Scripts

macadmins.softwareがドメイン落ちした
一部のリンクを回収しておくことにした

設定値一覧

https://docs.google.com/spreadsheets/d/1ESX5td0y0OP3jdzZ-C2SItm-TUi-iA_bcHCBvaoCumw/edit?gid=0#gid=0



Microsoft Office for Mac Tools and Scripts
ToolNameDescription
DownloadOffice-ResetDetects problems and repairs Office 365/2021/2019/2016 apps. Can also be used to completely remove Office
View/DownloadSignInHelperHelper script for Jamf Pro that detects the UPN and pre-fills the sign in information for Office apps
View/DownloadInstallerCacheDownloads Office installer packages from the Office CDN to a shared folder - for use with a web server
View/DownloadmsupdatehelperHelper script for Jamf Pro that calls the new msupdate command-line support in MAU 3.18 and later
View/DownloadResetUpdateMessageResets (suppresses) the 'Office Update' message bar (nag) that appears when the installed build is older than 90 days
DownloadMailToOutlook 2.1Simple PKG installer that sets the default e-mail app (+ ics/vcs/vcf/eml files) to Outlook instead of the built-in Mail app (Jamf Pro compatible)
View/DownloadFlightResetRemoves and resets the flighting configuration for Office for Mac applications
View/DownloadLicense Removal ToolOfficial Microsoft tool to remove all Office licenses from a computer
View/DownloadOutlookFontPokeSets default compose and reply font from the command-line in Outlook for Mac
View/DownloadUnlicenseRemoves volume and/or Office 365 licenses from an Office for Mac installation
View/DownloadMAUCacheAdminTool for setting up your own Microsoft AutoUpdate Caching Server
View/DownloadRemove2011Removes Office 2011 from your computer
View/DownloadOfficeCDNCheckReports which versions of Office apps are available on the Microsoft CDN
View/DownloadGalleryViewPokeEnables and disables the default gallery view in Office for Mac applications
View/DownloadCrashLoggerEnables and manages the ability for Microsoft Error Reporting to save application crash logs to disk
View/DownloadOutlookDBVerReports the version of the Outlook database
View/DownloadOfficeDetectDetects and reports out Office for Mac installation and configuration
View/DownloadNukeOffKeychainRemoves all keychain entries from an Office for Mac installation
View/DownloadDisableStoreRemoves the Store and Add-in icons from the ribbon in Office for Mac apps

URLDescription
LinkOffice 365/2019 16.31+ requirement for macOS 10.13.6 and later
LinkOffice in the Mac App Store - Commercial Q&A
LinkOffice in the Mac App Store - Consumer Q&A
LinkOffice in the Mac App Store - Perpetual/Volume License Limitation
LinkOffice 2019 and Office 365 support for macOS N-2
LinkOffice 365 Requirement for macOS 10.12 and later
LinkOffice support for macOS 10.14 Mojave
LinkTelemetry and diagnostics data description
LinkPreference keys for diagnostics data and telemetry


Office Product ReleaseLicense TypeOffice VersionBuildPart NumberDownload
Microsoft 365 Apps for MacSubscription16.80.016.80.23121017 64-bit Universal 2Subscription
Downloadhttps://go.microsoft.com/fwlink/?linkid=525133
Microsoft 365 Apps for Mac BusinessProSubscription16.80.016.80.23121017 64-bit Universal 2Subscription (inc Teams)
Downloadhttps://go.microsoft.com/fwlink/?linkid=2009112
Office LTSC 2021 Volume License SerializerPerpetual16.80.0VL Serializer 4.0 64-bit Universal 2X22-74226Download
Office 2019 Volume License SerializerPerpetual16.78.3VL Serializer 3.0 64-bit Universal 2X22-61752Download
Office 2021 Volume LicensePerpetual16.80.016.80.23121017 64-bit Universal 2X21-74715
Downloadhttps://go.microsoft.com/fwlink/?linkid=525133
Office 2021 Home & Student RetailPerpetual16.80.016.80.23121017 64-bit Universal 2X21-74729
Downloadhttps://go.microsoft.com/fwlink/?linkid=799520

|

[Microsoft Office]スタートアップを停止する

202411140306522_520x576
メッセージ
『ドキュメントにはマクロが含まれています。 このアプリケーションのマクロ言語サポートは使用できないよう設定されています。 VBA を必要とする機能は使用できません。 このドキュメントを読み取り専用で開きますか?』 メッセージ
『実行しようとしている機能には、マクロまたはマクロ言語のサポートを必要とするコンテンツが含まれています。ただし、ユーザーまたは管理者がこのアプリケーションをインストールしたときに、マクロまたはコントロールのサポートはインストールしないように設定されています。』 が
発生したとき用

AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003(* 
004Microsoft Officeのスタートアップを停止します
005*)
006#
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "AppKit"
011use scripting additions
012
013
014property refMe : a reference to current application
015
016###ターゲットディレクトリ
017set appFileManager to refMe's NSFileManager's defaultManager()
018set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
019set ocidLibraryDirPathURL to ocidURLsArray's firstObject()
020set ocidChkDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized") isDirectory:(true)
021###停止中ディレクトリ
022#日付取得
023set strDateNO to doGetDateNo("yyyyMMdd")
024#移動先定義
025set strDirPath to ("Group Containers/UBF8T346G9.Office/User Content.localized/Startup.Disable." & strDateNO) as text
026set ocidDistDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:(strDirPath) isDirectory:(true)
027###移動
028set appFileManager to refMe's NSFileManager's defaultManager()
029set listDone to (appFileManager's moveItemAtURL:(ocidChkDirPathURL) toURL:(ocidDistDirPathURL) |error| :(reference))
030if (item 1 of listDone) is true then
031  ##フォルダを作る
032  set ocidMakeDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Excel") isDirectory:(true)
033  set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
034  ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
035  set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidMakeDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
036  set ocidMakeDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Powerpoint") isDirectory:(true)
037  set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
038  ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
039  set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidMakeDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
040  set ocidMakeDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized/Word") isDirectory:(true)
041  set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
042  ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
043  set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidMakeDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
044else
045  return "移動に失敗しました"
046end if
047
048to doGetDateNo(strDateFormat)
049  ####日付情報の取得
050  set ocidDate to refMe's NSDate's |date|()
051  ###日付のフォーマットを定義
052  set ocidNSDateFormatter to refMe's NSDateFormatter's alloc()'s init()
053  ocidNSDateFormatter's setLocale:(refMe's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
054  ocidNSDateFormatter's setDateFormat:strDateFormat
055  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:(ocidDate)
056  set strDateAndTime to ocidDateAndTime as text
057  return strDateAndTime
058end doGetDateNo
AppleScriptで生成しました

|

[Microsoft Office]スタートアップクリーニング(修正)


AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003(* Microsoft Officeのスタートアップに残る
004ジャンクファイルを削除します
005*)
006#
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "AppKit"
011use scripting additions
012
013
014property refMe : a reference to current application
015
016###ターゲットディレクトリ
017set appFileManager to refMe's NSFileManager's defaultManager()
018set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
019set ocidLibraryDirPathURL to ocidURLsArray's firstObject()
020set ocidChkDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Group Containers/UBF8T346G9.Office/User Content.localized/Startup.localized") isDirectory:(true)
021####URLの収集
022set ocidPropertiesArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
023ocidPropertiesArray's addObject:(refMe's NSURLIsDirectoryKey)
024ocidPropertiesArray's addObject:(refMe's NSURLNameKey)
025ocidPropertiesArray's addObject:(refMe's NSURLPathKey)
026set ocidOption to (refMe's NSDirectoryEnumerationSkipsPackageDescendants)
027set ocidEmuDict to appFileManager's enumeratorAtURL:(ocidChkDirPathURL) includingPropertiesForKeys:(ocidPropertiesArray) options:(ocidOption) errorHandler:(reference)
028###収集したURL
029set ocidEmuFileURLArray to ocidEmuDict's allObjects()
030##収集したURLだけ繰り返し
031repeat with itemURL in ocidEmuFileURLArray
032  #ファイル名
033  set strFileName to itemURL's lastPathComponent() as text
034  #処理分岐
035  if strFileName contains "~" then
036    ##ゴミ箱に入れる
037    log doMoveToTrash(itemURL)
038  end if
039end repeat
040
041
042#########################################
043#ゴミ箱に入れるサブルーチン
044to doMoveToTrash(argFilePath)
045  ###ファイルマネジャー初期化
046  set appFileManager to refMe's NSFileManager's defaultManager()
047  ###渡された値のClassを調べてとりあえずNSURLにする
048  set refClass to class of argFilePath
049  if refClass is list then
050    return "エラーリストは処理しません"
051  else if refClass is text then
052    log "テキストパスです"
053    set ocidArgFilePathStr to (refMe's NSString's stringWithString:argFilePath)
054    set ocidArgFilePath to ocidArgFilePathStr's stringByStandardizingPath
055    set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
056  else if refClass is alias then
057    log "エイリアスパスです"
058    set strArgFilePath to (POSIX path of argFilePath) as text
059    set ocidArgFilePathStr to (refMe's NSString's stringWithString:strArgFilePath)
060    set ocidArgFilePath to ocidArgFilePathStr's stringByStandardizingPath
061    set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
062  else
063    set refClass to (className() of argFilePath) as text
064    if refClass contains "NSPathStore2" then
065      log "NSPathStore2です"
066      set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:argFilePath)
067    else if refClass contains "NSCFString" then
068      log "NSCFStringです"
069      set ocidArgFilePath to argFilePath's stringByStandardizingPath
070      set ocidArgFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidArgFilePath)
071    else if refClass contains "NSURL" then
072      set ocidArgFilePathURL to argFilePath
073      log "NSURLです"
074    end if
075  end if
076  ###
077  -->false
078  set ocidFalse to (refMe's NSNumber's numberWithBool:false)'s boolValue
079  -->true
080  set ocidTrue to (refMe's NSNumber's numberWithBool:true)'s boolValue
081  ###NSURLがエイリアス実在するか
082  set ocidArgFilePath to ocidArgFilePathURL's |path|()
083  set boolFileAlias to appFileManager's fileExistsAtPath:(ocidArgFilePath)
084  if boolFileAlias = false then
085    return false
086  end if
087  ###NSURLがディレクトリなのか?ファイルなのか?
088  set listBoolDir to ocidArgFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsDirectoryKey) |error| :(reference)
089  if (item 2 of listBoolDir) = ocidTrue then
090    log "ディレクトリです"
091    ##内包リスト
092    set listResult to appFileManager's contentsOfDirectoryAtURL:ocidArgFilePathURL includingPropertiesForKeys:{refMe's NSURLPathKey} options:0  |error| :(reference)
093    ###結果
094    set ocidContentsPathURLArray to item 1 of listResult
095    ###リストの数だけ繰り返し
096    repeat with itemContentsPathURL in ocidContentsPathURLArray
097      ###ゴミ箱に入れる
098      set listResult to (appFileManager's trashItemAtURL:itemContentsPathURL resultingItemURL:(missing value) |error| :(reference))
099    end repeat
100  else
101    log "ファイルです"
102    ###念のためFilderでも調べる
103    tell application "Finder"
104      set aliasArgFilePath to ocidArgFilePathURL as alias
105      set strPathKind to (kind of aliasArgFilePath) as text
106    end tell
107    ###/tmpのような特殊フォルダの場合は処理しない
108    if strPathKind is "フォルダ" then
109      return "特殊ディレクトリかシンボリックリンクなので処理しません"
110    else
111      ###ファイルをゴミ箱に入れる
112      set listResult to (appFileManager's trashItemAtURL:ocidArgFilePathURL resultingItemURL:(missing value) |error| :(reference))
113    end if
114  end if
115  return true
116end doMoveToTrash
AppleScriptで生成しました

|

その他のカテゴリー

Accessibility Acrobat Acrobat 2020 Acrobat AddOn Acrobat Annotation Acrobat ARMDC Acrobat AV2 Acrobat BookMark Acrobat Classic Acrobat DC Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat JS Acrobat Manifest Acrobat Menu Acrobat Open Acrobat Plugin Acrobat Preferences Acrobat Preflight Acrobat Python Acrobat Reader Acrobat Reader Localized Acrobat Reference Acrobat SCA Acrobat SCA Updater Acrobat Sequ Acrobat Sign Acrobat Stamps Acrobat Watermark Acrobat Windows Acrobat Windows Reader Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Mobileconfig Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin Support Admin System Information Admin Tools Admin Users Admin Volumes Admin XProtect Adobe Adobe Bridge Adobe FDKO Adobe Fonts Adobe Reference Adobe RemoteUpdateManager AppKit Apple AppleScript AppleScript do shell script AppleScript List AppleScript ObjC AppleScript Osax AppleScript PDF AppleScript Pictures AppleScript record AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript System Events AppleScript System Events Plist AppleScript Video Applications AppStore Archive Attributes Automator BackUp Barcode Barcode Decode Barcode QR Bash Basic Basic Path Bluetooth BOX Browser Calendar CD/DVD Choose Chrome CIImage CityCode CloudStorage Color com.apple.LaunchServices.OpenWith Console Contacts CotEditor CURL current application Date&Time defaults delimiters Desktop Device Diff Disk Dock DropBox Droplet eMail Encode % Encode Decode Encode HTML Entity Encode UTF8 Error EXIFData ffmpeg File File Name Finder Firefox Folder FolderAction Fonts Fonts ATS Fonts Python Foxit GIF github Guide HTML Icon Illustrator Image Events Image2PDF ImageOptim Input Dictionary iPhone iWork Javascript Jedit Json Label Language Leading Zero List locationd LRC lsappinfo m3u8 Mail MakePDF Map Math Media Media AVAsset Media AVconvert Media AVFoundation Media AVURLAsset Media Movie Media Music Memo Messages Microsoft Microsoft Edge Microsoft Excel Microsoft Fonts Microsoft Office Mouse Music NetWork Notes NSArray NSArray Sort NSBezierPath NSBitmapImageRep NSBundle NSCFBoolean NSCharacterSet NSColor NSColorList NSData NSDecimalNumber NSDictionary NSError NSEvent NSFileAttributes NSFileManager NSFileManager enumeratorAtURL NSFont NSFontManager NSGraphicsContext NSImage NSIndex NSKeyedArchiver NSKeyedUnarchiver NSLocale NSMetadataItem NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSRange NSRect NSRegularExpression NSRunningApplication NSScreen NSSize NSString NSString stringByApplyingTransform NSStringCompareOptions NSTask NSTimeZone NSURL NSURL File NSURLBookmark NSURLComponents NSURLResourceKey NSURLSession NSUserDefaults NSUUID NSView NSWorkspace Numbers OAuth OneDrive PDF PDF Pymupdf PDFAnnotation PDFAnnotationWidget PDFContext PDFDisplayBox PDFDocumentPermissions PDFImageRep PDFKit PDFnUP PDFOutline PDFView perl Photoshop PlistBuddy pluginkit plutil postalcode PostScript prefPane Preview Python QuickLook QuickTime ReadMe Regular Expression Reminders ReName Repeat RTF Safari SaveFile ScreenCapture ScreenSaver SF Symbols character id SF Symbols Entity sips Skype Slack Sound Spotlight sqlite SRT StandardAdditions Swift System Settings TCC TemporaryItems Terminal Text Text CSV Text MD Text TSV TextEdit Tools Translate Trash Twitter Typography UI Unit Conversion UTType valueForKeyPath Video VisionKit Visual Studio Code VMware Fusion Wacom webarchive webp Wifi Windows XML XML EPUB XML HTML XML LSSharedFileList XML OPML XML Plist XML RSS XML savedSearch XML SVG XML TTML XML webloc XML xmllint XML XMP YouTube zoom