« [dumpbtm]バックグラウンドでの実行の許可状況を表示 | トップページ | [Music]フェードアウト からの フェードイン ボリュームを戻す版 »

BTMNotificationAgent

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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property refMe : a reference to current application

###設定項目 
set strDomain to "com.apple.notificationsettings"
###DeviceType
set numTargetDeviceType to 5 as number
(*
0 = Any/unspecified
1 = iPhone/iPad/iPod Touch
2 = Apple Watch
3 = HomePod
4 = Apple TV
5 = Mac
*)

set strPayloadDisplayName to "BTMNotificationAgent設定" as text
set strPayloadOrganization to "com.cocolog-nifty.quicktimer" as text
set strPayloadDescription to "BTMNotificationAgent関連の設定です" as text
set strConsentTextDefault to "BTMNotificationAgent設定のみ行います\nうるさいBTMNotificationを出なくします"


####################################
#### ファイルパス関連 保存先
####################################

###デスクトップに空のplistを作成
set strFilePath to ("~/Desktop/com.apple.BTMNotificationAgent.mobileconfig")
###NSStringにして
set ocidPosixPath to refMe's NSString's stringWithString:strFilePath
##NSStringフルパスにして
set ocidFilePath to ocidPosixPath's stringByStandardizingPath
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false

####################################
#### NSMutableDictionary可変ディレクトリ
####################################
###ROOT
set ocidPlistData to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
###boolean 項目の 設定
-->false
set ocidFalse to (refMe's NSNumber's numberWithBool:false)
-->true
set ocidTrue to (refMe's NSNumber's numberWithBool:true)

####################################
#### PayloadContent項目
####################################
set ocidPayloadContentArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
set ocidPayloadContentDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0


set ocidPayloadSettingDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidPayloadSettingDict's setObject:("com.apple.BTMNotificationAgent" as string) forKey:"BundleIdentifier"
ocidPayloadSettingDict's setObject:(ocidFalse) forKey:"NotificationsEnabled"

set ocidPayloadSettingArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
ocidPayloadSettingArray's addObject:(ocidPayloadSettingDict)

ocidPayloadContentDict's setObject:(ocidPayloadSettingArray) forKey:"NotificationSettings"


###PayloadIdentifier
set ocidConcreteUUID to refMe's NSUUID's UUID()
set ocidUUIDString to ocidConcreteUUID's UUIDString()
set strUUIDString to strDomain & "." & ocidUUIDString as string
ocidPayloadContentDict's setObject:(strUUIDString) forKey:"PayloadIdentifier"
ocidPayloadContentDict's setObject:(ocidUUIDString) forKey:"PayloadUUID"

ocidPayloadContentDict's setObject:(strDomain) forKey:"PayloadType"

###PayloadVersion
set strDateno to doGetDateNo("yyyyMMdd")
set numDateno to strDateno as integer
ocidPayloadContentDict's setObject:(numDateno as integer) forKey:"PayloadVersion"

ocidPayloadContentArray's addObject:ocidPayloadContentDict

####################################
#### ROOT項目
####################################
####PayloadContent
ocidPlistData's setObject:(ocidPayloadContentArray) forKey:"PayloadContent"

##################string
###PayloadUUID
set ocidConcreteUUID to refMe's NSUUID's UUID()
set ocidUUIDString to ocidConcreteUUID's UUIDString()
set strUUIDString to ocidUUIDString as string
ocidPlistData's setObject:(strUUIDString) forKey:"PayloadUUID"
###同じUUIDを使うのでセットで
###PayloadIdentifier
set strUUIDString to strDomain & "." & ocidUUIDString as string
ocidPlistData's setObject:(strUUIDString) forKey:"PayloadIdentifier"

###PayloadType これは固定
ocidPlistData's setObject:("Configuration" as string) forKey:"PayloadType"

###PayloadScope User or System
ocidPlistData's setObject:("System" as string) forKey:"PayloadScope"

###PayloadDisplayName
ocidPlistData's setObject:(strPayloadDisplayName as string) forKey:"PayloadDisplayName"

###PayloadDescription
ocidPlistData's setObject:(strPayloadDescription as string) forKey:"PayloadDescription"

###PayloadDescription
ocidPlistData's setObject:(strPayloadOrganization as string) forKey:"PayloadOrganization"

##################Record
###ConsentText
####set recorConsentText to {default:strConsentTextDefault} as record
ocidPlistData's setObject:{default:strConsentTextDefault} forKey:"ConsentText"

##################BOOL
###削除可非
ocidPlistData's setObject:(ocidTrue) forKey:"PayloadRemovalDisallowed"

###パスワード指定
ocidPlistData's setObject:(ocidFalse) forKey:"HasRemovalPasscode"
##ocidPlistData's setObject:(ocidFalse) forKey:"IsEncrypted"

##################number

##################integer
###PayloadVersion
set strDateno to doGetDateNo("yyyyMMdd")
set numDateno to strDateno as integer
ocidPlistData's setObject:(numDateno as integer) forKey:"PayloadVersion"

###TargetDeviceType デバイスタイプ
ocidPlistData's setObject:(numTargetDeviceType as number) forKey:"TargetDeviceType"


####################################
#### PLIST形式に変換
####################################
####XMLフォーマット
set ocidPlistFotmat to refMe's NSPropertyListXMLFormat_v1_0
####PLIST形式に変換
set lisrResponse to refMe's NSPropertyListSerialization's dataWithPropertyList:ocidPlistData format:ocidPlistFotmat options:0 |error|:(reference)
####取り出し
set ocidPlistOutPutData to (item 1 of lisrResponse)
####################################
#### 保存
####################################
#####書き込み
set boolMakeQrCode to (ocidPlistOutPutData's writeToURL:ocidFilePathURL options:(refMe's NSDataWritingAtomic) |error|:(reference))



####################################
#### 
####################################

to doGetDateNo(strDateFormat)
  ####日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義
  set ocidNSDateFormatter to current application's NSDateFormatter's alloc()'s init()
  ocidNSDateFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
  ocidNSDateFormatter's setDateFormat:strDateFormat
  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
  set strDateAndTime to ocidDateAndTime as text
  return strDateAndTime
end doGetDateNo



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>ConsentText</key>
  <dict>
    <key>default</key>
    <string>BTMNotificationAgent設定のみ行います
うるさいBTMNotificationを出なくします</string>
  </dict>
  <key>HasRemovalPasscode</key>
  <false/>
  <key>PayloadContent</key>
  <array>
    <dict>
      <key>NotificationSettings</key>
      <array>
        <dict>
          <key>BundleIdentifier</key>
          <string>com.apple.BTMNotificationAgent</string>
          <key>NotificationsEnabled</key>
          <false/>
        </dict>
      </array>
      <key>PayloadIdentifier</key>
      <string>com.apple.notificationsettings.FAA7BD23-0453-4B5E-866D-300F0BC485A6</string>
      <key>PayloadType</key>
      <string>com.apple.notificationsettings</string>
      <key>PayloadUUID</key>
      <string>FAA7BD23-0453-4B5E-866D-300F0BC485A6</string>
      <key>PayloadVersion</key>
      <integer>20230506</integer>
    </dict>
  </array>
  <key>PayloadDescription</key>
  <string>BTMNotificationAgent関連の設定です</string>
  <key>PayloadDisplayName</key>
  <string>BTMNotificationAgent設定</string>
  <key>PayloadIdentifier</key>
  <string>com.apple.notificationsettings.5708D213-6C9C-45D5-BD76-D0BEEFF56D32</string>
  <key>PayloadOrganization</key>
  <string>com.cocolog-nifty.quicktimer</string>
  <key>PayloadRemovalDisallowed</key>
  <true/>
  <key>PayloadScope</key>
  <string>System</string>
  <key>PayloadType</key>
  <string>Configuration</string>
  <key>PayloadUUID</key>
  <string>5708D213-6C9C-45D5-BD76-D0BEEFF56D32</string>
  <key>PayloadVersion</key>
  <integer>20230506</integer>
  <key>TargetDeviceType</key>
  <integer>5</integer>
</dict>
</plist>

|

« [dumpbtm]バックグラウンドでの実行の許可状況を表示 | トップページ | [Music]フェードアウト からの フェードイン ボリュームを戻す版 »

Admin Mobileconfig」カテゴリの記事

Admin Device Management」カテゴリの記事

Admin loginitem」カテゴリの記事