AppleScript CIImage

PDF417バーコードを生成する


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

#!/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 framework "AppKit"
use framework "CoreImage"
use scripting additions

property refMe : a reference to current application
property refNSNotFound : a reference to 9.22337203685477E+18 + 5807

#####################
### BarCodコード保存先 NSPicturesDirectory
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSPicturesDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidPicturesDirURL to ocidURLsArray's firstObject()
set ocidSaveDirPathURL to ocidPicturesDirURL's URLByAppendingPathComponent:("Barcode")
##フォルダ作成
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 listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
#####################
### ペーストボード初期化
set appPasteboard to refMe's NSPasteboard's generalPasteboard()
##ペーストボードからテキストを取り出す
set ocidStringData to appPasteboard's stringForType:("public.utf8-plain-text")
if ocidStringData is (missing value) then
  set strDefaultAnswer to "https://" as text
else
  set strDefaultAnswer to (refMe's NSString's stringWithString:(ocidStringData)) as text
end if
#####################
###ダイアログ
tell current application
  set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
set aliasIconPath to POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BookmarkIcon.icns" as alias
try
  set objResponse to (display dialog "URLを入力してください" with title "BarCodコードを作成します" default answer strDefaultAnswer buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 30 without hidden answer)
on error
log "エラーしました"
return
end try
if true is equal to (gave up of objResponse) then
return "時間切れですやりなおしてください"
end if
if "OK" is equal to (button returned of objResponse) then
  set strText to (text returned of objResponse) as text
else
return "キャンセル"
end if
#######
set ocidText to refMe's NSString's alloc()'s initWithString:(strText)
###改行とタブだけは取っておく
set ocidTextM to refMe's NSMutableString's alloc()'s initWithCapacity:(0)
ocidTextM's setString:(ocidText)
set ocidTextM to ocidTextM's stringByReplacingOccurrencesOfString:("\n") withString:("")
set ocidTextM to ocidTextM's stringByReplacingOccurrencesOfString:("\r") withString:("")
set ocidTextM to ocidTextM's stringByReplacingOccurrencesOfString:("\t") withString:("")
set strText to ocidTextM as text

if strText starts with "http" then
  set strBarCodContents to strText as text
  set ocidURL to refMe's NSURL's alloc()'s initWithString:(strBarCodContents)
  set strHostName to ocidURL's |host|() as text
else if strText starts with "mailto" then
  set strBarCodContents to strText as text
  set ocidURL to refMe's NSURL's alloc()'s initWithString:(strBarCodContents)
  set ocidComponent to refMe's NSURLComponents's componentsWithURL:(ocidURL) resolvingAgainstBaseURL:(false)
  set strHostName to ocidComponent's |path|() as text
else
  # return "【エラー】URL以外処理しません"
  set strBarCodContents to strText as text
end if
##############################


###保存ファイル名
set strDateNo to doGetDateNo({"yyyyMMddhhmmss", 1})
set strSaveFileName to (strDateNo & ".png") as text
set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName)
######################################
### 色決め 切り捨ての都合上指定のニア
######################################
tell application "Finder"
  set the listRGB16bitColor to (choose color default color {0, 0, 0, 1}) as list
end tell
##########Color Picker Value 16Bit
set numRcolor16Bit to item 1 of listRGB16bitColor as number
set numGcolor16Bit to item 2 of listRGB16bitColor as number
set numBcolor16Bit to item 3 of listRGB16bitColor as number
set numAcolor16Bit to 65535 as number
##########Standard RGB Value 8Bit
set numRcolor8Bit to numRcolor16Bit / 256 div 1 as number
set numGcolor8Bit to numGcolor16Bit / 256 div 1 as number
set numBcolor8Bit to numBcolor16Bit / 256 div 1 as number
set numAcolor8Bit to numAcolor16Bit / 256 div 1 as number
##########NSColorValue Float
set numRcolorFloat to numRcolor8Bit / 255 as number
set numGcolorFloat to numGcolor8Bit / 255 as number
set numBcolorFloat to numBcolor8Bit / 255 as number
set numAcolorFloat to numAcolor8Bit / 255 as number
####色指定
## 色指定値はこちらを利用
## https://quicktimer.cocolog-nifty.com/icefloe/2023/06/post-d68270.html
###色指定する場合
## set ocidBarColor to refMe's CIColor's colorWithRed:0.101960784314 green:0.752941176471 blue:0.262745098039 alpha:1.0
###
set ocidBarColor to refMe's CIColor's colorWithRed:(numRcolorFloat) green:(numGcolorFloat) blue:(numBcolorFloat) alpha:(numAcolorFloat)
#############################
### 【1】BarCodバーコード画像生成
#############################
####テキストをNSStringに
set ocidInputString to refMe's NSString's stringWithString:(strBarCodContents)
####テキストをUTF8に
set ocidUtf8InputString to ocidInputString's dataUsingEncoding:(refMe's NSUTF8StringEncoding)
####CIBarCodCodeGenerator初期化
set ocidBarCodeImage to refMe's CIFilter's filterWithName:("CIPDF417BarcodeGenerator")
ocidBarCodeImage's setDefaults()
###テキスト設定
ocidBarCodeImage's setValue:(ocidUtf8InputString) forKey:("inputMessage")
###読み取り誤差値設定L, M, Q, H
ocidBarCodeImage's setValue:(0.5) forKey:("inputCorrectionLevel")

#
ocidBarCodeImage's setValue:(0.5) forKey:("inputCompactionMode")
ocidBarCodeImage's setValue:(0) forKey:("inputAlwaysSpecifyCompaction")
ocidBarCodeImage's setValue:(1) forKey:("inputCompactStyle")
ocidBarCodeImage's setValue:(0) forKey:("inputCompactionMode")
ocidBarCodeImage's setValue:(12) forKey:("inputDataColumns")

ocidBarCodeImage's setValue:(96) forKey:("inputMaxHeight")
ocidBarCodeImage's setValue:(72) forKey:("inputMinHeight")

ocidBarCodeImage's setValue:(288) forKey:("inputMaxWidth")
ocidBarCodeImage's setValue:(72) forKey:("inputMinWidth")
ocidBarCodeImage's setValue:(0.0) forKey:("inputPreferredAspectRatio")
ocidBarCodeImage's setValue:(24) forKey:("inputRows")

###BarCodコード本体のイメージ
set ocidCIImage to ocidBarCodeImage's outputImage()

-->ここで生成されるのはBARのセルがw1pxの最小サイズ
##############
### 色の置き換え
### 置き換わる色=この場合は黒
set ocidBlackColor to refMe's CIColor's colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.0
###CIFalseColorで色を塗ります
set ocidFilterColor to refMe's CIFilter's filterWithName:("CIFalseColor")
ocidFilterColor's setDefaults()
ocidFilterColor's setValue:ocidBarColor forKey:("inputColor0")
ocidFilterColor's setValue:ocidBlackColor forKey:("inputColor1")
ocidFilterColor's setValue:ocidCIImage forKey:("inputImage")
###フィルタをかけた画像をoutputImageから取り出します
set ocidCIImage to ocidFilterColor's valueForKey:("outputImage")
###BarCodコードの縦横取得
set ocidCIImageDimension to ocidCIImage's extent()
set ocidCIImageWidth to (item 1 of item 2 of ocidCIImageDimension) as integer
set ocidCIImageHight to (item 2 of item 2 of ocidCIImageDimension) as integer
log ocidCIImageWidth
log ocidCIImageHight
###最終的に出力したいpxサイズ
set numScaleMax to 504
###整数で拡大しないとアレなので↑の値のニアなサイズになります
set numWidthScale to ((numScaleMax / ocidCIImageWidth) div 1) as integer
set numHightScale to ((ocidCIImageHight * numWidthScale) div 1) as integer
log numWidthScale
log numHightScale
###↑サイズの拡大縮小する場合はここで値を調整すれば良い
####変換スケール作成-->拡大
set recordScalse to refMe's CGAffineTransform's CGAffineTransformMakeScale(numWidthScale, numWidthScale)
##変換スケールを適応(元のサイズに元のサイズのスケール適応しても意味ないけど
set ocidCIImageScaled to ocidCIImage's imageByApplyingTransform:(recordScalse)

#######元のセルが1x1pxの最小サイズで出したいときはここで処理
##set ocidCIImageScaled to ocidCIImage
###イメージデータを展開
set ocidNSCIImageRep to refMe's NSCIImageRep's imageRepWithCIImage:(ocidCIImageScaled)
###出力用のイメージの初期化
set ocidNSImageScaled to refMe's NSImage's alloc()'s initWithSize:(ocidNSCIImageRep's |size|())
###イメージデータを合成
ocidNSImageScaled's addRepresentation:(ocidNSCIImageRep)
###出来上がったデータはOS_dispatch_data
set ocidOsDispatchData to ocidNSImageScaled's TIFFRepresentation()
####NSBitmapImageRepに
set ocidBarCodeImageRep to refMe's NSBitmapImageRep's imageRepWithData:(ocidOsDispatchData)
#set numBarCodeRepW to ocidBarCodeImageRep's pixelsWide as integer
#set numBarCodeRepH to ocidBarCodeImageRep's pixelsHigh as integer

#############################
### 【2】BarCodコードの背景部
###(ホワイトスペースパディング配慮)
#############################
##画像サイズ
set numBarCodeSizeW to 520 as integer
set numBarCodeSizeH to 180 as integer
##画像生成開始
set ocidBitmapFormat to refMe's NSBitmapFormatAlphaFirst
set ocidColorSpaceName to refMe's NSCalibratedRGBColorSpace
### NSBitmapImageRep
set ocidCodeBaseRep to (refMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:(numBarCodeSizeW) pixelsHigh:(numBarCodeSizeH) bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(ocidColorSpaceName) bitmapFormat:(ocidBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
#############################
### 初期化 CodeBase
refMe's NSGraphicsContext's saveGraphicsState()
###Context
set ocidContext to (refMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:(ocidCodeBaseRep))
###生成された画像でNSGraphicsContext初期化
(refMe's NSGraphicsContext's setCurrentContext:(ocidContext))
###ここが背景色の塗り色
##色を個別に指定する場合 値は0が暗 1が明
set ocidSetColor to (refMe's NSColor's colorWithSRGBRed:(1) green:(1) blue:(1) alpha:(1.0))
ocidSetColor's |set|()
###画像生成
refMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:(numBarCodeSizeW), height:(numBarCodeSizeH)}})
####画像作成終了
refMe's NSGraphicsContext's restoreGraphicsState()
#############################
### 【3】BarCodバーコードパディング処理
### 1で作ったBarCodバーコード画像を
### 2で作った画像にペースト
###(ホワイトスペースパディング配慮)
#############################
###
set numPxWidth to ocidBarCodeImageRep's pixelsWide()
set numPxHight to ocidBarCodeImageRep's pixelsHigh()
###画像合成位置計算パディング配慮
set numPadSize to (numBarCodeSizeW - numPxWidth) / 2 as integer
#############################
### 初期化 CodeBase
refMe's NSGraphicsContext's saveGraphicsState()
###Context
set ocidContext to (refMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:(ocidCodeBaseRep))
###生成された画像でNSGraphicsContext初期化
(refMe's NSGraphicsContext's setCurrentContext:(ocidContext))
###出来上がった画像にBarCodバーコードをCompositeSourceOverする
ocidBarCodeImageRep's drawInRect:{origin:{x:(numPadSize), y:(numPadSize)}, |size|:{width:(numPxWidth), Hight:(numPxHight)}} fromRect:{origin:{x:0, y:0}, |size|:{width:(numPxWidth), height:(numPxHight)}} operation:(refMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value)

####画像作成終了
refMe's NSGraphicsContext's restoreGraphicsState()
#############################
### 【4】最終的な出力画像生成
### ArtBoardになる画像の生成
#############################
### 背景 ARTBORD
set ocidBitmapFormat to refMe's NSBitmapFormatAlphaFirst
set ocidColorSpaceName to refMe's NSCalibratedRGBColorSpace
### NSBitmapImageRep
set ocidArtBoardRep to (refMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:(580) pixelsHigh:(360) bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(ocidColorSpaceName) bitmapFormat:(ocidBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
#############################
### 初期化 ArtBoard
refMe's NSGraphicsContext's saveGraphicsState()
###Context
set ocidContext to (refMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:(ocidArtBoardRep))
###生成された画像でNSGraphicsContext初期化
(refMe's NSGraphicsContext's setCurrentContext:(ocidContext))
###ここが背景色の塗り色
##色を個別に指定する場合 値は0が暗 1が明
set ocidSetColor to (refMe's NSColor's colorWithSRGBRed:(numRcolorFloat) green:(numGcolorFloat) blue:(numBcolorFloat) alpha:(numAcolorFloat))
## 透過の場合
## set ocidSetColor to refMe's NSColor's clearColor()
## 白
## set ocidSetColor to refMe's NSColor's whiteColor()
ocidSetColor's |set|()
###画像生成
refMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:(580), height:(680)}})
####画像作成終了
refMe's NSGraphicsContext's restoreGraphicsState()
#############################
### 【5】BarCodコードペースト
### 3で作ったパディング済みBarCodコードを
### 4で作ったArtBoardにペースト
#############################
### 初期化 バーコードを ocidArtBoardRep にペースト
refMe's NSGraphicsContext's saveGraphicsState()
###ビットマップイメージ
(refMe's NSGraphicsContext's setCurrentContext:(refMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:(ocidArtBoardRep)))
###画像合成位置計算
###左右位置センタリング
set numLeftPad to ((580 - numBarCodeSizeW) / 2) as integer
###左右のパディング幅と同じサイズで上部パディング
set numbottomPad to (680 - numBarCodeSizeW - numLeftPad)
###出来上がった画像にBarCodバーコードを左右3セル分ずらした位置にCompositeSourceOverする
ocidCodeBaseRep's drawInRect:{origin:{x:(numLeftPad), y:(numbottomPad)}, |size|:{width:numBarCodeSizeW, Hight:numBarCodeSizeH}} fromRect:{origin:{x:0, y:0}, |size|:{width:numBarCodeSizeW, height:numBarCodeSizeH}} operation:(refMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value)
####画像作成終了
refMe's NSGraphicsContext's restoreGraphicsState()
#############################
### 【6】テキスト描画
### 5で生成された画像に対して
### テキスト画像を描画する
#############################
###フォント初期化
set appFontManager to refMe's NSFontManager
set appSharedMaanager to appFontManager's sharedFontManager()
###設定用のレコード
set ocidTextAttr to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
###共通項目
set ocidStyle to refMe's NSParagraphStyle's defaultParagraphStyle
(ocidTextAttr's setObject:(ocidStyle) forKey:(refMe's NSParagraphStyleAttributeName))
###画像の明暗判定
set numColorBD to (numRcolorFloat + numGcolorFloat + numBcolorFloat + numAcolorFloat) as number
log numColorBD
if numColorBD > 3.5 then
  ##明るいバーコード色の時は文字色は黒
  set ocidTextColor to (refMe's NSColor's colorWithSRGBRed:(0) green:(0) blue:(0) alpha:(1.0))
(ocidTextAttr's setObject:(ocidTextColor) forKey:(refMe's NSForegroundColorAttributeName))
  ##文字色黒の時はドロップシャドウを入れる
  set ocidShadow to refMe's NSShadow's alloc()'s init()
  set ocidShadowColor to (ocidTextColor's colorWithAlphaComponent:0.8)
(ocidShadow's setShadowColor:(ocidShadowColor))
(ocidShadow's setShadowOffset:(refMe's NSMakeSize(1, -1)))
(ocidShadow's setShadowBlurRadius:4)
(ocidTextAttr's setObject:(ocidShadow) forKey:(refMe's NSShadowAttributeName))
else
  ##暗いバーコード色の時は文字色白
  set ocidTextColor to (refMe's NSColor's colorWithSRGBRed:(1) green:(1) blue:(1) alpha:(1.0))
(ocidTextAttr's setObject:(ocidTextColor) forKey:(refMe's NSForegroundColorAttributeName))
end if

#############################
###初期化
refMe's NSGraphicsContext's saveGraphicsState()
####NSGraphicsContextは透明アートボード
set ocidContext to (refMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:(ocidArtBoardRep))
###ArtBoardでNSGraphicsContext初期化
(refMe's NSGraphicsContext's setCurrentContext:(ocidContext))
##############
set ocidText to (refMe's NSString's stringWithString:("PDF417Barcode"))
##
set ocidFont to (refMe's NSFont's fontWithName:("Helvetica-Bold") |size|:(52))
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
(ocidTextAttr's setObject:(-1.8) forKey:(refMe's NSKernAttributeName))
set ocidTextOrigin to refMe's NSMakePoint((30), (45))
(ocidText's drawAtPoint:(ocidTextOrigin) withAttributes:(ocidTextAttr))
##############
###URLの文字数調べて
set numCntChar to ((count of (every character of strBarCodContents)) as list) as integer
###
set numFontSize to (round of (24 * (40 / numCntChar)) rounding down) as integer
(*
フォントサイズ24で半角40文字程度入るので
渡されたURLの文字数からフォントサイズを推定 小数点以下は切り捨て
*)
if numFontSize > 24 then
  set numFontSize to 24 as integer
end if
###
set ocidText to (refMe's NSString's stringWithString:(strBarCodContents))
# set ocidFont to (refMe's NSFont's fontWithName:("ヒラギノ角ゴシック W3") |size|:(numFontSize))
##
set ocidFont to (refMe's NSFont's fontWithName:("CourierNewPSMT") |size|:(numFontSize))
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
(ocidTextAttr's setObject:(-1) forKey:(refMe's NSKernAttributeName))
set ocidTextOrigin to refMe's NSMakePoint((35), (15))
(ocidText's drawAtPoint:(ocidTextOrigin) withAttributes:(ocidTextAttr))
(*
ここのキャラクターIDは
こちらを参照してください
https://quicktimer.cocolog-nifty.com/icefloe/cat76056068/index.html
*)
set strIconText to (character id 1049758) as text
set ocidText to (refMe's NSString's stringWithString:(strIconText))
set ocidFont to (refMe's NSFont's fontWithName:("SFPro-Bold") |size|:(72))
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
(ocidTextAttr's setObject:(0) forKey:(refMe's NSKernAttributeName))
set ocidTextOrigin to refMe's NSMakePoint((460), (30))
(ocidText's drawAtPoint:(ocidTextOrigin) withAttributes:(ocidTextAttr))



####画像作成終了
refMe's NSGraphicsContext's restoreGraphicsState()

#############################
### 【7】画像データ保存
### 6で生成された画像に対を
### 指定のフォルダに保存する
#############################
####PNG用の圧縮プロパティ
set ocidNSSingleEntryDictionary to refMe's NSDictionary's dictionaryWithObject:true forKey:(refMe's NSImageInterlaced)
#####出力イメージへ変換
set ocidNSInlineData to (ocidArtBoardRep's representationUsingType:(refMe's NSBitmapImageFileTypePNG) |properties|:ocidNSSingleEntryDictionary)
(*
NSBitmapImageFileTypeJPEG
NSBitmapImageFileTypePNG
NSBitmapImageFileTypeGIF
NSBitmapImageFileTypeBMP
NSBitmapImageFileTypeTIFF
NSBitmapImageFileTypeJPEG2000
*)
### 保存
set ocidOption to (refMe's NSDataWritingAtomic)
set boolDone to ocidNSInlineData's writeToURL:(ocidSaveFilePathURL) options:(ocidOption) |error|:(reference)
set aliasSaveFilePath to (ocidSaveFilePathURL's absoluteURL()) as alias

#############################
### 【8】表示
#############################
###Preview で開く
tell application "Preview"
launch
activate
open file aliasSaveFilePath
end tell
###
#####################
### Finderで保存先を開く
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set boolDone to appSharedWorkspace's selectFile:(ocidSaveFilePathURL's |path|()) inFileViewerRootedAtPath:(ocidSaveDirPathURL's |path|())

return true



################################
# 日付 doGetDateNo(argDateFormat,argCalendarNO)
# argCalendarNO 1 NSCalendarIdentifierGregorian 西暦
# argCalendarNO 2 NSCalendarIdentifierJapanese 和暦
################################
to doGetDateNo({argDateFormat, argCalendarNO})
  ##渡された値をテキストで確定させて
  set strDateFormat to argDateFormat as text
  set intCalendarNO to argCalendarNO as integer
  ###日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義(日本語)
  set ocidFormatterJP to current application's NSDateFormatter's alloc()'s init()
  ###和暦 西暦 カレンダー分岐
  if intCalendarNO = 1 then
    set ocidCalendarID to (current application's NSCalendarIdentifierGregorian)
  else if intCalendarNO = 2 then
    set ocidCalendarID to (current application's NSCalendarIdentifierJapanese)
  else
    set ocidCalendarID to (current application's NSCalendarIdentifierISO8601)
  end if
  set ocidCalendarJP to current application's NSCalendar's alloc()'s initWithCalendarIdentifier:(ocidCalendarID)
  set ocidTimezoneJP to current application's NSTimeZone's alloc()'s initWithName:("Asia/Tokyo")
  set ocidLocaleJP to current application's NSLocale's alloc()'s initWithLocaleIdentifier:("ja_JP_POSIX")
  ###設定
ocidFormatterJP's setTimeZone:(ocidTimezoneJP)
ocidFormatterJP's setLocale:(ocidLocaleJP)
ocidFormatterJP's setCalendar:(ocidCalendarJP)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterNoStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterShortStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterMediumStyle)
  # ocidFormatterJP's setDateStyle:(current application's NSDateFormatterLongStyle)
ocidFormatterJP's setDateStyle:(current application's NSDateFormatterFullStyle)
  ###渡された値でフォーマット定義
ocidFormatterJP's setDateFormat:(strDateFormat)
  ###フォーマット適応
  set ocidDateAndTime to ocidFormatterJP's stringFromDate:(ocidDate)
  ###テキストで戻す
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo


---URLエンコードのサブルーチン
####################################
###### %エンコード
####################################
on doUrlEncode(argText)
  ##テキスト
  set ocidArgText to refMe's NSString's stringWithString:(argText)
  ##キャラクタセットを指定
  set ocidChrSet to refMe's NSCharacterSet's URLQueryAllowedCharacterSet
  ##キャラクタセットで変換
  set ocidArgTextEncoded to ocidArgText's stringByAddingPercentEncodingWithAllowedCharacters:(ocidChrSet)
  ######## 置換 %エンコードの追加処理
  ###置換レコード
  set recordPercentMap to {|+|:"%2B", |=|:"%3D", |&|:"%26", |$|:"%24"} as record
  ###ディクショナリにして
  set ocidPercentMap to refMe's NSDictionary's alloc()'s initWithDictionary:(recordPercentMap)
  ###キーの一覧を取り出します
  set ocidAllKeys to ocidPercentMap's allKeys()
  ###取り出したキー一覧を順番に処理
  repeat with itemAllKey in ocidAllKeys
    ##キーの値を取り出して
    set ocidMapValue to (ocidPercentMap's valueForKey:(itemAllKey))
    ##置換
    set ocidEncodedText to (ocidArgTextEncoded's stringByReplacingOccurrencesOfString:(itemAllKey) withString:(ocidMapValue))
    ##次の変換に備える
    set ocidArgTextEncoded to ocidEncodedText
  end repeat
  ##テキスト形式に確定
  set strTextToEncode to ocidEncodedText as text
  ###値を戻す
return strTextToEncode
end doUrlEncode


|

画像のサイズを求める

AppleScriptだとより簡素であることから
NSimageを利用する方法がいいのかな?と

CIImage

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

#!/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 framework "CoreImage"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

on run
  
  set aliasIconPass to (POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/MultipleItemsIcon.icns") as alias
  set strDialogText to "ドロップしても利用できます"
  set strTitleText to "画像ファイルを選んでください"
  set listButton to {"ファイルを選びます", "キャンセル"} as list
display dialog strDialogText buttons listButton default button 1 cancel button 2 with title strTitleText with icon aliasIconPass giving up after 1 with hidden answer
  
  set aliasDefaultLocation to (path to desktop folder from user domain) as alias
  set listChooseFileUTI to {"public.png", "public.jpeg"}
  set strPromptText to "イメージファイルを選んでください" as text
  set strPromptMes to "イメージファイルを選んでください" as text
  set listAliasFilePath to (choose file strPromptMes with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with showing package contents, invisibles and multiple selections allowed) as list
  
  -->値をOpenに渡たす
open listAliasFilePath
end run


on open listAliasFilePath
  
  ##########################
  ####ファイルの数だけ繰り返し
  repeat with itemAliasFilePath in listAliasFilePath
    ####まずはUNIXパスにして
    set strFilePath to (POSIX path of itemAliasFilePath) as text
    set ocidFilePathStr to (refMe's NSString's stringWithString:(strFilePath))
    set ocidFilePath to ocidFilePathStr's stringByStandardizingPath
    set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath))
    
    #####################
    #### 本処理
    ####データ読み込み
    set ocidReadData to (refMe's NSImage's alloc()'s initWithContentsOfURL:(ocidFilePathURL))
    ####################################
    ##サイズ取得 pxサイズ
    set ocidCiImage to (refMe's CIImage's imageWithContentsOfURL:(ocidFilePathURL))
    set ocidPropertiesDict to ocidCiImage's |properties|
    set numPixelsWidth to (ocidPropertiesDict's valueForKey:("PixelWidth"))
    set numPixelsHeight to (ocidPropertiesDict's valueForKey:("PixelHeight"))
log numPixelsWidth as integer
log numPixelsHeight as integer
    
    
  end repeat
end open


NSIMAGE

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

#!/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 framework "CoreImage"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

on run
  
  set aliasIconPass to (POSIX file "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/MultipleItemsIcon.icns") as alias
  set strDialogText to "ドロップしても利用できます"
  set strTitleText to "画像ファイルを選んでください"
  set listButton to {"ファイルを選びます", "キャンセル"} as list
display dialog strDialogText buttons listButton default button 1 cancel button 2 with title strTitleText with icon aliasIconPass giving up after 1 with hidden answer
  
  set aliasDefaultLocation to (path to desktop folder from user domain) as alias
  set listChooseFileUTI to {"public.png", "public.jpeg"}
  set strPromptText to "イメージファイルを選んでください" as text
  set strPromptMes to "イメージファイルを選んでください" as text
  set listAliasFilePath to (choose file strPromptMes with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with showing package contents, invisibles and multiple selections allowed) as list
  
  -->値をOpenに渡たす
open listAliasFilePath
end run


on open listAliasFilePath
  
  ##########################
  ####ファイルの数だけ繰り返し
  repeat with itemAliasFilePath in listAliasFilePath
    ####まずはUNIXパスにして
    set strFilePath to (POSIX path of itemAliasFilePath) as text
    set ocidFilePathStr to (refMe's NSString's stringWithString:(strFilePath))
    set ocidFilePath to ocidFilePathStr's stringByStandardizingPath
    set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath))
    
    #####################
    #### 本処理
    ####データ読み込み
    set ocidReadData to (refMe's NSImage's alloc()'s initWithContentsOfURL:(ocidFilePathURL))
    ####################################
    ##サイズ取得 Ptサイズ
    #【A】レコードとして取得する
    set recordReadImageSize to ocidReadData's |size|()
    set numPtWidth to (width of recordReadImageSize)
    set numPtHeight to (height of recordReadImageSize)
log numPtWidth as number
log numPtHeight as number
    # 【B】NSConcreteValueとして取得する
    set ocidReadImageSize to ocidReadData's |size|
    #NSConcreteValueの中身によってValue形式を指定する
    set recordReadImageSize to ocidReadImageSize's sizeValue()
    set numPtWidth to (width of recordReadImageSize)
    set numPtHeight to (height of recordReadImageSize)
log numPtWidth as number
log numPtHeight as number
    ####################################
    ##サイズ取得 pxサイズ
    set ocidBmpImageRepArray to ocidReadData's representations()
    set ocidReadImageRep to ocidBmpImageRepArray's firstObject()
    ##
    set numPixelsWidth to ocidReadImageRep's pixelsWide()
    set numPixelsHeight to ocidReadImageRep's pixelsHigh()
log numPixelsWidth as integer
log numPixelsHeight as integer
    
  end repeat
end open


|

[CIImage] QRバーコードのデコード

#!/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

set objFileManager to refMe's NSFileManager's defaultManager()

###################################
#####ダイアログ
###################################a
###ダイアログのデフォルト
set ocidUserDesktopPath to (objFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set aliasDefaultLocation to ocidUserDesktopPath as alias
tell application "Finder"
    ##    set aliasDefaultLocation to container of (path to me) as alias
end tell
set listChooseFileUTI to {"public.image"}
set strPromptText to "QRコードファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and showing package contents without multiple selections allowed) as list
###################################
#####パス処理
###################################
###エリアス
set aliasFilePath to item 1 of listAliasFilePath as alias
###UNIXパス
set strFilePath to POSIX path of aliasFilePath as text
###String
set ocidFilePath to refMe's NSString's stringWithString:strFilePath
###NSURL
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
####ファイル名を取得
set ocidFileName to ocidFilePathURL's lastPathComponent()
####拡張子を取得
set ocidFileExtension to ocidFilePathURL's pathExtension()
####ファイル名から拡張子を取っていわゆるベースファイル名を取得
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
####コンテナ
set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()

###################################
#####保存ダイアログ
###################################
###ファイル名
set strPrefixName to ocidPrefixName as text
###拡張子
###同じ拡張子の場合
##set strFileExtension to ocidFileExtension as text
###拡張子変える場合
set strFileExtension to "txt"
###ダイアログに出すファイル名
set strDefaultName to (strPrefixName & ".output." & strFileExtension) as text
set strPromptText to "名前を決めてください"
###選んだファイルの同階層をデフォルト
set aliasDefaultLocation to ocidContainerDirPathURL as alias
####ファイル名ダイアログ
####実在しない『はず』なのでas «class furl»
set aliasSaveFilePath to (choose file name default location aliasDefaultLocation default name strDefaultName with prompt strPromptText) as «class furl»
####UNIXパス
set strSaveFilePath to POSIX path of aliasSaveFilePath as text
####ドキュメントのパスをNSString
set ocidSaveFilePath to refMe's NSString's stringWithString:strSaveFilePath
####ドキュメントのパスをNSURLに
set ocidSaveFilePathURL to refMe's NSURL's fileURLWithPath:ocidSaveFilePath
###拡張子取得
set strFileExtensionName to ocidSaveFilePathURL's pathExtension() as text
###ダイアログで拡張子を取っちゃった時対策
if strFileExtensionName is not strFileExtension then
    set ocidSaveFilePathURL to ocidSaveFilePathURL's URLByAppendingPathExtension:strFileExtension
end if

###################################
##### イメージファイル読み込み 
###################################
####CIDetectorを定義
set ocidDetector to refMe's CIDetector's detectorOfType:(refMe's CIDetectorTypeQRCode) context:(missing value) options:{CIDetectorAccuracy:(refMe's CIDetectorAccuracyHigh)}
####CIイメージに読み込み
set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:ocidFilePathURL options:(missing value))
####格納用の可変Array
set ocidFeaturesArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
#####ocidDetectorを通して結果をArrayに格納
set ocidFeaturesArray to ocidDetector's featuresInImage:ocidCiImageInput
#####シングルArrayなので1コ目のデータが読み取り結果
set ocidIQRCodeFeature to item 1 of ocidFeaturesArray
#####読み取り結果のテキスト
set ocidQrCodeMessageString to ocidIQRCodeFeature's messageString()


###################################
##### テキストファイルに書き出し
###################################
set boolFileWrite to (ocidQrCodeMessageString's writeToURL:ocidSaveFilePathURL atomically:false encoding:(refMe's NSUTF8StringEncoding) |error|:(reference))


###################################
##### ダイアログ
###################################
set aliasIconPath to POSIX file "/System/Library/CoreServices/Applications/Wireless Diagnostics.app/Contents/Resources/AppIcon.icns" as alias
set strDefaultAnswer to ocidQrCodeMessageString as text
try
    set recordResponse to (display dialog "コピーしてください" with title "QRコード読み取り結果" default answer strDefaultAnswer buttons {"OK", "キャンセル"} default button "OK" cancel button "キャンセル" with icon aliasIconPath giving up after 30 without hidden answer)
    
on error
    log "エラーしました"
    return "エラーしました"
    error number -128
end try
if true is equal to (gave up of recordResponse) then
    return "時間切れですやりなおしてください"
    error number -128
end if
if "OK" is equal to (button returned of recordResponse) then
    set theResponse to (text returned of recordResponse) as text
else
    log "エラーしました"
    return "エラーしました"
    error number -128
end if



|

[CIImage]画像のリサイズ

#!/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 listChooseFileUTI : {"public.png", "public.jpeg"}
property numScaleMaxWidth : 720

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

###################################
#####スクリーンキャプチャーの保存先
###################################

####設定ファイルのパス
set strFilePath to "~/Library/Preferences/com.apple.screencapture.plist" as text
set ocidFilePathStr to refMe's NSString's stringWithString:strFilePath
set ocidFilePath to ocidFilePathStr's stringByStandardizingPath
set ocidFilePathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath isDirectory:false
#####PLISTの内容を読み込んで
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
set listReadPlistData to refMe's NSMutableDictionary's dictionaryWithContentsOfURL:ocidFilePathURL |error|:(reference)
set ocidPlistDict to item 1 of listReadPlistData
#####保存先を調べる
set ocidValue to ocidPlistDict's valueForKey:"location"
#####設定されていない場合はデスクトップがデフォルト
if ocidValue is (missing value) then
    set strLocationPath to "~/Desktop" as text
    set ocidLocationPathStr to refMe's NSString's stringWithString:strLocationPath
    set ocidLocationPath to ocidLocationPathStr's stringByStandardizingPath
    set ocidLocationPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidLocationPath isDirectory:false
else
    #####設定されている場合は設定先のパス
    set ocidLocationPath to ocidValue's stringByStandardizingPath
    set ocidLocationPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:ocidLocationPath isDirectory:true
end if
set ocidPlistDict to ""
#####
###################################
#####ダイアログ
###################################
set aliasDefaultLocation to ocidLocationPathURL as alias
set strPromptText to "ファイルを選んでください" as text
set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultLocation) of type listChooseFileUTI with invisibles and multiple selections allowed without showing package contents)

repeat with objAliasFilePath in listAliasFilePath
    set strFilePath to POSIX path of objAliasFilePath as text
    set ocidFilePath to (refMe's NSString's stringWithString:strFilePath)
    set itemImageFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:ocidFilePath)
    
    ###################################
    ##### 幅を揃えてリサイズする
    ###################################
    (*
    Base Script 
    https://www.macscripter.net/t/resizing-an-image/73317
    
    *)
    ###種別判定用に拡張子取得
    set ocidExtensionName to itemImageFilePathURL's pathExtension()
    set ocidExtensionName to ocidExtensionName's lowercaseString()
    set strExtensionName to ocidExtensionName as text
    ####ファイルをCIイメージで読み込み
    set ocidCiImageInput to (refMe's CIImage's imageWithContentsOfURL:itemImageFilePathURL options:(missing value))
    ###ファイルのサイズを調べる
    set ocidInputDimension to ocidCiImageInput's extent()
    ####幅の値を取得
    set numImageWidth to (item 1 of (item 2 of ocidInputDimension)) as integer
    ####リサイズする指数
    set numResizeScale to (numScaleMaxWidth / numImageWidth)
    ####Transform指定
    set recordCiImageData to (ocidCiImageInput's imageTransformForOrientation:(refMe's kCGImagePropertyOrientationUp))
    ####Transform適応
    set ocidCiImageData to (ocidCiImageInput's imageByApplyingTransform:recordCiImageData)
    ####リサイズする指数でリサイズ
    set ocidCiFilterData to (refMe's CIFilter's filterWithName:"CILanczosScaleTransform" withInputParameters:{inputImage:ocidCiImageData, inputScale:numResizeScale, inputAspectRatio:1.0})
    #####リサイズ済みイメージ
    set ocidResizedCiImage to ocidCiFilterData's outputImage()
    #####NSBitmapImageRepに変換して
    set ocidResizedImagePep to (refMe's NSBitmapImageRep's alloc()'s initWithCIImage:ocidResizedCiImage)
    
    if strExtensionName is "png" then
        ####PNGの保存オプション
        set recordSaveProperties to {NSImageInterlaced:true}
        ####PNG変換
        set ocidOsDispatchData to (ocidResizedImagePep's representationUsingType:(refMe's NSBitmapImageFileTypePNG) |properties|:recordSaveProperties)
        ####上書き保存
        set boolResults to (ocidOsDispatchData's writeToURL:itemImageFilePathURL atomically:true)
    else
        ####JPGの保存オプション
        set ocidSavePropertiesDict to (refMe's NSDictionary's alloc()'s initWithDictionary:{NSImageCompressionFactor:1, NSImageProgressive:false})
        ####JPG変換
        set ocidOsDispatchData to (ocidResizedImagePep's representationUsingType:(refMe's NSBitmapImageFileTypeJPEG) |properties|:ocidSavePropertiesDict)
        ####上書き保存
        set boolResults to (ocidOsDispatchData's writeToURL:itemImageFilePathURL atomically:true)
    end if
    
    if boolResults is true then
        log "処理OK"
    else
        log "処理NGなのでそのままにする"
        set boolResults to (ocidImageFilePathURL's setResourceValue:6 forKey:(refMe's NSURLLabelNumberKey) |error|:(reference))
        log "失敗ラベル赤を塗る"
    end if
    set ocidImageData to ""
    set ocidResizedImagePep to ""
    set ocidOsDispatchData to ""
end repeat

|

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom