XML Plist

Plist処理 基本型 


AppleScript サンプルコード

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

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004# PLIST 基本型
005#com.cocolog-nifty.quicktimer.icefloe
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007##自分環境がos12なので2.8にしているだけです
008use AppleScript version "2.8"
009use framework "Foundation"
010use framework "AppKit"
011use scripting additions
012
013#############################
014#
015set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
016set ocidLibraryDirPathURL to ocidURLsArray's firstObject()
017set ocidPlistFilePathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Preferences/■■■■■.plist") isDirectory:(false)
018set ocidPlistFilePath to ocidPlistFilePathURL's |path|()
019#ファイルの有無を確認
020set boolFileExists to appFileManager's fileExistsAtPath:(ocidPlistFilePath) isDirectory:(false)
021
022if boolFileExists is true then
023  #【A】ファイルがある場合
024  #Plist読み込み NSData's
025  set ocidOption to (refMe's NSDataReadingMappedIfSafe)
026  set listReadData to refMe's NSData's alloc()'s initWithContentsOfURL:(ocidPlistFilePathURL) options:(ocidOption) |error| :(reference)
027  if (item 2 of listResponse) = (missing value) then
028    set ocidPlistData to (item 1 of listReadData)
029  else if (item 2 of listResponse) ≠ (missing value) then
030    set strErrorNO to (item 2 of listResponse)'s code() as text
031    set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
032    refMe's NSLog("■:" & strErrorNO & strErrorMes)
033    return "エラーしました" & strErrorNO & strErrorMes
034  end if
035  
036  #DICTにする
037  set ocidFormat to (refMe's NSPropertyListBinaryFormat_v1_0)
038  set appPlistSerial to refMe's NSPropertyListSerialization
039  set ocidOption to refMe's NSPropertyListMutableContainersAndLeaves
040  set listPlistDict to appPlistSerial's propertyListWithData:(ocidPlistData) options:(ocidOption) format:(ocidFormat) |error| :(reference)
041  if (item 2 of listResponse) = (missing value) then
042    set ocidPlistDict to (item 1 of listPlistDict)
043  else if (item 2 of listResponse) ≠ (missing value) then
044    set strErrorNO to (item 2 of listResponse)'s code() as text
045    set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
046    refMe's NSLog("■:" & strErrorNO & strErrorMes)
047    return "エラーしました" & strErrorNO & strErrorMes
048  end if
049  
050  
051else
052  #【B】ファイルが無い場合
053  #空のDICTを用意する
054  set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
055end if
056###############
057#ここで処理
058#ここで処理
059###############
060#保存
061#DICTをPLISTに変換
062set ocidFormat to (refMe's NSPropertyListBinaryFormat_v1_0)
063set listResponse to refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidPlistDict) format:(ocidFormat) options:0  |error| :(reference)
064if (item 2 of listResponse) = (missing value) then
065  set ocidPlistData to (item 1 of listResponse)
066else if (item 2 of listResponse) ≠ (missing value) then
067  set strErrorNO to (item 2 of listResponse)'s code() as text
068  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
069  refMe's NSLog("■:" & strErrorNO & strErrorMes)
070  return "エラーしました" & strErrorNO & strErrorMes
071end if
072
073#保存 
074set ocidOption to (refMe's NSDataWritingAtomic)
075set listDone to ocidPlistData's writeToURL:(ocidPlistFilePathURL) options:(ocidOption) |error| :(reference)
076if (item 1 of listDone) is true then
077  log "正常終了"
078else if (item 1 of listDone) is false then
079  set strErrorNO to (item 2 of listResponse)'s code() as text
080  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
081  refMe's NSLog("■:" & strErrorNO & strErrorMes)
082  return "エラーしました" & strErrorNO & strErrorMes
083end if
084#読み込んだDICTの内容をクリア
085set ocidPlistDict to (missing value)
086
AppleScriptで生成しました

|

[ユーザー辞書]ひらがな カタカナの濁音 半濁音 入力支援辞書

20240915071432_878x246
202409150706161080x1080



ダウンロード - 濁音入力支援.zip
登録用のplistを入れてあるのでこちらをダウンロードしてください




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
006##自分環境がos12なので2.8にしているだけです
007use AppleScript version "2.8"
008use framework "Foundation"
009use framework "AppKit"
010use scripting additions
011
012property refMe : a reference to current application
013
014##順番に4回処理してください
015#set strSetPath to ("Data/カタカナ濁音.tsv") as text
016#set strSetPath to ("Data/カタカナ半濁.tsv") as text
017#set strSetPath to ("Data/ひらがな濁音.tsv") as text
018set strSetPath to ("Data/ひらがな半濁.tsv") as text
019
020
021#####################
022#PATH TO ME
023set aliasPathToMe to (path to me) as alias
024set strPathToMe to (POSIX path of aliasPathToMe) as text
025set ocidPathToMeStr to refMe's NSString's stringWithString:(strPathToMe)
026set ocidPathToMe to ocidPathToMeStr's stringByStandardizingPath()
027set ocidPathToMeURL to refMe's NSURL's fileURLWithPath:(ocidPathToMe)
028#読み込みファイル
029set ocidContainerDirPathURL to ocidPathToMeURL's URLByDeletingLastPathComponent()
030set ocidReadFilePathURL to ocidContainerDirPathURL's URLByAppendingPathComponent:(strSetPath) isDirectory:(false)
031#保存パス
032set ocidBaseFilePathURL to ocidReadFilePathURL's URLByDeletingPathExtension()
033set ocidFileName to ocidBaseFilePathURL's lastPathComponent()
034set ocidSaveDirPathURL to ocidContainerDirPathURL's URLByAppendingPathComponent:("出来上がり辞書登録用PLIST") isDirectory:(true)
035#
036set appFileManager to refMe's NSFileManager's defaultManager()
037set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
038# 777-->511 755-->493 700-->448 766-->502
039ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
040set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
041set ocidSaveBaseFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(ocidFileName) isDirectory:(false)
042set ocidSaveFilePathURL to ocidSaveBaseFilePathURL's URLByAppendingPathExtension:("plist")
043
044
045#####################
046#NSDATA
047set ocidOption to (refMe's NSDataReadingMappedIfSafe)
048set listResponse to refMe's NSData's alloc()'s initWithContentsOfURL:(ocidReadFilePathURL) options:(ocidOption) |error| :(reference)
049if (item 2 of listResponse) = (missing value) then
050  set ocidReadData to (item 1 of listResponse)
051else if (item 2 of listResponse) ≠ (missing value) then
052  set strErrorNO to (item 2 of listResponse)'s code() as text
053  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
054  refMe's NSLog("■:" & strErrorNO & strErrorMes)
055  return "エラーしました" & strErrorNO & strErrorMes
056end if
057#####################
058#NSSTRING
059set ocidReadString to refMe's NSString's alloc()'s initWithData:(ocidReadData) encoding:(refMe's NSUTF8StringEncoding)
060
061#####################
062#NSMutableArray's
063set ocidPlistArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
064
065#####################
066#NSARRAY
067set ocidStringArray to ocidReadString's componentsSeparatedByString:("\n")
068#行テキストを順番に処理
069repeat with itemLineText in ocidStringArray
070  #行テキスト=タブ区切りなのでタブで前後にわける
071  set ocidTabArray to (itemLineText's componentsSeparatedByString:("\t"))
072  #####################
073  #NSMutableDictionary
074  set ocidPlistDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:(0))
075  #前が入力値
076  (ocidPlistDict's setValue:(ocidTabArray's firstObject()) forKey:("shortcut"))
077  #後が変換値
078  (ocidPlistDict's setValue:(ocidTabArray's lastObject()) forKey:("phrase"))
079  #出来たDICTをARRYにセット
080  (ocidPlistArray's addObject:(ocidPlistDict))
081end repeat
082
083#####################
084#NSPropertyListSerialization
085set ocidFormat to (refMe's NSPropertyListBinaryFormat_v1_0)
086set listResponse to refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidPlistArray) format:(ocidFormat) options:0  |error| :(reference)
087if (item 2 of listResponse) = (missing value) then
088  set ocidPlistData to (item 1 of listResponse)
089else if (item 2 of listResponse) ≠ (missing value) then
090  set strErrorNO to (item 2 of listResponse)'s code() as text
091  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
092  refMe's NSLog("■:" & strErrorNO & strErrorMes)
093  return "エラーしました" & strErrorNO & strErrorMes
094end if
095
096
097##########################################
098####【4】保存  ここは上書き
099set ocidOption to (refMe's NSDataWritingAtomic)
100set listDone to ocidPlistData's writeToURL:(ocidSaveFilePathURL) options:(ocidOption) |error| :(reference)
101if (item 1 of listDone) is true then
102  return "正常処理"
103else if (item 2 of listDone) ≠ (missing value) then
104  set strErrorNO to (item 2 of listDone)'s code() as text
105  set strErrorMes to (item 2 of listDone)'s localizedDescription() as text
106  refMe's NSLog("■:" & strErrorNO & strErrorMes)
107  return "エラーしました" & strErrorNO & strErrorMes
108end if
109
AppleScriptで生成しました

|

[xmllint]xmllintでPLIST操作


あくまでも参考にしてください

サンプルソース(参考)
行番号ソース
001#! /bin/bash
002#com.cocolog-nifty.quicktimer.icefloe
003# PLISTに限っては
004# 値の取得が可能ってだけで 実用的ではない
005####################################
006STR_PLIST_PATH="$HOME/Library/Containers/com.apple.archiveutility/Data/Library/Preferences/com.apple.archiveutility.plist"
007
008#バイナリーの場合はXML形式に変換しておく
009STR_FORMAT=$(/usr/bin/file "$STR_PLIST_PATH")
010if [[ "$STR_FORMAT" == *"binary"* ]]; then
011  STR_TMP_DIR_PATH=$(/usr/bin/mktemp -d)
012  STR_FILENAME=$(/usr/bin/basename "$STR_PLIST_PATH")
013  STR_CONVERT_FILE_PATH="$STR_TMP_DIR_PATH/$STR_FILENAME"
014  /usr/bin/plutil -convert xml1 "$STR_PLIST_PATH" -o "$STR_CONVERT_FILE_PATH"
015elif [[ "$STR_FORMAT" == *"XML"* ]]; then
016  STR_CONVERT_FILE_PATH="$STR_PLIST_PATH"
017fi
018#キーパスで指定
019STR_VALUE=$(/usr/bin/xmllint --xpath "string(//key[.='archive-format']/following-sibling::string[1])" "$STR_CONVERT_FILE_PATH")
020/bin/echo "$STR_VALUE"
021#全部表示
022/usr/bin/xmllint  --xmlout "$STR_CONVERT_FILE_PATH"
023
024exit 0
AppleScriptで生成しました

|

パージョンを取得する(defaults , PlistBuddy,plutil)


あくまでも参考にしてください

サンプルソース(参考)
行番号ソース
001#! /bin/bash
002#com.cocolog-nifty.quicktimer.icefloe
003#バージョンを調べる
004#################################################
005#OS  ProductVersion
006/usr/bin/defaults read "/System/Library/CoreServices/SystemVersion.plist" ProductVersion
007#OS ProductUserVisibleVersion
008/usr/libexec/PlistBuddy -c "Print:ProductUserVisibleVersion" "/System/Library/CoreServices/SystemVersion.plist"
009#OS
010/usr/bin/plutil -extract ProductVersion raw -expect string "/System/Library/CoreServices/SystemVersion.plist" 
011
012#################################################
013#アプリケーション CFBundleShortVersionStringの値を取る
014STR_APP_PATH="/Applications/Safari.app"
015STR_PLIST_PATH="${STR_APP_PATH}/Contents/Info.plist"
016#
017/usr/bin/defaults read "$STR_PLIST_PATH" CFBundleShortVersionString
018#
019/usr/libexec/PlistBuddy -c "Print:CFBundleShortVersionString" "$STR_PLIST_PATH"
020#
021/usr/bin/plutil -extract CFBundleShortVersionString raw -expect string "$STR_PLIST_PATH" 
022#################################################
023#アプリケーション CFBundleVersionの値を取る version.plistがある場合
024STR_APP_PATH="/Applications/Safari.app"
025STR_PLIST_PATH="${STR_APP_PATH}/Contents/version.plist"
026#
027/usr/bin/defaults read "$STR_PLIST_PATH" CFBundleVersion
028#
029/usr/libexec/PlistBuddy -c "Print:CFBundleVersion" "$STR_PLIST_PATH"
030#
031/usr/bin/plutil -extract CFBundleVersion raw -expect string "$STR_PLIST_PATH" 
032
033#################################################
034#アプリケーション CFBundleVersionを取得する一般的にはこの方法
035STR_APP_PATH="/Applications/Adobe Acrobat Reader.app"
036STR_PLIST_PATH="${STR_APP_PATH}/Contents/Info.plist"
037#
038/usr/bin/defaults read "$STR_PLIST_PATH" CFBundleVersion
039#
040/usr/libexec/PlistBuddy -c "Print:CFBundleVersion" "$STR_PLIST_PATH"
041#
042/usr/bin/plutil -extract CFBundleVersion raw -expect string "$STR_PLIST_PATH" 
043
044exit 0
AppleScriptで生成しました

|

[Plist]Plist まとめ 更新



A:入力
B:編集
C:出力
D:備考


Application
Xcode
https://developer.apple.com/xcode/
Prefs Editor
https://apps.tempel.org/PrefsEditor/


A:入力
1:DATA
[Plist]NSDATAを使って読み込む
https://quicktimer.cocolog-nifty.com/icefloe/2023/07/post-14ff50.html
2:Dict
[PLIST]値の取得 基本
https://quicktimer.cocolog-nifty.com/icefloe/2023/06/post-46307d.html
[Plist]Plistの値の変更 writeToURL:atomicallyが非推奨→ writeToURL:errorに変更
https://quicktimer.cocolog-nifty.com/icefloe/2024/03/post-ee5c62.html
3:キーアーカイブ
セキュリティ上の理由もあるが
NSURL等 PLISTには保存できない形式も保存が可能
[基本]NSKeyedArchiver
https://quicktimer.cocolog-nifty.com/icefloe/cat76056161/index.html
NSKeyedUnarchiver
https://quicktimer.cocolog-nifty.com/icefloe/cat76055043/index.html
4:ファイルから
[PLIST]値の取得 基本 その1 plistを読み込んでPlistで保存
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-e591c4.html
[plutil]Plistのフォーマット変更(サービスメニュー用)
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-4fcfa5.html
5:JSON
[JSON]JSONの取扱 その1(rootがDict形式の場合
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-7ac684.html
[JSON]JSONの取扱 その2(rootがArray形式の場合)
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-0ed292.html
その他
https://quicktimer.cocolog-nifty.com/icefloe/cat76049735/index.html


B:編集
[PLIST]値の取得 基本
https://quicktimer.cocolog-nifty.com/icefloe/2023/06/post-46307d.html
1: /usr/bin/defaults
[Plist]defaults read
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-035836.html
[Plist]defaults write
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-8926ec.html
2: /usr/libexec/PlistBuddy
https://quicktimer.cocolog-nifty.com/icefloe/cat76027586/index.html
3: /usr/bin/plutil
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-892166.html
[plutil]他のコマンド類との比較
https://quicktimer.cocolog-nifty.com/icefloe/2024/04/post-99d8b7.html
4: /usr/bin/xmllint
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-c9efbb.html
5: AppleScript System Events
https://quicktimer.cocolog-nifty.com/icefloe/cat76056176/index.html
6: AppleScript Oc
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-e591c4.html
7:Xcode
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-cdefb1.html
8:Visual Studio Code
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-d25c0e.html


C:出力
NSDATA
[Plist]Plistの値の変更 writeToURL:atomicallyが非推奨→ writeToURL:errorに変更
https://quicktimer.cocolog-nifty.com/icefloe/2024/03/post-ee5c62.html

writeToURL:options:error:
writeToURL:atomically: での保存になります
Plistはバイナリー形式が基本です。アクセスや読み込みが速いからかな?と思います
1:バイナリ


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

set ocidFormat to (refMe's NSPropertyListBinaryFormat_v1_0)
set ocidPlistData to refMe's NSPropertyListSerialization's dataWithPropertyList:("ここにDICTデータ") format:(ocidFormat) options:0 |error|:(reference)


2: XMLモバイルコンフィグ等XMLであった方が編集しやすい時は迷わずこちら

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

set ocidFormat to (refMe's NSPropertyListXMLFormat_v1_0)
set ocidPlistData to refMe's NSPropertyListSerialization's dataWithPropertyList:("ここにDICTデータ") format:(ocidFormat) options:0 |error|:(reference)


3:キーアーカイブ
[基本]NSKeyedArchiver 圧縮
https://quicktimer.cocolog-nifty.com/icefloe/cat76056161/index.html

カテゴリー 解凍 NSKeyedUnarchiver
https://quicktimer.cocolog-nifty.com/icefloe/cat76055043/index.html
4:JSON
https://quicktimer.cocolog-nifty.com/icefloe/cat76049735/index.html



D:備考
mobileconfigは中身はPLIST
[mobileconfig]AppleScriptでの処理の基本(再考)
https://quicktimer.cocolog-nifty.com/icefloe/2022/05/post-9dad8c.html
LSSharedFileListはキーアーカイブされたPLIST
AppleScript LSSharedFileList
https://quicktimer.cocolog-nifty.com/icefloe/cat76055054/index.html
検索条件を記録してあるsavedSearchもPLIST
[savedSearch]検索条件ファイルを作成する
https://quicktimer.cocolog-nifty.com/icefloe/2023/06/post-e476bb.html


[Webloc]ロケーションファイル(com.apple.generic-internet-location)もPLIST
インターネット・ロケーションファイルまとめ
https://quicktimer.cocolog-nifty.com/icefloe/cat76053046/index.html


plutil defaults PlistBuddyの文法の比較


#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
#
#plutil
STR_USR_LANG=$(/usr/bin/plutil -extract AppleLanguages.0 raw -expect string $HOME/Library/Preferences/.GlobalPreferences.plist ) 
/bin/echo "plutil:ユーザー設定の第1言語は $STR_USR_LANG です"
#defaults
STR_USR_LANG=$(/usr/bin/defaults read $HOME/Library/Preferences/.GlobalPreferences AppleLanguages| tr -d "[:space:][(][)]\""|cut -d , -f 1 )
/bin/echo "defaults:ユーザー設定の第1言語は $STR_USR_LANG です"
#PlistBuddy
STR_USR_LANG=$(/usr/libexec/PlistBuddy -c "Print:AppleLanguages:0" "$HOME/Library/Preferences/.GlobalPreferences.plist")
/bin/echo "PlistBuddy:ユーザー設定の第1言語は $STR_USR_LANG です"

exit 0




Serialization004_20231028110801


Screen-20231028-110332

|

[plutil]他のコマンド類との比較


ダウンロード - desktopshowhide.zip

ダウンロード - allfilesshowhide.zip



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

#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
###実行しているユーザー名
STAT_USR=$(/usr/bin/stat -f%Su /dev/console)
/bin/echo "STAT_USR(console): $STAT_USR"
###############
STR_PLIST_PATH="$HOME/Library/Preferences/com.apple.finder.plist"
#plutil
STR_BOOL_VALUE=$(/usr/bin/plutil -extract CreateDesktop raw -expect bool "$STR_PLIST_PATH")
/bin/echo "plutil:ユーザー設定は $STR_BOOL_VALUE です"

if [ "$STR_BOOL_VALUE" = "true" ]; then
/usr/bin/plutil -replace CreateDesktop -bool false "$STR_PLIST_PATH"
else
/usr/bin/plutil -replace CreateDesktop -bool true "$STR_PLIST_PATH"
fi

STR_BOOL_VALUE=$(/usr/bin/plutil -extract CreateDesktop raw -expect bool "$STR_PLIST_PATH")
/bin/echo "plutil:ユーザー設定は $STR_BOOL_VALUE に変わりました"

/usr/bin/killall cfprefsd
sleep 1
/usr/bin/killall Finder

exit 0


|

[Json]PlistをJsonに変換する(NSTaggedDate対策入り)


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(*
日付データNSTaggedDateをstringに置換してから
PLISTデータをJSON形式にします
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


####ダイアログで使うデフォルトロケーション
tell application "Finder"
  set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell
####UTIリスト
set listUTI to {"com.apple.property-list", "public.xml"}
####ダイアログを出す
set aliasFilePath to (choose file with prompt "ファイルを選んでください" default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias

set strFilePath to (POSIX path of aliasFilePath) as text
set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
set ocidFilePathURL to refMe's NSURL's fileURLWithPath:(ocidFilePath)
set ocidFileName to ocidFilePathURL's lastPathComponent()
##########################################
###【1】テンポラリディレクトリとパス
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidTempDirURL to appFileManager's temporaryDirectory()
set ocidUUID to refMe's NSUUID's alloc()'s init()
set ocidUUIDString to ocidUUID's UUIDString
set ocidSaveDirPathURL to ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:true
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
# 777-->511 755-->493 700-->448 766-->502
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listDone to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
if (item 1 of listDone) is true then
  #テンポラリファイル
  set ocidTmpFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(ocidFileName) isDirectory:false
log "【1】正常終了"
else if (item 1 of listDone) is false then
log (item 2 of listDone)'s localizedDescription() as text
return "【1】失敗しました"
end if


##########################################
### 【2】PLISTファイルをNSDATAとして読み込み
(* NSDataReadingOptions
(*1*)log refMe's NSDataReadingMappedIfSafe as integer
(*2*)log refMe's NSDataReadingUncached as integer
(*8*)log refMe's NSDataReadingMappedAlways as integer
*)
set listReadData to refMe's NSData's alloc()'s initWithContentsOfURL:(ocidFilePathURL) options:(refMe's NSDataReadingMappedIfSafe) |error|:(reference)
if (item 2 of listReadData) is (missing value) then
  set coidReadData to (item 1 of listReadData)
log " 【2】正常終了"
else
log (item 2 of listReadData)'s localizedDescription() as text
return " 【2】失敗しました"
end if


##########################################
####【3】PLISTに変換 (optionは 0-2 Immutable /MutableContainers /MutableContainersAndLeaves)
set ocidXmlPlist to refMe's NSPropertyListXMLFormat_v1_0
set ocidPlistSerial to refMe's NSPropertyListSerialization
set ocidOption to refMe's NSPropertyListMutableContainersAndLeaves
set listPlistDict to ocidPlistSerial's propertyListWithData:(coidReadData) options:(ocidOption) format:(ocidXmlPlist) |error|:(reference)
if (item 2 of listPlistDict) is (missing value) then
  set ocidPlistDict to (item 1 of listPlistDict)
log "【3】正常終了"
else
log (item 2 of listPlistDict)'s localizedDescription() as text
return "【3】失敗しました"
end if


##########################################
####【4】テンポラリファイルを保存
set ocidOption to (refMe's NSDataWritingWithoutOverwriting)
set listDone to ocidPlistDict's writeToURL:(ocidTmpFilePathURL) |error|:(reference)
if (item 1 of listDone) is true then
log "【4】正常終了"
else if (item 1 of listDone) is false then
log (item 2 of listDone)'s localizedDescription() as text
return "【4】失敗しました"
end if
##########################################
####【5】テンポラリのPLISTの『フォーマット』を変更
set listReadString to refMe's NSMutableString's alloc()'s initWithContentsOfURL:(ocidTmpFilePathURL) encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)
if (item 2 of listReadString) is (missing value) then
  set ocidReadString to (item 1 of listReadString)
log "【5-1】正常終了"
else
log (item 2 of listReadString)'s localizedDescription() as text
return "【5-1】失敗しました"
end if
##置換
set ocidSaveString to ocidReadString's stringByReplacingOccurrencesOfString:("<date>") withString:("<string>")
set ocidSaveString to ocidSaveString's stringByReplacingOccurrencesOfString:("</date>") withString:("</string>")
set ocidSaveString to ocidSaveString's stringByReplacingOccurrencesOfString:("<data>") withString:("<string>")
set ocidSaveString to ocidSaveString's stringByReplacingOccurrencesOfString:("</data>") withString:("</string>")
##上書き保存
set listDone to ocidSaveString's writeToURL:(ocidTmpFilePathURL) atomically:(true) encoding:(refMe's NSUTF8StringEncoding) |error|:(reference)
if (item 1 of listDone) is true then
log "【5-2】正常終了"
else if (item 1 of listDone) is false then
log (item 2 of listDone)'s localizedDescription() as text
return "【5-2】失敗しました"
end if
##########################################
### 【6】PLISTファイルをNSDATAとして読み込み
set listReadTmpData to refMe's NSData's alloc()'s initWithContentsOfURL:(ocidTmpFilePathURL) options:(refMe's NSDataReadingMappedIfSafe) |error|:(reference)
if (item 2 of listReadTmpData) is (missing value) then
  set ocidReadTmpData to (item 1 of listReadTmpData)
log "【6】正常終了"
else
log (item 2 of listReadTmpData)'s localizedDescription() as text
return "【6】失敗しました"
end if
##########################################
####【7】PLISTに変換 (optionは 0-2 Immutable /MutableContainers /MutableContainersAndLeaves)
set ocidXmlPlist to refMe's NSPropertyListXMLFormat_v1_0
set ocidPlistSerial to refMe's NSPropertyListSerialization
set ocidOption to refMe's NSPropertyListMutableContainersAndLeaves
set listPlistDict to ocidPlistSerial's propertyListWithData:(ocidReadTmpData) options:(ocidOption) format:(ocidXmlPlist) |error|:(reference)
if (item 2 of listPlistDict) is (missing value) then
  set ocidPlistDict to (item 1 of listPlistDict)
log "【7】正常終了"
else
log (item 2 of listPlistDict)'s localizedDescription() as text
return "【7】失敗しました"
end if

##########################################
### 【8】JSON初期化
(* NSJSONReadingOptions
(*1*)log refMe's NSJSONReadingMutableContainers as integer
(*2*)log refMe's NSJSONReadingMutableLeaves as integer
(*4*)log refMe's NSJSONReadingFragmentsAllowed as integer
(*8*)log refMe's NSJSONReadingJSON5Allowed as integer
(*16*)log refMe's NSJSONReadingTopLevelDictionaryAssumed as integer
*)
set listJSONSerialization to (refMe's NSJSONSerialization's dataWithJSONObject:(ocidPlistDict) options:(refMe's NSJSONReadingJSON5Allowed) |error|:(reference))
if (item 2 of listJSONSerialization) is (missing value) then
  set ocidJsonData to (item 1 of listJSONSerialization)
log "【8】正常終了"
else
log (item 2 of listJSONSerialization)'s localizedDescription() as text
return "【8】失敗しました"
end if


##########################################
####【9】保存
###保存先パスをURLを生成して
set ocidBaseFileURL to ocidFilePathURL's URLByDeletingPathExtension()
set ocidSaveFilePathURL to ocidBaseFileURL's URLByAppendingPathExtension:"json"
###保存
set ocidOption to (refMe's NSDataWritingAtomic)
set listDone to ocidJsonData's writeToURL:(ocidSaveFilePathURL) options:(ocidOption) |error|:(reference)
if (item 1 of listDone) is true then
log "【9】正常終了"
else if (item 1 of listDone) is false then
log (item 2 of listDone)'s localizedDescription() as text
return "【9】失敗しました"
end if

return "処理終了"

|

[Plist]Plistの値の変更 writeToURL:atomicallyが非推奨→ writeToURL:errorに変更


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

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

property refMe : a reference to current application

property refNSNotFound : a reference to 9.22337203685477E+18 + 5807


##########################################
###【1】ドキュメントのパス
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidLibraryDirPathURL to ocidURLsArray's firstObject()
set ocidPreferencesDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Preferences")
set ocidFilePathURL to ocidPreferencesDirPathURL's URLByAppendingPathComponent:("com.apple.finder.plist")
set strDateNo to doGetDateNo("yyyyMMdd") as text
set strSetValue to ("com.apple.finder." & strDateNo & ".plist")
set ocidBackupFilePathURL to ocidPreferencesDirPathURL's URLByAppendingPathComponent:(strSetValue)
#バックアップ作成
# set listDone to appFileManager's copyItemAtURL:(ocidFilePathURL) toURL:(ocidBackupFilePathURL) |error|:(reference)

#
##########################################
### 【2】PLISTを可変レコードとして読み込み
set listPlistDict to refMe's NSMutableDictionary's alloc()'s initWithContentsOfURL:(ocidFilePathURL) |error|:(reference)
set ocidPlistDict to (item 1 of listPlistDict)
##########################################
#設定する値
set listAddItem to {"com_apple_ats_name_postscript", "com_apple_ats_name_full", "com_apple_ats_name_family", "com_apple_ats_name_style", "com_apple_ats_name_fond"} as list

###【3】値の編集
set coidSlicesRootAttributesArray to ocidPlistDict's objectForKey:("SlicesRootAttributes")
###値がすでに設定済みでないか?確認して
repeat with itemList in listAddItem
  set boolContain to (coidSlicesRootAttributesArray's containsObject:(itemList))
  ##値がなければ追加
  if boolContain is false then
log "追加します"
    ##Arrayに追加
(coidSlicesRootAttributesArray's addObject:(itemList))
  end if
end repeat
##########################################
### 【4】保存
# writeToURL:atomically:がDeprecatedになったので
# writeToURL:error:を使います(macOS14対応)

set listDone to ocidPlistDict's writeToURL:(ocidFilePathURL) |error|:(reference)
if (item 1 of listDone) is true then
return "正常終了"
else if (item 1 of listDone) is false then
return "保存に失敗しました"
end if


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

|

[Plist]Plist まとめ



A:入力
B:編集
C:出力
D:備考


A:入力
1:DATA
[Plist]NSDATAを使って読み込む
https://quicktimer.cocolog-nifty.com/icefloe/2023/07/post-14ff50.html
2:Dict
[PLIST]値の取得 基本
https://quicktimer.cocolog-nifty.com/icefloe/2023/06/post-46307d.html
3:キーアーカイブ
セキュリティ上の理由もあるが
NSURL等 PLISTには保存できない形式も保存が可能
[基本]NSKeyedArchiver
https://quicktimer.cocolog-nifty.com/icefloe/cat76056161/index.html
NSKeyedUnarchiver
https://quicktimer.cocolog-nifty.com/icefloe/cat76055043/index.html
4:ファイルから
[PLIST]値の取得 基本 その1 plistを読み込んでPlistで保存
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-e591c4.html
[plutil]Plistのフォーマット変更(サービスメニュー用)
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-4fcfa5.html
5:JSON
[JSON]JSONの取扱 その1(rootがDict形式の場合
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-7ac684.html
[JSON]JSONの取扱 その2(rootがArray形式の場合)
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-0ed292.html
その他
https://quicktimer.cocolog-nifty.com/icefloe/cat76049735/index.html


B:編集
[PLIST]値の取得 基本
https://quicktimer.cocolog-nifty.com/icefloe/2023/06/post-46307d.html
1: /usr/bin/defaults
[Plist]defaults read
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-035836.html
[Plist]defaults write
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-8926ec.html
2: /usr/libexec/PlistBuddy
https://quicktimer.cocolog-nifty.com/icefloe/cat76027586/index.html
3: /usr/bin/plutil
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-892166.html
4: /usr/bin/xmllint
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-c9efbb.html
5: AppleScript System Events
https://quicktimer.cocolog-nifty.com/icefloe/cat76056176/index.html
6: AppleScript Oc
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-e591c4.html
7:Xcode
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-cdefb1.html
8:Visual Studio Code
https://quicktimer.cocolog-nifty.com/icefloe/2023/09/post-d25c0e.html


C:出力
NSDATA
writeToURL:options:error:
writeToURL:atomically: での保存になります
Plistはバイナリー形式が基本です。アクセスや読み込みが速いからかな?と思います
1:バイナリ

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

set ocidFormat to (refMe's NSPropertyListBinaryFormat_v1_0)
set ocidPlistData to refMe's NSPropertyListSerialization's dataWithPropertyList:("ここにDICTデータ") format:(ocidFormat) options:0 |error|:(reference)


2: XMLモバイルコンフィグ等XMLであった方が編集しやすい時は迷わずこちら

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

set ocidFormat to (refMe's NSPropertyListXMLFormat_v1_0)
set ocidPlistData to refMe's NSPropertyListSerialization's dataWithPropertyList:("ここにDICTデータ") format:(ocidFormat) options:0 |error|:(reference)


3:キーアーカイブ
[基本]NSKeyedArchiver 圧縮
https://quicktimer.cocolog-nifty.com/icefloe/cat76056161/index.html

カテゴリー 解凍 NSKeyedUnarchiver
https://quicktimer.cocolog-nifty.com/icefloe/cat76055043/index.html
4:JSON
https://quicktimer.cocolog-nifty.com/icefloe/cat76049735/index.html



D:備考
mobileconfigは中身はPLIST
[mobileconfig]AppleScriptでの処理の基本(再考)
https://quicktimer.cocolog-nifty.com/icefloe/2022/05/post-9dad8c.html
LSSharedFileListはキーアーカイブされたPLIST
AppleScript LSSharedFileList
https://quicktimer.cocolog-nifty.com/icefloe/cat76055054/index.html
検索条件を記録してあるsavedSearchもPLIST
[savedSearch]検索条件ファイルを作成する
https://quicktimer.cocolog-nifty.com/icefloe/2023/06/post-e476bb.html


[Webloc]ロケーションファイル(com.apple.generic-internet-location)もPLIST
インターネット・ロケーションファイルまとめ
https://quicktimer.cocolog-nifty.com/icefloe/cat76053046/index.html


plutil defaults PlistBuddyの文法の比較


#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
#
#plutil
STR_USR_LANG=$(/usr/bin/plutil -extract AppleLanguages.0 raw -expect string $HOME/Library/Preferences/.GlobalPreferences.plist ) 
/bin/echo "plutil:ユーザー設定の第1言語は $STR_USR_LANG です"
#defaults
STR_USR_LANG=$(/usr/bin/defaults read $HOME/Library/Preferences/.GlobalPreferences AppleLanguages| tr -d "[:space:][(][)]\""|cut -d , -f 1 )
/bin/echo "defaults:ユーザー設定の第1言語は $STR_USR_LANG です"
#PlistBuddy
STR_USR_LANG=$(/usr/libexec/PlistBuddy -c "Print:AppleLanguages:0" "$HOME/Library/Preferences/.GlobalPreferences.plist")
/bin/echo "PlistBuddy:ユーザー設定の第1言語は $STR_USR_LANG です"

exit 0




Serialization004_20231028110801


Screen-20231028-110332

|

[LSSharedFileList]Finderサイドバーのよく使う項目を追加する

20240312072816_1272x780

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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
(*
サーバーに接続の
よく使うサーバーを追加します
macOS14以降のsfl3版です
AirDrop
nwnode://domain-AirDrop
一部個別のスキームがあります

*)
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

#############################################
###設定項目
#############################################
###追加するディレクトリパス サンプルはダウンロードフォルダ
set strAddDirPath to ("~/Downloads") as text

###
set ocidAddDirPathStr to refMe's NSString's stringWithString:(strAddDirPath)
set ocidAddDirPath to ocidAddDirPathStr's stringByStandardizingPath()
set ocidAddDirPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidAddDirPath) isDirectory:false)
set strAddDirPath to ocidAddDirPathURL's absoluteString() as text

#######################################
##NSdataに読み込み Keyを解凍する
#######################################
set appFileManager to refMe's NSFileManager's defaultManager()
###処理するファイル名
set strFileName to "com.apple.LSSharedFileList.FavoriteItems.sfl3" as text
###URLに
set ocidURLArray to (appFileManager's URLsForDirectory:(refMe's NSApplicationSupportDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidAppSuppDirPathURL to ocidURLArray's firstObject()
set ocidContainerPathURL to (ocidAppSuppDirPathURL's URLByAppendingPathComponent:("com.apple.sharedfilelist") isDirectory:true)
set ocidSharedFileListURL to (ocidContainerPathURL's URLByAppendingPathComponent:(strFileName) isDirectory:false)
###NSDATAに読み込みます
set ocidPlistData to (refMe's NSData's dataWithContentsOfURL:(ocidSharedFileListURL))
### 解凍してDictに Flozenなので値を変更するために 可変に変えます
#NSKeyedUnarchiver's  OS13までの方式
# set ocidArchveDict to (refMe's NSKeyedUnarchiver's unarchiveObjectWithData:(ocidPlistData))
#NSKeyedUnarchiver's  OS14からの方式
set listResponse to refMe's NSKeyedUnarchiver's unarchivedObjectOfClass:((refMe's NSObject)'s class) fromData:(ocidPlistData) |error|:(reference)
set ocidArchveDict to (item 1 of listResponse)
### 可変Dictにセット
set ocidArchveDictM to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
(ocidArchveDictM's setDictionary:ocidArchveDict)

#######################################
### items の処理
#######################################
### items のArrayを取り出して Flozenなので値を変更するために 可変に変えます
set ocidItemsArray to (ocidArchveDictM's objectForKey:("items"))
### 項目入替用のArray 
set ocidItemsArrayM to (refMe's NSMutableArray's alloc()'s initWithCapacity:0)
(ocidItemsArrayM's setArray:ocidItemsArray)
set numCntArrayItem to count of ocidItemsArray
#######################################
### 値がすでにあるか?確認
set boolChkTagName to (missing value)
##################
###itemsの数だけ繰り返し
repeat with itemsArrayDict in ocidItemsArrayM
  ####
  set ocidBookMarkData to (itemsArrayDict's objectForKey:("Bookmark"))
  #BOOKMarkデータの解凍
  set listResponse to (refMe's NSURL's URLByResolvingBookmarkData:(ocidBookMarkData) options:(refMe's NSURLBookmarkResolutionWithoutUI) relativeToURL:(missing value) bookmarkDataIsStale:(missing value) |error|:(reference))
  set ocidBookMarkURL to (item 1 of listResponse)
  set strBookMarkPath to ocidBookMarkURL's absoluteString() as text
  ##
  if strAddDirPath is strBookMarkPath then
    ###値があった場合
    set boolChkTagName to true as boolean
    exit repeat
  else
    ###なかった場合
    set boolChkTagName to false as boolean
  end if
end repeat

#######################################
### 本処理項目の追加
#######################################

###なければ追加
if boolChkTagName is false then
  ######## 【1】項目追加用のDict
  set ocidAddDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
  ######## CustomItemProperties
  #【2】CustomItemProperties用のDICT
  set ocidCustomPropertiesDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
  # 0=true 1=false
  set ocidSetValue to (refMe's NSNumber's numberWithInteger:1)
ocidCustomPropertiesDict's setValue:(ocidSetValue) forKey:("com.apple.LSSharedFileList.ItemIsHidden")
  # 0=true 1=false
  set ocidSetValue to (refMe's NSNumber's numberWithInteger:0)
ocidCustomPropertiesDict's setValue:(ocidSetValue) forKey:("com.apple.finder.dontshowonreappearance")
  
  #【1】のDICTに追加
ocidAddDict's setObject:(ocidCustomPropertiesDict) forKey:("CustomItemProperties")
  ######## 追加用のDict root
  ## uuid
  set ocidUUID to refMe's NSUUID's alloc()'s init()
  set ocidUUIDString to ocidUUID's UUIDString()
ocidAddDict's setValue:(ocidUUIDString) forKey:("uuid")
  ## visibility
  set ocidVisibility to refMe's NSNumber's numberWithInteger:(0)
ocidAddDict's setValue:(ocidVisibility) forKey:("visibility")
  ## Bookmark
  set listBookMarkData to (ocidAddDirPathURL's bookmarkDataWithOptions:(11) includingResourceValuesForKeys:({missing value}) relativeToURL:(missing value) |error|:(reference))
  set ocidBookMarkData to (item 1 of listBookMarkData)
ocidAddDict's setObject:(ocidBookMarkData) forKey:("Bookmark")
  
  ##itemsのArrayに追加
ocidItemsArrayM's addObject:(ocidAddDict)
end if
### RootにItemsを追加
(ocidArchveDictM's setObject:(ocidItemsArrayM) forKey:("items"))

#######################################
### 値が新しくなった解凍済みDictをアーカイブする
#######################################
##NSKeyedArchiverに戻す OS13までの形式
# set listSaveData to (refMe's NSKeyedArchiver's archivedDataWithRootObject:(ocidArchveDictM) requiringSecureCoding:(true) |error|:(reference))
##NSKeyedArchiver OS14からの形式
set listSaveData to refMe's NSKeyedArchiver's archivedDataWithRootObject:(ocidArchveDictM) requiringSecureCoding:(false) |error|:(reference)
set ocidSaveData to item 1 of listSaveData

#######################################
### データを上書き保存する
#######################################
##保存
set listDone to ocidSaveData's writeToURL:(ocidSharedFileListURL) options:0 |error|:(reference)

#######################################
### リロード
#######################################
try
do shell script "/usr/bin/killall sharedfilelistd"
on error
  set strAgentPath to "/System/Library/LaunchAgents/com.apple.coreservices.sharedfilelistd.plist"
  set strCommandText to ("/bin/launchctl stop -w \"" & strAgentPath & "\"")
  try
do shell script strCommandText
  end try
  set strCommandText to ("/bin/launchctl start -w \"" & strAgentPath & "\"")
  try
do shell script strCommandText
  end try
end try
delay 0.5
## do shell script "/usr/bin/killall Finder"

return


|

より以前の記事一覧

その他のカテゴリー

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 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 Adobe Adobe FDKO 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 QR Barcode QR Decode 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 delimiters Desktop Device Diff Disk Dock DropBox Droplet eMail Encode % Encode Decode Encode UTF8 Error EXIFData ffmpeg File Finder Firefox Folder FolderAction Fonts GIF github Guide HTML HTML Entity Icon Illustrator Image Events Image2PDF ImageOptim iPhone iWork Javascript Jedit Json Label Leading Zero List locationd LRC lsappinfo LSSharedFileList 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 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 NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSPrintOperation 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 PDFAnnotation PDFAnnotationWidget PDFContext PDFDisplayBox PDFDocumentPermissions PDFImageRep PDFKit PDFnUP PDFOutline perl Photoshop PlistBuddy pluginkit 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 OPML XML Plist XML RSS XML savedSearch XML SVG XML TTML XML webloc XML XMP YouTube zoom