Admin Mobileconfig

[AppleScript]com.apple.TCC.configuration-profile-policyの作成補助 v2

チェックしやすように
mobileconfigファイルとplistファイルを生成します
com.apple.TCC.configuration-profile-policyの作成補助.scpt

AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#  モバイルコンフィグのアプリケーションの署名部分CodeRequirementの
005# 値を取得します
006# configuration-profile-policy限定なのでMDM登録必須
007# com.cocolog-nifty.quicktimer.icefloe
008----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
009use framework "Foundation"
010use AppleScript version "2.4"
011use framework "Foundation"
012use framework "AppKit"
013use scripting additions
014property refMe : a reference to current application
015
016######
017#メインのアプリケーション選択
018set {strBundleID, strAppFilePath} to doGetBundleID()
019#メインアプリの署名コード
020set strCodesign to doGetCodesign(strAppFilePath)
021
022######
023#ダイアログ
024#サービス一覧リスト
025set listServices to {"Accessibility", "AddressBook", "AppleEvents", "BluetoothAlways", "Calendar", "Camera", "FileProviderPresence", "ListenEvent", "MediaLibrary", "Microphone", "Photos", "PostEvent", "Reminders", "ScreenCapture", "SpeechRecognition", "SystemPolicyAllFiles", "SystemPolicyAppBundles", "SystemPolicyAppData", "SystemPolicyDesktopFolder", "SystemPolicyDocumentsFolder", "SystemPolicyDownloadsFolder", "SystemPolicyNetworkVolumes", "SystemPolicyRemovableVolumes", "SystemPolicySysAdminFiles"} as list
026#ダイアログ前面に
027set strName to (name of current application) as text
028if strName is "osascript" then
029  tell application "SystemUIServer" to activate
030else
031  tell current application to activate
032end if
033set strTitle to ("選んでください") as text
034set strPrompt to ("ひとつ選んでください") as text
035try
036  tell application "SystemUIServer"
037    #Activateは必須
038    activate
039    set valueResponse to (choose from list listServices with title strTitle with prompt strPrompt default items (item 1 of listServices) OK button name "OK" cancel button name "キャンセル" with empty selection allowed and multiple selections allowed)
040  end tell
041on error
042  log "Error choose from list"
043  return false
044end try
045if (class of valueResponse) is boolean then
046  log "Error キャンセルしました"
047  return false
048else if (class of valueResponse) is list then
049  if valueResponse is {} then
050    log "Error 何も選んでいません"
051    return false
052  else
053    set listMakeService to valueResponse as list
054  end if
055end if
056#########
057#出力テキスト保存先
058set appFileManager to refMe's NSFileManager's defaultManager()
059set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDocumentDirectory) inDomains:(refMe's NSUserDomainMask))
060set ocidDocumentDirPathURL to ocidURLsArray's firstObject()
061set ocidSaveDirPathURL to ocidDocumentDirPathURL's URLByAppendingPathComponent:("Mobileconfig/Codesign") isDirectory:(true)
062#フォルダ作成
063set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s init()
064ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
065set ocidMakeDirPath to ocidSaveDirPathURL's |path|()
066set boolDirExists to appFileManager's fileExistsAtPath:(ocidMakeDirPath) isDirectory:(true)
067if boolDirExists is false then
068  set listDone to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error| :(reference)
069  if (item 1 of listDone) is false then
070    set strErrorNO to (item 2 of listDone)'s code() as text
071    set strErrorMes to (item 2 of listDone)'s localizedDescription() as text
072    refMe's NSLog("■:" & strErrorNO & strErrorMes)
073    log "createDirectoryAtURL エラーしました" & strErrorNO & strErrorMes
074    return false
075  end if
076end if
077
078##########################
079#Payload
080#初期化
081set ocidPayloadDict to refMe's NSMutableDictionary's alloc()'s init()
082#PayloadType
083set strTypeID to ("com.apple.TCC.configuration-profile-policy") as text
084ocidPayloadDict's setValue:(strTypeID) forKey:("PayloadType")
085#PayloadUUID
086set ocidUUID to refMe's NSUUID's alloc()'s init()
087set strUUID to ocidUUID's UUIDString() as text
088ocidPayloadDict's setValue:(strUUID) forKey:("PayloadUUID")
089#日付テキストの生成=バージョン番号に利用
090set strDateNo to doGetDateNo("yyyyMMdd") as text
091set numDateNo to strDateNo as integer
092ocidPayloadDict's setValue:(numDateNo) forKey:("PayloadVersion")
093#PayloadIdentifier
094set strSetValue to ("" & strTypeID & "." & strUUID & "") as text
095ocidPayloadDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
096#PayloadDescription
097ocidPayloadDict's setValue:("TCC: プライバシー設定 アクセス制御ので権限管理で有効(許可)を設定します") forKey:("PayloadDescription")
098#PayloadDisplayName
099
100#ServicesDICT
101set ocidServicesDict to refMe's NSMutableDictionary's alloc()'s init()
102
103
104#選んだサービスの数だけ繰り返し
105repeat with itemService in listMakeService
106  set strServiceName to itemService as text
107  #ServicesARRAY
108  set ocidServicesArray to refMe's NSMutableArray's alloc()'s init()
109  
110  #
111  #処理分岐
112  if strServiceName is "AppleEvents" then
113    #サブルーチンで処理
114    set {strReceiverBundleID, strAppFilePath} to doGetBundleID()
115    set strReceiverCodesign to doGetCodesign(strAppFilePath)
116    #
117    set ocidItemDict to refMe's NSMutableDictionary's alloc()'s init()
118    (ocidItemDict's setValue:("Allow") forKey:("Authorization"))
119    (ocidItemDict's setValue:(true) forKey:("StaticCode"))
120    (ocidItemDict's setValue:("bundleID") forKey:("IdentifierType"))
121    set strSetValue to ("Services:" & strServiceName & " BundleID: " & strBundleID & "") as text
122    (ocidItemDict's setValue:(strSetValue) forKey:("Comment"))
123    (ocidItemDict's setValue:(strCodesign) forKey:("CodeRequirement"))
124    (ocidItemDict's setValue:(strBundleID) forKey:("Identifier"))
125    #
126    (ocidItemDict's setValue:(strReceiverCodesign) forKey:("AEReceiverCodeRequirement"))
127    (ocidItemDict's setValue:(strReceiverBundleID) forKey:("AEReceiverIdentifier"))
128    (ocidItemDict's setValue:("bundleID") forKey:("AEReceiverIdentifierType"))
129    
130    
131  else if strServiceName is "ListenEvent" or itemService is "ScreenCapture" then
132    set ocidItemDict to refMe's NSMutableDictionary's alloc()'s init()
133    (ocidItemDict's setValue:("AllowStandardUserToSetSystemService") forKey:("Authorization"))
134    (ocidItemDict's setValue:(true) forKey:("StaticCode"))
135    (ocidItemDict's setValue:("bundleID") forKey:("IdentifierType"))
136    set strSetValue to ("Services:" & strServiceName & " BundleID: " & strBundleID & "") as text
137    (ocidItemDict's setValue:(strSetValue) forKey:("Comment"))
138    (ocidItemDict's setValue:(strCodesign) forKey:("CodeRequirement"))
139    (ocidItemDict's setValue:(strBundleID) forKey:("Identifier"))
140  else
141    set ocidItemDict to refMe's NSMutableDictionary's alloc()'s init()
142    (ocidItemDict's setValue:("Allow") forKey:("Authorization"))
143    (ocidItemDict's setValue:(true) forKey:("StaticCode"))
144    (ocidItemDict's setValue:("bundleID") forKey:("IdentifierType"))
145    set strSetValue to ("Services:" & strServiceName & " BundleID: " & strBundleID & "") as text
146    (ocidItemDict's setValue:(strSetValue) forKey:("Comment"))
147    (ocidItemDict's setValue:(strCodesign) forKey:("CodeRequirement"))
148    (ocidItemDict's setValue:(strBundleID) forKey:("Identifier"))
149  end if
150  
151  (ocidServicesArray's addObject:(ocidItemDict))
152  (ocidServicesDict's setObject:(ocidServicesArray) forKey:(strServiceName))
153  
154end repeat
155#
156(ocidPayloadDict's setObject:(ocidServicesDict) forKey:("Services"))
157
158
159set ocidSetPayloadArray to refMe's NSMutableArray's alloc()'s init()
160ocidSetPayloadArray's addObject:(ocidPayloadDict)
161
162##########################
163#PayloadContent部分
164#初期化
165set ocidPayloadContentDict to refMe's NSMutableDictionary's alloc()'s init()
166#PayloadOrganization
167set strDomainName to ("com.cocolog-nifty.quicktimer") as text
168ocidPayloadContentDict's setValue:(strDomainName) forKey:("PayloadOrganization")
169#PayloadUUID
170set ocidUUID to refMe's NSUUID's alloc()'s init()
171set ocidUUID to ocidUUID's UUIDString()
172ocidPayloadContentDict's setValue:(ocidUUID) forKey:("PayloadUUID")
173#PayloadIdentifier
174set strSetValue to (strDomainName & "." & ocidUUID) as text
175ocidPayloadContentDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
176#日付テキストの生成=バージョン番号に利用
177set strDateNo to doGetDateNo("yyyyMMdd") as text
178set numDateNo to strDateNo as integer
179ocidPayloadContentDict's setValue:(numDateNo) forKey:("PayloadVersion")
180#TargetDeviceType
181ocidPayloadContentDict's setValue:(5) forKey:("TargetDeviceType")
182#PayloadType
183ocidPayloadContentDict's setValue:("Configuration") forKey:("PayloadType")
184#PayloadScope
185ocidPayloadContentDict's setValue:("System") forKey:("PayloadScope")
186#PayloadDescription
187ocidPayloadContentDict's setValue:("TCC: プライバシー設定 アクセス制御ので権限管理で有効(許可)を設定します") forKey:("PayloadDescription")
188#PayloadDisplayName
189set strSetValue to ("TCC." & strBundleID & "") as text
190ocidPayloadContentDict's setValue:(strSetValue) forKey:("PayloadDisplayName")
191#ConsentText
192set ocidContentText to refMe's NSMutableDictionary's alloc()'s init()
193ocidContentText's setValue:("TCC プライバシー設定 アクセス制御ので権限管理で有効(許可)を設定します") forKey:("default")
194ocidPayloadContentDict's setObject:(ocidContentText) forKey:("ConsentText")
195#
196ocidPayloadContentDict's setObject:(ocidSetPayloadArray) forKey:("PayloadContent")
197
198#
199
200set ocidFormat to (refMe's NSPropertyListXMLFormat_v1_0)
201set listResponse to refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidPayloadContentDict) format:(ocidFormat) options:0  |error| :(reference)
202if (item 2 of listResponse) = (missing value) then
203  set ocidPlistData to (item 1 of listResponse)
204else if (item 2 of listResponse) (missing value) then
205  set strErrorNO to (item 2 of listResponse)'s code() as text
206  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
207  current application's NSLog("■:" & strErrorNO & strErrorMes)
208  return "エラーしました" & strErrorNO & strErrorMes
209end if
210
211
212#拡張子はお好みで
213set strSaveFileName to ("" & strBundleID & "." & itemService & ".xml") as text
214set strSaveFileName to ("" & strBundleID & "." & itemService & ".plist") as text
215
216#保存先
217set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName) isDirectory:(false))
218#保存
219set ocidOption to (current application's NSDataWritingAtomic)
220set listDone to ocidPlistData's writeToURL:(ocidSaveFilePathURL) options:(ocidOption) |error| :(reference)
221if (item 1 of listDone) is true then
222  log "正常終了"
223else if (item 1 of listDone) is false then
224  set strErrorNO to (item 2 of listResponse)'s code() as text
225  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
226  current application's NSLog("■:" & strErrorNO & strErrorMes)
227  return "エラーしました" & strErrorNO & strErrorMes
228end if
229
230
231set strSaveFileName to ("" & strBundleID & "." & itemService & ".mobileconfig") as text
232set ocidMobileconfigFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName) isDirectory:(false))
233
234#
235set listDone to (appFileManager's trashItemAtURL:(ocidMobileconfigFilePathURL) resultingItemURL:(ocidMobileconfigFilePathURL) |error| :(reference))
236#
237set listDone to (appFileManager's copyItemAtURL:(ocidSaveFilePathURL) toURL:(ocidMobileconfigFilePathURL) |error| :(reference))
238if (item 1 of listDone) is true then
239  log "正常終了"
240else if (item 1 of listDone) is false then
241  set strErrorNO to (item 2 of listDone)'s code() as text
242  set strErrorMes to (item 2 of listDone)'s localizedDescription() as text
243  current application's NSLog("■:" & strErrorNO & strErrorMes)
244  return "エラーしました" & strErrorNO & strErrorMes
245end if
246
247
248
249#保存先を開く
250set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
251set boolDone to appSharedWorkspace's openURL:(ocidSaveDirPathURL)
252
253
254return
255##########################
256# コード署名の取得
257to doGetCodesign(argAppFilePath)
258  
259  set strCommandText to ("/usr/bin/codesign -dr - \"" & argAppFilePath & "\"") as text
260  set {boolDone, strResnponse} to doZshShellScript(strCommandText)
261  #署名を必要な部分のみにしておく
262  set ocidResnponse to refMe's NSString's stringWithString:(strResnponse)
263  set ocidResnponse to (ocidResnponse's stringByReplacingOccurrencesOfString:("designated => ") withString:(""))
264  set ocidResnponse to (ocidResnponse's stringByReplacingOccurrencesOfString:(")") withString:(""))
265  set ocidResnponse to (ocidResnponse's stringByReplacingOccurrencesOfString:("(") withString:(""))
266  set strCodesign to ocidResnponse as text
267  log strCodesign as text
268  
269  return strCodesign
270end doGetCodesign
271
272##########################
273# バンドルID
274to doGetBundleID()
275  
276  #ダイアログ前面に
277  set strName to (name of current application) as text
278  if strName is "osascript" then
279    tell application "SystemUIServer" to activate
280  else
281    tell current application to activate
282  end if
283  #デフォルト
284  set aliasApplicationDir to (path to applications folder from local domain) as alias
285  #ダイアログ呼び出し
286  tell application "SystemUIServer"
287    activate
288    set aliasAppFilePath to (choose file with prompt "アプリケーションを選んでください" default location aliasApplicationDir of type {"com.apple.application-bundle"} with invisibles without showing package contents and multiple selections allowed) as alias
289  end tell
290  #アプリケーションのパス
291  set strAppFilePath to (POSIX path of aliasAppFilePath) as text
292  set ocidAppFilePathStr to refMe's NSString's stringWithString:(strAppFilePath)
293  set ocidAppFilePath to ocidAppFilePathStr's stringByStandardizingPath()
294  set ocidAppFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAppFilePath) isDirectory:(false)
295  #アプリケーションからバンドルID
296  set ocidBundle to refMe's NSBundle's bundleWithURL:(ocidAppFilePathURL)
297  set ocidBundleID to ocidBundle's bundleIdentifier()
298  set strBundleID to (ocidBundleID's lowercaseString()) as string
299  log strBundleID as text
300  return {strBundleID, strAppFilePath}
301end doGetBundleID
302
303
304##########################
305# 【N】ZSH 実行
306to doZshShellScript(argCommandText)
307  set strCommandText to argCommandText as text
308  log "コマンド開始\r" & strCommandText & "\r"
309  set strExec to ("/bin/zsh -c '" & strCommandText & "'") as text
310  ##########
311  #コマンド実行
312  try
313    set strResnponse to (do shell script strExec) as text
314    log "コマンド終了"
315  on error
316    return {false, strResnponse}
317  end try
318  return {true, strResnponse}
319end doZshShellScript
320
321##########################
322# 日付テキスト
323to doGetDateNo(strDateFormat)
324  ####日付情報の取得
325  set ocidDate to current application's NSDate's |date|()
326  ###日付のフォーマットを定義
327  set ocidNSDateFormatter to current application's NSDateFormatter's alloc()'s init()
328  ocidNSDateFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
329  ocidNSDateFormatter's setDateFormat:strDateFormat
330  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
331  set strDateAndTime to ocidDateAndTime as text
332  return strDateAndTime
333end doGetDateNo
334
335
336
337
338
AppleScriptで生成しました

|

[Dock]現在のDockのplist(com.apple.dock.plist)の内容をそのままmobileconfigにする

他の設定でも工夫すれば使えるかなDoc2Mobileconfig.scpt

AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#com.cocolog-nifty.quicktimer.icefloe
004# 現在のDockの設定をMobileconfigにします
005# アプリケーションのパス部分のユーザーIDだけは変更が必要か
006# BOOK エイリアスデータはBASE64になるのでエディタで編集する場合は
007# 削除したほうがいい Bookは削除してもDockに登録できます
008----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
009use AppleScript version "2.8"
010use framework "Foundation"
011use framework "AppKit"
012use framework "UniformTypeIdentifiers"
013use scripting additions
014property refMe : a reference to current application
015set appFileManager to refMe's NSFileManager's defaultManager()
016#########################
017#設定項目
018set strSiteDomainName to ("com.cocolog-nifty.quicktimer") as text
019
020#########################
021#
022set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
023set ocidLibraryDirPathURL to ocidURLsArray's firstObject()
024set ocidPlistFilePathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Preferences/com.apple.dock.plist") isDirectory:(false)
025#########################
026#バックアップ
027set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDocumentDirectory) inDomains:(refMe's NSUserDomainMask))
028set ocidDocumentDirPathURL to ocidURLsArray's firstObject()
029#日付
030set strDateNo to doGetDateNo("yyyyMMdd") as text
031set numDateNo to strDateNo as integer
032#保存先
033set strSaveDirName to ("Apple/Dock/Preferences/" & strDateNo & "") as text
034set ocidSaveDirPathURL to ocidDocumentDirPathURL's URLByAppendingPathComponent:(strSaveDirName) isDirectory:(true)
035set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s init()
036ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
037set ocidMakeDirPath to ocidSaveDirPathURL's |path|()
038set boolDirExists to appFileManager's fileExistsAtPath:(ocidMakeDirPath) isDirectory:(true)
039if boolDirExists is false then
040  set listDone to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error| :(reference)
041  if (item 1 of listDone) is false then
042    set strErrorNO to (item 2 of listDone)'s code() as text
043    set strErrorMes to (item 2 of listDone)'s localizedDescription() as text
044    refMe's NSLog("■:" & strErrorNO & strErrorMes)
045    log "createDirectoryAtURL エラーしました" & strErrorNO & strErrorMes
046    return false
047  end if
048end if
049#コピー
050set ocidDistFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:("com.apple.dock.plist") isDirectory:(false)
051set listDone to (appFileManager's copyItemAtURL:(ocidPlistFilePathURL) toURL:(ocidDistFilePathURL) |error| :(reference))
052
053
054#########################
055#PLIST読み込み開始
056set listResponse to refMe's NSDictionary's alloc()'s initWithContentsOfURL:(ocidPlistFilePathURL) |error| :(reference)
057if (item 2 of listResponse) = (missing value) then
058  set ocidPlistDict to (item 1 of listResponse)
059else if (item 2 of listResponse) (missing value) then
060  set strErrorNO to (item 2 of listResponse)'s code() as text
061  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
062  refMe's NSLog("■:" & strErrorNO & strErrorMes)
063  return "エラーしました" & strErrorNO & strErrorMes
064end if
065
066
067set ocidPersistentOthersArray to ocidPlistDict's objectForKey:("persistent-others")
068set ocidPersistentAppsArray to ocidPlistDict's objectForKey:("persistent-apps")
069set ocidStaticAppsArray to ocidPlistDict's objectForKey:("static-apps")
070set ocidStaticOthersArray to ocidPlistDict's objectForKey:("static-others")
071###
072if ocidPersistentOthersArray = (missing value) then
073  set ocidPersistentOthersArray to refMe's NSMutableArray's alloc()'s init()
074end if
075if ocidPersistentAppsArray = (missing value) then
076  set ocidPersistentAppsArray to refMe's NSMutableArray's alloc()'s init()
077end if
078if ocidStaticAppsArray = (missing value) then
079  set ocidStaticAppsArray to refMe's NSMutableArray's alloc()'s init()
080end if
081if ocidStaticOthersArray = (missing value) then
082  set ocidStaticOthersArray to refMe's NSMutableArray's alloc()'s init()
083end if
084# log ocidPlistDict's allKeys() as list
085
086#########################
087#mobileconfigの基本部分
088set ocidMobileconfigDict to refMe's NSMutableDictionary's alloc()'s init()
089#各種ROOT項目
090ocidMobileconfigDict's setValue:(5) forKey:("TargetDeviceType")
091ocidMobileconfigDict's setValue:(numDateNo) forKey:("PayloadVersion")
092set ocidUUID to refMe's NSUUID's alloc()'s init()
093set ocidUUIDString to ocidUUID's UUIDString()
094ocidMobileconfigDict's setValue:(ocidUUIDString) forKey:("PayloadUUID")
095ocidMobileconfigDict's setValue:("Configuration") forKey:("PayloadType")
096ocidMobileconfigDict's setValue:("User") forKey:("PayloadScope")
097ocidMobileconfigDict's setValue:(strSiteDomainName) forKey:("PayloadOrganization")
098set strSetValue to ("" & strSiteDomainName & "." & ocidUUIDString & "") as text
099ocidMobileconfigDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
100ocidMobileconfigDict's setValue:("com.apple.dock") forKey:("PayloadDisplayName")
101ocidMobileconfigDict's setValue:("com.apple.dock") forKey:("PayloadDescription")
102ocidMobileconfigDict's setValue:(false) forKey:("PayloadRemovalDisallowed")
103ocidMobileconfigDict's setValue:(false) forKey:("HasRemovalPasscode")
104#########################
105#追加用のArray
106set ocidContentArray to refMe's NSMutableArray's alloc()'s init()
107#########################
108#PayloadContentのROOT
109set ocidPayloadDict to refMe's NSMutableDictionary's alloc()'s init()
110ocidPayloadDict's setValue:(numDateNo) forKey:("PayloadVersion")
111ocidPayloadDict's setValue:("com.apple.dock") forKey:("PayloadType")
112ocidPayloadDict's setValue:("com.apple.dock.payload") forKey:("PayloadDisplayName")
113ocidPayloadDict's setValue:("com.apple.dock.payload") forKey:("PayloadDescription")
114set ocidUUID to refMe's NSUUID's alloc()'s init()
115set ocidUUIDString to ocidUUID's UUIDString()
116set strSetValue to ("com.apple.dock.payload." & ocidUUIDString & "") as text
117ocidPayloadDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
118ocidPayloadDict's setValue:(ocidUUIDString) forKey:("PayloadUUID")
119
120
121set listKey to {"AllowDockFixupOverride", "autohide", "autohide-immutable", "contents-immutable", "dblclickbehavior", "dblclickbehavior-immutable", "enterMissionControlByTopWindowDrag", "expose-group-apps", "largesize", "launchanim", "launchanim-immutable", "loc", "magnification", "magnify-immutable", "mineffect", "mineffect-immutable", "minimize-to-application", "minintoapp-immutable", "mouse-over-hilite-stack", "mru-spaces", "orientation", "position-immutable", "region", "show-process-indicators", "show-recent-count", "show-recents", "showDesktopGestureEnabled", "showhidden", "showindicators-immutable", "showLaunchpadGestureEnabled", "showMissionControlGestureEnabled", "showrecents-immutable", "size-immutable", "springboard-columns", "springboard-rows", "static-only", "tilesize", "windowtabbing", "windowtabbing-immutable", "wvous-bl-corner", "wvous-bl-modifier", "wvous-br-corner", "wvous-br-modifier", "wvous-tl-corner", "wvous-tl-modifier", "wvous-tr-corner", "wvous-tr-modifier"} as list
122
123repeat with itemKey in listKey
124  set ocidGetValue to (missing value)
125  set ocidGetValue to (ocidPlistDict's valueForKey:(itemKey))
126  (ocidPayloadDict's setValue:(ocidGetValue) forKey:(itemKey))
127end repeat
128
129
130ocidContentArray's addObject:(ocidPayloadDict)
131#########################
132#com.apple.dock.static-apps
133set ocidStaticAppsDict to refMe's NSMutableDictionary's alloc()'s init()
134ocidStaticAppsDict's setValue:(numDateNo) forKey:("PayloadVersion")
135ocidStaticAppsDict's setValue:("com.apple.dock") forKey:("PayloadType")
136ocidStaticAppsDict's setValue:("com.apple.dock.static-apps") forKey:("PayloadDisplayName")
137ocidStaticAppsDict's setValue:("com.apple.dock.static-apps") forKey:("PayloadDescription")
138set ocidUUID to refMe's NSUUID's alloc()'s init()
139set ocidUUIDString to ocidUUID's UUIDString()
140set strSetValue to ("com.apple.dock.static-apps." & ocidUUIDString & "") as text
141ocidStaticAppsDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
142ocidStaticAppsDict's setValue:(ocidUUIDString) forKey:("PayloadUUID")
143#
144ocidStaticAppsDict's setObject:(ocidStaticOthersArray) forKey:("static-apps")
145ocidContentArray's addObject:(ocidStaticAppsDict)
146
147
148#########################
149#com.apple.dock.static-others
150set ocidStaticOthersDict to refMe's NSMutableDictionary's alloc()'s init()
151ocidStaticOthersDict's setValue:(numDateNo) forKey:("PayloadVersion")
152ocidStaticOthersDict's setValue:("com.apple.dock") forKey:("PayloadType")
153ocidStaticOthersDict's setValue:("com.apple.dock.static-others") forKey:("PayloadDisplayName")
154ocidStaticOthersDict's setValue:("com.apple.dock.static-others") forKey:("PayloadDescription")
155set ocidUUID to refMe's NSUUID's alloc()'s init()
156set ocidUUIDString to ocidUUID's UUIDString()
157set strSetValue to ("com.apple.dock.static-others." & ocidUUIDString & "") as text
158ocidStaticOthersDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
159ocidStaticOthersDict's setValue:(ocidUUIDString) forKey:("PayloadUUID")
160#
161ocidStaticOthersDict's setObject:(ocidStaticOthersArray) forKey:("static-others")
162ocidContentArray's addObject:(ocidStaticOthersDict)
163
164
165#########################
166#com.apple.dock.persistent-apps
167set ocidPersistentAppsDict to refMe's NSMutableDictionary's alloc()'s init()
168ocidPersistentAppsDict's setValue:(numDateNo) forKey:("PayloadVersion")
169ocidPersistentAppsDict's setValue:("com.apple.dock") forKey:("PayloadType")
170ocidPersistentAppsDict's setValue:("com.apple.dock.persistent-apps") forKey:("PayloadDisplayName")
171ocidPersistentAppsDict's setValue:("com.apple.dock.persistent-apps") forKey:("PayloadDescription")
172set ocidUUID to refMe's NSUUID's alloc()'s init()
173set ocidUUIDString to ocidUUID's UUIDString()
174set strSetValue to ("com.apple.dock.persistent-apps." & ocidUUIDString & "") as text
175ocidPersistentAppsDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
176ocidPersistentAppsDict's setValue:(ocidUUIDString) forKey:("PayloadUUID")
177#
178ocidPersistentAppsDict's setObject:(ocidPersistentAppsArray) forKey:("persistent-apps")
179ocidContentArray's addObject:(ocidPersistentAppsDict)
180
181#########################
182#com.apple.dock.persistent-others
183set ocidPersistentOthersDict to refMe's NSMutableDictionary's alloc()'s init()
184ocidPersistentOthersDict's setValue:(numDateNo) forKey:("PayloadVersion")
185ocidPersistentOthersDict's setValue:("com.apple.dock") forKey:("PayloadType")
186ocidPersistentOthersDict's setValue:("com.apple.dock.persistent-others") forKey:("PayloadDisplayName")
187ocidPersistentOthersDict's setValue:("com.apple.dock.persistent-others") forKey:("PayloadDescription")
188set ocidUUID to refMe's NSUUID's alloc()'s init()
189set ocidUUIDString to ocidUUID's UUIDString()
190set strSetValue to ("com.apple.dock.static-others." & ocidUUIDString & "") as text
191ocidPersistentOthersDict's setValue:(strSetValue) forKey:("PayloadIdentifier")
192ocidPersistentOthersDict's setValue:(ocidUUIDString) forKey:("PayloadUUID")
193#
194set ocidSpecialFoldersArray to refMe's NSMutableArray's alloc()'s init()
195ocidSpecialFoldersArray's addObject:("AddDockMCXSharedFolder")
196ocidSpecialFoldersArray's addObject:("AddDockMCXMyApplicationsFolder")
197ocidSpecialFoldersArray's addObject:("AddDockMCXOriginalNetworkHomeFolder")
198ocidSpecialFoldersArray's addObject:("AddDockMCXDocumentsFolder")
199ocidPersistentOthersDict's setObject:(ocidSpecialFoldersArray) forKey:("MCXDockSpecialFolders")
200#
201ocidPersistentOthersDict's setObject:(ocidPersistentOthersArray) forKey:("persistent-others")
202ocidContentArray's addObject:(ocidPersistentOthersDict)
203#########################
204#PayloadContentを追加
205ocidMobileconfigDict's setObject:(ocidContentArray) forKey:("PayloadContent")
206#########################
207#保存先
208set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
209set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
210set strSaveFileName to ("com.apple.dock." & strDateNo & ".mobileconfig") as text
211set ocidSaveFilePathURL to ocidDesktopDirPathURL's URLByAppendingPathComponent:(strSaveFileName) isDirectory:(false)
212#########################
213#plistイニシャライズ
214set ocidSaveFormat to (refMe's NSPropertyListXMLFormat_v1_0)
215set ocidOption to refMe's NSPropertyListMutableContainersAndLeaves
216set listResponse to (refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidMobileconfigDict) format:(ocidSaveFormat) options:(0) |error| :(reference))
217set ocidSaveData to (item 1 of listResponse)
218#NSDATAで保存
219set ocidOption to (refMe's NSDataWritingAtomic)
220set listDone to (ocidSaveData's writeToURL:(ocidSaveFilePathURL) options:(ocidOption) |error| :(reference))
221
222#########################
223#日付取得
224to doGetDateNo(strDateFormat)
225  ####日付情報の取得
226  set ocidDate to current application's NSDate's |date|()
227  ###日付のフォーマットを定義
228  set ocidNSDateFormatter to current application's NSDateFormatter's alloc()'s init()
229  ocidNSDateFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
230  ocidNSDateFormatter's setDateFormat:strDateFormat
231  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
232  set strDateAndTime to ocidDateAndTime as text
233  return strDateAndTime
234end doGetDateNo
AppleScriptで生成しました

|

【メモ】MDMでイマイチまだ理解が足りない部分

こちらの記事
Disabling Apple Mail website link previews compose option on macOS Sequoia: LINK
だと
PayloadTypeが

サンプルコード

サンプルソース(参考)
行番号ソース
001<key>PayloadType</key>
002<string>com.apple.ManagedClient.preferences</string>
AppleScriptで生成しました

com.apple.ManagedClient.preferences
になっているが これが

サンプルコード

サンプルソース(参考)
行番号ソース
001<key>PayloadType</key>
002<string>com.apple.mail</string>
003<key>AddLinkPreviews</key>
004<false />
AppleScriptで生成しました

でも機能する
どっちが正解なんだろう

|

[mobileconfig]言語設定の変更(非推奨)



ダウンロード - chooselang.zip



クラッシックスタイルな記述でも記述してみた
AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#com.cocolog-nifty.quicktimer.icefloe
005#
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007use AppleScript version "2.8"
008use scripting additions
009
010
011set strBundleID to ("com.apple.systempreferences") as text
012
013##CALL NEW systempreferences
014tell application id "com.apple.systempreferences"
015  activate
016  set miniaturized of the settings window to false
017end tell
018tell application id "com.apple.finder"
019  try
020    open location "x-apple.systempreferences:com.apple.Profiles-Settings.extension?Main"
021  end try
022end tell
023tell application id "com.apple.systempreferences"
024  try
025    reveal anchor "Main" of pane id "com.apple.Profiles-Settings.extension"
026  end try
027end tell
028
029#path to mobileconfig
030set aliasPathToMe to (path to me) as alias
031tell application "Finder"
032  set aliasConteinerDirPath to (container of aliasPathToMe) as alias
033  set aliasPlistPath to (file "Lang_ja-JP.mobileconfig" of folder "plist" of folder aliasConteinerDirPath) as alias
034end tell
035
036tell application "Finder"
037  open file aliasPlistPath
038end tell
039
040
041#After system event
042delay 1
043tell application "System Settings"
044  tell front window
045    set bounds to {0, 25, 720, 620}
046  end tell
047end tell
048tell application "System Events"
049  keystroke return
050end tell
AppleScriptで生成しました

|

mobileconfigを使って言語設定を切り替える



ダウンロード - changelang.zip




AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004# com.cocolog-nifty.quicktimer.icefloe
005----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
006use AppleScript version "2.8"
007use framework "Foundation"
008use framework "AppKit"
009use framework "UniformTypeIdentifiers"
010use scripting additions
011
012property refMe : a reference to current application
013
014
015set strBundleID to ("com.apple.systempreferences") as text
016
017##システム設定を終了
018tell application id strBundleID to quit
019delay 1
020set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
021set ocidAppBundle to (refMe's NSBundle's bundleWithIdentifier:(strBundleID))
022if ocidAppBundle ≠ (missing value) then
023  set ocidAppPathURL to ocidAppBundle's bundleURL()
024else if ocidAppBundle = (missing value) then
025  set ocidAppPathURL to (appSharedWorkspace's URLForApplicationWithBundleIdentifier:(strBundleID))
026end if
027appSharedWorkspace's openURL:(ocidAppPathURL)
028
029tell application id "com.apple.systempreferences"
030  activate
031  set miniaturized of the settings window to false
032end tell
033tell application id "com.apple.finder"
034  try
035    open location "x-apple.systempreferences:com.apple.Profiles-Settings.extension?Main"
036  end try
037end tell
038tell application id "com.apple.systempreferences"
039  try
040    reveal anchor "Main" of pane id "com.apple.Profiles-Settings.extension"
041  end try
042end tell
043
044
045#ダイアログ
046set strName to (name of current application) as text
047if strName is "osascript" then
048  tell application "Finder" to activate
049else
050  tell current application to activate
051end if
052set listChooser to {"it-IT", "en-US", "ja-JP"} as list
053set strTitle to ("選んでください\rPlease choose\rSi prega di scegliere") as text
054set strPrompt to ("選んでください\rPlease choose\rSi prega di scegliere") as text
055try
056  set objResponse to (choose from list listChooser with title strTitle with prompt strPrompt default items (item 1 of listChooser) OK button name "OK" cancel button name "キャンセル" with empty selection allowed without multiple selections allowed)
057on error
058  log "エラーしました"
059  return "エラーしました"
060end try
061log class of objResponse
062if (class of objResponse) is boolean then
063  return "キャンセルしましたA"
064else if (class of objResponse) is list then
065  if objResponse is {} then
066    return "キャンセルしましたB"
067  else
068    set strResponse to (item 1 of objResponse) as text
069    set strPlistFileName to ("Add_" & strResponse & ".mobileconfig") as text
070  end if
071end if
072
073#モバイルコンフィグへのパス
074set aliasPathToMe to (path to me) as alias
075set strPathToMe to (POSIX path of aliasPathToMe) as text
076set ocidPathToMeStr to refMe's NSString's stringWithString:(strPathToMe)
077set ocidPathToMe to ocidPathToMeStr's stringByStandardizingPath()
078set ocidPathToMeURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidPathToMe) isDirectory:(false)
079set ocidPathToMeContainerDirPathURL to ocidPathToMeURL's URLByDeletingLastPathComponent()
080set strSetPath to ("plist/" & strPlistFileName) as text
081set ocidPlistFilePathURL to ocidPathToMeContainerDirPathURL's URLByAppendingPathComponent:(strSetPath) isDirectory:(false)
082#パネルへのパス
083set ocidURLComponents to refMe's NSURLComponents's alloc()'s init()
084ocidURLComponents's setScheme:("x-apple.systempreferences")
085ocidURLComponents's setPath:("com.apple.Profiles-Settings.extension")
086ocidURLComponents's setQuery:("Main")
087set ocidPaneFilePathURL to ocidURLComponents's |URL|
088#開く
089appSharedWorkspace's openURL:(ocidPaneFilePathURL)
090appSharedWorkspace's openURL:(ocidPlistFilePathURL)
091
AppleScriptで生成しました

|

[The Unarchiver] mobileconfigの値を見直した

Windowsからのファイルをもらうことが多いので
filenameEncodingの値を8で使用してきたが
Windows11相手だと0でも問題ない

サンプルコード

サンプルソース(参考)
行番号ソース
001<?xml version="1.0" encoding="UTF-8"?>
002<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
003<plist version="1.0">
004  <dict>
005    <key>ConsentText</key>
006    <dict>
007      <key>default</key>
008      <string>
009com.macpaw.site.theunarchiver 初期設定 (サイトからダウンロード)
010cx.c3.theunarchiver The Unarchiver (Mac App Store)
011解凍の設定のみです
012削除したり、使用しなくても問題ありません
013</string>
014    </dict>
015    <key>PayloadContent</key>
016    <array>
017      <dict>
018        <key>PayloadDisplayName</key>
019        <string>The Unarchiver (Mac App Store)</string>
020        <key>PayloadIdentifier</key>
021        <string>cx.c3.theunarchiver.82BD423C-92C5-4B1E-A4EE-BBB408A5EB93</string>
022        <key>PayloadType</key>
023        <string>cx.c3.theunarchiver</string>
024        <key>PayloadUUID</key>
025        <string>82BD423C-92C5-4B1E-A4EE-BBB408A5EB93</string>
026        <key>PayloadVersion</key>
027        <integer>20231029</integer>
028        <key>OnboardingUserViewedWelcomeSlide</key>
029        <true />
030        <key>SUEnableAutomaticChecks</key>
031        <false />
032        <key>AnalyticsEnabled</key>
033        <false />
034        <key>autoupdatesEnabled</key>
035        <false />
036        <key>AdditionalAnalyticsEnabled</key>
037        <false />
038        <key>TUConfigInformationBannerOpened</key>
039        <true />
040        <key>TUConfigInformationBannerViewedCount</key>
041        <integer>0</integer>
042        <key>createFolder</key>
043        <integer>2</integer>
044        <key>deleteExtractedArchive</key>
045        <true />
046        <key>extractionDestination</key>
047        <integer>1</integer>
048        <key>filenameEncoding</key>
049        <integer>0</integer>
050        <key>autoDetectionThreshold</key>
051        <integer>85</integer>
052        <key>folderModifiedDate</key>
053        <integer>2</integer>
054        <key>isFreshInstall</key>
055        <true />
056        <key>openExtractedFolder</key>
057        <true />
058        <key>userAgreedToNewTOSAndPrivacy</key>
059        <true />
060      </dict>
061      <dict>
062        <key>PayloadDisplayName</key>
063        <string>The Unarchiver (Standalone)</string>
064        <key>PayloadIdentifier</key>
065        <string>com.macpaw.site.theunarchiver.D1E58FFE-285B-407D-A126-AE0651377D22</string>
066        <key>PayloadType</key>
067        <string>com.macpaw.site.theunarchiver</string>
068        <key>PayloadUUID</key>
069        <string>D1E58FFE-285B-407D-A126-AE0651377D22</string>
070        <key>PayloadVersion</key>
071        <integer>20231029</integer>
072        <key>OnboardingUserViewedWelcomeSlide</key>
073        <true />
074        <key>SUEnableAutomaticChecks</key>
075        <false />
076        <key>AnalyticsEnabled</key>
077        <false />
078        <key>autoupdatesEnabled</key>
079        <false />
080        <key>AdditionalAnalyticsEnabled</key>
081        <false />
082        <key>TUConfigInformationBannerOpened</key>
083        <true />
084        <key>TUConfigInformationBannerViewedCount</key>
085        <integer>0</integer>
086        <key>createFolder</key>
087        <integer>2</integer>
088        <key>deleteExtractedArchive</key>
089        <true />
090        <key>extractionDestination</key>
091        <integer>1</integer>
092        <key>filenameEncoding</key>
093        <integer>0</integer>
094        <key>autoDetectionThreshold</key>
095        <integer>85</integer>
096        <key>folderModifiedDate</key>
097        <integer>2</integer>
098        <key>isFreshInstall</key>
099        <true />
100        <key>openExtractedFolder</key>
101        <true />
102        <key>userAgreedToNewTOSAndPrivacy</key>
103        <true />
104      </dict>
105    </array>
106    <key>PayloadDescription</key>
107    <string>com.macpaw.site.theunarchiver</string>
108    <key>PayloadDisplayName</key>
109    <string>cx.c3.theunarchiver</string>
110    <key>PayloadIdentifier</key>
111    <string>cx.c3.theunarchiver.96F3E50D-BE59-49B7-930D-56CFF59FF016</string>
112    <key>PayloadOrganization</key>
113    <string>com.cocolog-nifty.quicktimer</string>
114    <key>PayloadScope</key>
115    <string>User</string>
116    <key>PayloadType</key>
117    <string>Configuration</string>
118    <key>PayloadUUID</key>
119    <string>96F3E50D-BE59-49B7-930D-56CFF59FF016</string>
120    <key>PayloadVersion</key>
121    <integer>20231029</integer>
122    <key>TargetDeviceType</key>
123    <integer>5</integer>
124  </dict>
125</plist>
AppleScriptで生成しました

|

[NSGlobalDomain_m]AppleLanguages

いつのまにか廃止になった値があるようだ 202411270250381_1064x758
サンプルコード

サンプルソース(参考)
行番号ソース
001<key>AppleLanguages</key>
002<array>
003<string>ja-JP</string>
004<string>en-US</string>
005
006<string>en</string>
007<string>en-JP</string>
008</array>
009<key>AppleLocale</key>
010<string>ja_JP</string>
AppleScriptで生成しました

macOS14で

サンプルコード

サンプルソース(参考)
行番号ソース
001#!/bin/bash
002/usr/bin/defaults read NSGlobalDomain AppleLanguages
003/usr/bin/defaults read -g AppleLanguages
004/usr/bin/defaults read -globalDomain AppleLanguages
AppleScriptで生成しました

NSGlobalDomain_mの値を変更する場合はパス指定がいいようだ
設定は

サンプルコード

サンプルソース(参考)
行番号ソース
001#!/bin/bash
002
003#GlobalPreferences_m
004#設定 現在の設定を削除して作り直し
005LANG_LIST=("ja-JP" "en-US")
006CNT_LANG_LIST=${#LANG_LIST[@]}
007STAT_USR=$(/usr/bin/stat -f%Su /dev/console)
008PATH_PLIST="/Users/${STAT_USR}/Library/Preferences/.GlobalPreferences_m.plist"
009
010if ! /usr/libexec/PlistBuddy -c "Print :AppleLanguages:" "$PATH_PLIST"; then
011  /bin/echo "設定されていません A"
012  for ((ITEMNO = 0; ITEMNO <= (CNT_LANG_LIST - 1); ITEMNO++)); do
013    /usr/libexec/PlistBuddy -c "Add :AppleLanguages:${ITEMNO} string "${LANG_LIST[$ITEMNO]}"" "$PATH_PLIST"
014  done
015else
016  /usr/libexec/PlistBuddy -c "Delete :AppleLanguages" "$PATH_PLIST"
017  for ((ITEMNO = 0; ITEMNO <= (CNT_LANG_LIST - 1); ITEMNO++)); do
018    /usr/libexec/PlistBuddy -c "Add :AppleLanguages:${ITEMNO} string "${LANG_LIST[$ITEMNO]}"" "$PATH_PLIST"
019  done
020fi
021/usr/libexec/PlistBuddy -c "Save" "$PATH_PLIST"
022
023#GlobalPreferences
024#設定 現在の設定を削除して作り直し
025LANG_LIST=("ja-JP" "en-US")
026CNT_LANG_LIST=${#LANG_LIST[@]}
027STAT_USR=$(/usr/bin/stat -f%Su /dev/console)
028PATH_PLIST="/Users/${STAT_USR}/Library/Preferences/.GlobalPreferences.plist"
029
030if ! /usr/libexec/PlistBuddy -c "Print :AppleLanguages:" "$PATH_PLIST"; then
031  /bin/echo "設定されていません A"
032  for ((ITEMNO = 0; ITEMNO <= (CNT_LANG_LIST - 1); ITEMNO++)); do
033    /usr/libexec/PlistBuddy -c "Add :AppleLanguages:${ITEMNO} string "${LANG_LIST[$ITEMNO]}"" "$PATH_PLIST"
034  done
035else
036  /usr/libexec/PlistBuddy -c "Delete :AppleLanguages" "$PATH_PLIST"
037  for ((ITEMNO = 0; ITEMNO <= (CNT_LANG_LIST - 1); ITEMNO++)); do
038    /usr/libexec/PlistBuddy -c "Add :AppleLanguages:${ITEMNO} string "${LANG_LIST[$ITEMNO]}"" "$PATH_PLIST"
039  done
040fi
041/usr/libexec/PlistBuddy -c "Save" "$PATH_PLIST"
042
043
044
045exit 0
AppleScriptで生成しました

|

[com.apple.GlobalPreferences] AppleShowScrollBars


サンプルコード

サンプルソース(参考)
行番号ソース
001基本的には同じ
002/usr/bin/defaults read -g 
003/usr/bin/defaults read -globalDomain 
004/usr/bin/defaults read NSGlobalDomain 
AppleScriptで生成しました

モバイルコンフィグでの記述例
サンプルコード

サンプルソース(参考)
行番号ソース
001<!--
002# WhenScrolling
003# Automatic
004# Always
005-->
006<key>AppleShowScrollBars</key>
007<string>Always</string>
008
009<key>PayloadDescription</key>
010<string>com.apple.NSGlobalDomain</string>
011<key>PayloadDisplayName</key>
012<string>com.apple.GlobalPreferences</string>
013<key>PayloadIdentifier</key>
014<string>.GlobalPreferences.ED0D77FF-2A0E-418B-AC6B-7C79A615D09E</string>
015<key>PayloadType</key>
016<string>.GlobalPreferences</string>
AppleScriptで生成しました

|

[Spotlight]検索キーの追加(mobileconfig)


サンプルコード

サンプルソース(参考)
行番号ソース
001<?xml version="1.0" encoding="UTF-8"?>
002<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
003<plist version="1.0">
004  <dict>
005    <key>ConsentText</key>
006    <dict>
007      <key>default</key>
008      <string>検索設定 Spotlight SlicesRootAttributes</string>
009    </dict>
010    <key>PayloadContent</key>
011    <array>
012      <dict>
013        <key>PayloadDisplayName</key>
014        <string>com.apple.finder.SlicesRootAttributes</string>
015        <key>PayloadIdentifier</key>
016        <string>com.apple.finder.6994FC7C-6CEC-46F9-80B9-527DFD6A6094</string>
017        <key>PayloadType</key>
018        <string>com.apple.finder</string>
019        <key>PayloadUUID</key>
020        <string>6994FC7C-6CEC-46F9-80B9-527DFD6A6094</string>
021        <key>PayloadVersion</key>
022        <integer>20240321</integer>
023        <key>SlicesRootAttributes</key>
024        <array>
025          <string>kMDItemKind</string>
026          <string>kMDItemMediaTypes</string>
027
028          <string>kMDItemLastUsedDate</string>
029          <string>kMDItemContentModificationDate</string>
030          <string>kMDItemContentCreationDate</string>
031          <string>kMDItemFSName</string>
032          <string>kMDItemDisplayName</string>
033          <string>kMDItemTextContent</string>
034          <string>kMDItemFSInvisible</string>
035          <string>kMDItemUserTags</string>
036
037          <string>kMDItemFSSize</string>
038          <string>kMDItemLogicalSize</string>
039
040          <string>kMDItemDurationSeconds</string>
041          <string>kMDItemBitsPerSample</string>
042          <string>kMDItemTotalBitRate</string>
043
044          <string>kMDItemFSLabel</string>
045
046          <string>kMDItemFSContentChangeDate</string>
047          <string>kMDItemFSCreationDate</string>
048          <string>kMDItemEmailAddresses</string>
049
050
051          <string>com_apple_FileExtensionAttribute</string>
052          <string>com_corel_file_applicationname</string>
053
054          <string>kMDItemPhysicalSize</string>
055          <string>kMDItemOrientation</string>
056          <string>kMDItemLayerNames</string>
057          <string>kMDItemPixelCount</string>
058          <string>kMDItemPixelWidth</string>
059          <string>kMDItemPixelHeight</string>
060          <string>kMDItemPageHeight</string>
061          <string>kMDItemPageWidth</string>
062
063          <string>kMDItemColorSpace</string>
064          <string>kMDItemProfileName</string>
065          <string>com_corel_file_document_cmyk_profile</string>
066          <string>com_corel_file_document_colors</string>
067          <string>com_corel_file_document_grayscale_profile</string>
068          <string>com_corel_file_document_palettes</string>
069          <string>com_corel_file_document_rgb_profile</string>
070          <string>com_corel_file_image_colormode</string>
071          <string>com_corel_file_image_colorprofile</string>
072
073          <string>kMDItemAudioBitRate</string>
074          <string>kMDItemAudioChannelCount</string>
075          <string>kMDItemAudioSampleRate</string>
076
077          <string>kMDItemFonts</string>
078          <string>com_apple_ats_name_postscript</string>
079          <string>com_apple_ats_name_family</string>
080          <string>com_apple_ats_name_full</string>
081          <string>com_apple_ats_name_style</string>
082          <string>com_apple_ats_name_fond</string>
083
084
085        </array>
086      </dict>
087    </array>
088    <key>PayloadDescription</key>
089    <string>com.apple.finder.SlicesRootAttributes Version20240321
090      UUID5DA435B7-9F9E-4D44-9090-E78ABE957923</string>
091    <key>PayloadDisplayName</key>
092    <string>com.apple.finder.SlicesRootAttributes</string>
093    <key>PayloadIdentifier</key>
094    <string>com.apple.finder.SlicesRootAttributes.5DA435B7-9F9E-4D44-9090-E78ABE957923</string>
095    <key>PayloadOrganization</key>
096    <string>Organization</string>
097    <key>PayloadScope</key>
098    <string>User</string>
099    <key>PayloadType</key>
100    <string>Configuration</string>
101    <key>PayloadUUID</key>
102    <string>5DA435B7-9F9E-4D44-9090-E78ABE957923</string>
103    <key>PayloadVersion</key>
104    <integer>20240321</integer>
105    <key>TargetDeviceType</key>
106    <integer>5</integer>
107  </dict>
108</plist>
AppleScriptで生成しました

|

[Spotlight]カラースペース関連

20240930123406_1122x906
20240929112441_1840x9842
サンプルコード

サンプルソース(参考)
行番号ソース
001<string>kMDItemColorSpace</string>
002<string>kMDItemProfileName</string>
003<string>com_corel_file_document_cmyk_profile</string>
004<string>com_corel_file_document_colors</string>
005<string>com_corel_file_document_grayscale_profile</string>
006<string>com_corel_file_document_palettes</string>
007<string>com_corel_file_document_rgb_profile</string>
008<string>com_corel_file_image_colormode</string>
009<string>com_corel_file_image_colorprofile</string>
AppleScriptで生成しました

|

より以前の記事一覧

その他のカテゴリー

Accessibility Acrobat Acrobat 2020 Acrobat 2024 Acrobat AddOn Acrobat Annotation Acrobat AppleScript Acrobat ARMDC Acrobat AV2 Acrobat BookMark Acrobat Classic Acrobat DC Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat GentechAI Acrobat JS Acrobat JS Word Search Acrobat Maintenance Acrobat Manifest Acrobat Menu Acrobat Merge Acrobat Open Acrobat PDFPage Acrobat Plugin Acrobat Preferences Acrobat Preflight Acrobat Print Acrobat Python Acrobat Reader Acrobat Reader Localized Acrobat Reference Acrobat Registered Products Acrobat SCA Acrobat SCA Updater Acrobat Sequ Acrobat Sign Acrobat Stamps Acrobat URL List Mac Acrobat URL List Windows Acrobat Watermark Acrobat Windows Acrobat Windows Reader Admin Admin Account Admin Apachectl Admin ConfigCode Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Mobileconfig Admin NetWork Admin Permission Admin Pkg Admin Power Management Admin Printer Admin Printer Basic Admin Printer Custompapers Admin SetUp Admin SMB Admin softwareupdate Admin Support Admin System Information Admin TCC Admin Tools Admin Umask Admin Users Admin Volumes Admin XProtect Adobe Adobe AUSST Adobe Bridge Adobe Documents Adobe FDKO Adobe Fonts Adobe Reference Adobe RemoteUpdateManager Adobe Sap Code AppKit Apple AppleScript AppleScript Duplicate AppleScript entire contents AppleScript List AppleScript ObjC AppleScript Osax AppleScript PDF AppleScript Pictures AppleScript record AppleScript Video Applications AppStore Archive Archive Keka Attributes Automator BackUp Barcode Barcode Decode Barcode QR Bash Basic Basic Path Bluetooth BOX Browser Calendar CD/DVD Choose Chrome Chromedriver CIImage CityCode CloudStorage Color Color NSColor Color NSColorList com.apple.LaunchServices.OpenWith Console Contacts CotEditor CURL current application Date&Time delimiters Desktop Desktop Position Device Diff Disk do shell script Dock Dock Launchpad DropBox Droplet eMail Encode % Encode Decode Encode HTML Entity Encode UTF8 Error EXIFData exiftool ffmpeg File File Name Finder Finder Window Firefox Folder FolderAction Font List FontCollections Fonts Fonts Asset_Font Fonts ATS Fonts Emoji Fonts Maintenance Fonts Morisawa Fonts Python Fonts Variable Foxit GIF github Guide HTML Icon Icon Assets.car Illustrator Image Events ImageOptim Input Dictionary iPhone iWork Javascript Jedit Ω Json Label Language Link locationd lsappinfo m3u8 Mail 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 Microsoft Office Link Microsoft OneDrive Microsoft Teams Mouse Music Node Notes NSArray NSArray Sort NSAttributedString NSBezierPath NSBitmapImageRep NSBundle NSCFBoolean NSCharacterSet NSData NSDecimalNumber NSDictionary NSError NSEvent NSFileAttributes NSFileManager NSFileManager enumeratorAtURL NSFont NSFontManager NSGraphicsContext NSGraphicsContext Crop NSImage NSIndex NSKeyedArchiver NSKeyedUnarchiver NSLocale NSMetadataItem NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSRange NSRect NSRegularExpression NSRunningApplication NSScreen NSSet NSSize NSString NSString stringByApplyingTransform NSStringCompareOptions NSTask NSTimeZone NSUbiquitous NSURL NSURL File NSURLBookmark NSURLComponents NSURLResourceKey NSURLSession NSUserDefaults NSUUID NSView NSWorkspace Numbers OAuth PDF PDF Image2PDF PDF MakePDF PDF nUP PDF Pymupdf PDF Pypdf PDFContext PDFDisplayBox PDFImageRep PDFKit PDFKit Annotation PDFKit AnnotationWidget PDFKit DocumentPermissions PDFKit OCR PDFKit Outline PDFKit Start PDFPage PDFPage Rotation PDFView perl Photoshop PlistBuddy pluginkit plutil postalcode PostScript PowerShell prefPane Preview Python Python eyed3 Python pip QuickLook QuickTime ReadMe Regular Expression Reminders ReName Repeat RTF Safari SaveFile ScreenCapture ScreenSaver Script Editor Script Menu SF Symbols character id SF Symbols Entity Shortcuts Shortcuts Events sips Skype Slack Sound Spotlight sqlite StandardAdditions StationSearch Subtitles LRC Subtitles SRT Subtitles VTT Swift swiftDialog System Events System Settings 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 Weather webarchive webp Wifi Windows XML XML EPUB XML HTML XML LSSharedFileList XML LSSharedFileList sfl2 XML LSSharedFileList sfl3 XML objectsForXQuery XML OPML XML Plist XML Plist System Events XML RSS XML savedSearch XML SVG XML TTML XML webloc XML xmllint XML XMP YouTube Zero Padding zoom