AppleScript Fonts

フォントの文字イメージを画像に出力します(少し変更した)

ダウンロード - font2imagepy2.zip


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
(*
com.cocolog-nifty.quicktimer.icefloe
v2少し手を入れた
OSにインストールしていないフォントでも描画できます
*)
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use framework "UniformTypeIdentifiers"
use scripting additions

property refMe : a reference to current application

on run
  ## python3のパスチェック
  if (doChkPython3()) is false then
return "python3が見つかりませんでした終了します"
  end if
  ## pythonスクリプトのパス
  set strPyFileName to ("Font2Image.py") as text
  set ocidPyFilePathURL to doGetScriptPath(strPyFileName)
  if ocidPyFilePathURL is false then
return "pythonスクリプトが見つかりませんでした処理を終了します"
  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 appFileManager to refMe's NSFileManager's defaultManager()
  # NSLocalDomainMask NSUserDomainMask NSSystemDomainMask
  set ocidDirPathURLArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
  set ocidDirPathURL to ocidDirPathURLArray's firstObject()
  set ocidFontsDirPathURL to ocidDirPathURL's URLByAppendingPathComponent:("Fonts")
  set aliasFontsDirPath to (ocidFontsDirPathURL's absoluteURL()) as alias
  
  set listChooseFileUTI to {"public.font"}
  set strPromptText to "fontファイルを選んでください" as text
  set listAliasFilePath to (choose file with prompt strPromptText default location (aliasFontsDirPath) of type listChooseFileUTI with invisibles and multiple selections allowed without showing package contents) as list
open listAliasFilePath
end run


on open listAliasFilePath
  ########################
  ##python3のパスチェック
  if (doChkPython3()) is false then
return "python3が見つかりませんでした終了します"
  end if
  ########################
  ## pythonスクリプトのパス
  set strPyFileName to ("Font2Image.py") as text
  set ocidPyFilePathURL to doGetScriptPath(strPyFileName)
  if ocidPyFilePathURL is false then
return "pythonスクリプトが見つかりませんでした処理を終了します"
  else
    set strPyFilePath to (ocidPyFilePathURL's |path|) as text
  end if
  ##
  set listOkUTI to {"public.opentype-font", "public.truetype-ttf-font", "public.truetype-collection-font", "public.opentype-collection-font"} as list
  set ocidUTIarray to refMe's NSArray's arrayWithArray:(listOkUTI)
  ########################
  ##ファイルチェック
  repeat with itemAliasFilePath in listAliasFilePath
    set aliasFilePath to itemAliasFilePath 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 alloc()'s initFileURLWithPath:(ocidFilePath))
    set listResourceValue to (ocidFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLContentTypeKey) |error|:(reference))
    set ocidContentType to (item 2 of listResourceValue)
    set strUTI to (ocidContentType's identifier) as text
    set boolContain to (ocidUTIarray's containsObject:(strUTI))
    if boolContain is true then
log "対象フォントです"
    else
return "対象外のファイルです処理を中止します"
    end if
  end repeat
  
  ########################
  ## クリップボードの中身取り出し
  set appPasteboard to refMe's NSPasteboard's generalPasteboard()
  set ocidPastBoardTypeArray to appPasteboard's types
  ###テキストがあれば
  set boolContain to ocidPastBoardTypeArray's containsObject:"public.utf8-plain-text"
  if boolContain = true then
    ###値を格納する
    tell application "Finder"
      set strReadString to (the clipboard as text) as text
    end tell
    ###Finderでエラーしたら
  else
    set boolContain to ocidPastBoardTypeArray's containsObject:"NSStringPboardType"
    if boolContain = true then
      set ocidReadString to ocidPasteboard's readObjectsForClasses:({refMe's NSString}) options:(missing value)
      set strReadString to ocidReadString as text
    else
log "テキストなし"
      set strReadString to "ABCDEFGHIJKLMNOPQRSTUVWXYZ" as text
    end if
  end if
  ###ダイアログ
  set strName to (name of current application) as text
  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/Tips.app/Contents/Resources/AppIcon.icns") as alias
  set strTitle to ("入力してください") as text
  set strMes to ("印字するテキストを入力半角20文字まで\r欧文フォントに日本語入れると〓になります") as text
  set recordResult to (display dialog strMes with title strTitle default answer strReadString buttons {"キャンセル", "OK"} default button "OK" cancel button "キャンセル" giving up after 30 with icon aliasIconPath without hidden answer)
  if (gave up of recordResult) is true then
return "時間切れです"
  else if (button returned of recordResult) is "キャンセル" then
return "キャンセルです"
  else
    set strReturnedText to (text returned of recordResult) as text
  end if
  ###戻り値整形
  set ocidResponseText to (refMe's NSString's stringWithString:(strReturnedText))
  ###タブと改行を除去しておく
  set ocidTextM to refMe's NSMutableString's alloc()'s initWithCapacity:(0)
ocidTextM's appendString:(ocidResponseText)
  ##改行除去
  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 strReturnedText to ocidTextM as text
  ###############################
  ## 背景色
  ###############################
  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 the listRGB16bitColor to (choose color default color {65535, 55535, 0, 0}) as list
  set numRcolor16Bit to (item 1 of listRGB16bitColor) as integer
  set numGcolor16Bit to (item 2 of listRGB16bitColor) as integer
  set numBcolor16Bit to (item 3 of listRGB16bitColor) as integer
  #
  set numRcolorFloat to (numRcolor16Bit / 65535) as number
  set numGcolorFloat to (numGcolor16Bit / 65535) as number
  set numBcolorFloat to (numBcolor16Bit / 65535) as number
  #
  set numRcolor8Bit to (round of (numRcolorFloat * 255) rounding down) as integer
  set numGcolor8Bit to (round of (numGcolorFloat * 255) rounding down) as integer
  set numBcolor8Bit to (round of (numBcolorFloat * 255) rounding down) as integer
  #
  set numRHex to getHex(numRcolor8Bit) as text
  set numGHex to getHex(numGcolor8Bit) as text
  set numBHex to getHex(numBcolor8Bit) as text
  
  set strBackgroundColorHex to ("" & numRHex & numGHex & numBHex & "") as text
  ###############################
  ## 文字色
  ###############################
  set the listRGB16bitColor to (choose color default color {0, 0, 0, 0}) as list
  set numRcolor16Bit to (item 1 of listRGB16bitColor) as integer
  set numGcolor16Bit to (item 2 of listRGB16bitColor) as integer
  set numBcolor16Bit to (item 3 of listRGB16bitColor) as integer
  #
  set numRcolorFloatText to (numRcolor16Bit / 65535) as number
  set numGcolorFloatText to (numGcolor16Bit / 65535) as number
  set numBcolorFloatText to (numBcolor16Bit / 65535) as number
  
  set numRcolor8BitText to (round of (numRcolorFloatText * 255) rounding down) as integer
  set numGcolor8BitText to (round of (numGcolorFloatText * 255) rounding down) as integer
  set numBcolor8BitText to (round of (numBcolorFloatText * 255) rounding down) as integer
  #
  set numRHexText to getHex(numRcolor8BitText) as text
  set numGHexText to getHex(numGcolor8BitText) as text
  set numBHexText to getHex(numBcolor8BitText) as text
  
  set strTextColorHex to ("" & numRHexText & numGHexText & numBHexText & "") as text
  
  ########################
  set appFileManager to refMe's NSFileManager's defaultManager()
  ## 保存先
  set ocidDirPathURLArray to (appFileManager's URLsForDirectory:(refMe's NSPicturesDirectory) inDomains:(refMe's NSUserDomainMask))
  set ocidDirPathURL to ocidDirPathURLArray's firstObject()
  set ocidSaveDirPathURL to ocidDirPathURL's URLByAppendingPathComponent:("FontsImages/images")
  set strSaveDirPathURL to (ocidSaveDirPathURL's |path|) as text
  ##保存先確保
  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)
  
  repeat with itemAliasFilePath in listAliasFilePath
    set aliasFilePath to itemAliasFilePath as alias
    set strFontFilePath to (POSIX path of aliasFilePath) as text
    ## pyパス arg1:フォントファイルパス arg2:保存先Dir arg3:印字するテキスト
    set strCommandText to ("\"" & strPyFilePath & "\" \"" & strFontFilePath & "\" \"" & strSaveDirPathURL & "\" \"" & strReturnedText & "\" \"" & strBackgroundColorHex & "\" \"" & strTextColorHex & "\"") as text
do shell script strCommandText
    
  end repeat
  
  ####################
  ## HTMLを生成
doMakeFolderImage2HTML(ocidSaveDirPathURL)
  ##Finderで保存先を開く
  set aliasSaveDirPath to (ocidSaveDirPathURL's absoluteURL()) as alias
  tell application "Finder"
open location aliasSaveDirPath
  end tell
end open

####################
## pythonスクリプトのパス
to doGetScriptPath(argFileName)
  set strPyFileName to argFileName as text
  tell application "Finder"
    set aliasPathToMe to (path to me) as alias
    set aliasContainerDirPath to (container of aliasPathToMe) as alias
  end tell
  #
  set strContainerDirPath to (POSIX path of aliasContainerDirPath) as text
  set ocidContainerDirPathStr to refMe's NSString's stringWithString:(strContainerDirPath)
  set ocidContainerDirPath to ocidContainerDirPathStr's stringByStandardizingPath()
  set ocidContainerDirPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidContainerDirPath) isDirectory:true)
  #
  set strSetValue to ("bin/" & strPyFileName) as text
  set ocidPyFilePathURL to ocidContainerDirPathURL's URLByAppendingPathComponent:(strSetValue)
  #有無チェック
  set ocidPyFilePath to ocidPyFilePathURL's |path|
  set appFileManager to refMe's NSFileManager's defaultManager()
  set boolExists to appFileManager's fileExistsAtPath:(ocidPyFilePath) isDirectory:(false)
log boolExists
  if boolExists is true then
return ocidPyFilePathURL
  else if boolExists is false then
return false
  end if
  
end doGetScriptPath
####################
## python3のパスチェック
to doChkPython3()
  try
    set strCmdText to ("/usr/bin/which python3") as text
    set strBinPath to (do shell script strCmdText) as text
return true
  on error
return false
  end try
  
  
end doChkPython3


####################
##カラー HEX値を求める

property record8Bit2Hex : {|0|:"00", |1|:"01", |2|:"02", |3|:"03", |4|:"04", |5|:"05", |6|:"06", |7|:"07", |8|:"08", |9|:"09", |10|:"0A", |11|:"0B", |12|:"0C", |13|:"0D", |14|:"0E", |15|:"0F", |16|:"10", |17|:"11", |18|:"12", |19|:"13", |20|:"14", |21|:"15", |22|:"16", |23|:"17", |24|:"18", |25|:"19", |26|:"1A", |27|:"1B", |28|:"1C", |29|:"1D", |30|:"1E", |31|:"1F", |32|:"20", |33|:"21", |34|:"22", |35|:"23", |36|:"24", |37|:"25", |38|:"26", |39|:"27", |40|:"28", |41|:"29", |42|:"2A", |43|:"2B", |44|:"2C", |45|:"2D", |46|:"2E", |47|:"2F", |48|:"30", |49|:"31", |50|:"32", |51|:"33", |52|:"34", |53|:"35", |54|:"36", |55|:"37", |56|:"38", |57|:"39", |58|:"3A", |59|:"3B", |60|:"3C", |61|:"3D", |62|:"3E", |63|:"3F", |64|:"40", |65|:"41", |66|:"42", |67|:"43", |68|:"44", |69|:"45", |70|:"46", |71|:"47", |72|:"48", |73|:"49", |74|:"4A", |75|:"4B", |76|:"4C", |77|:"4D", |78|:"4E", |79|:"4F", |80|:"50", |81|:"51", |82|:"52", |83|:"53", |84|:"54", |85|:"55", |86|:"56", |87|:"57", |88|:"58", |89|:"59", |90|:"5A", |91|:"5B", |92|:"5C", |93|:"5D", |94|:"5E", |95|:"5F", |96|:"60", |97|:"61", |98|:"62", |99|:"63", |100|:"64", |101|:"65", |102|:"66", |103|:"67", |104|:"68", |105|:"69", |106|:"6A", |107|:"6B", |108|:"6C", |109|:"6D", |110|:"6E", |111|:"6F", |112|:"70", |113|:"71", |114|:"72", |115|:"73", |116|:"74", |117|:"75", |118|:"76", |119|:"77", |120|:"78", |121|:"79", |122|:"7A", |123|:"7B", |124|:"7C", |125|:"7D", |126|:"7E", |127|:"7F", |128|:"80", |129|:"81", |130|:"82", |131|:"83", |132|:"84", |133|:"85", |134|:"86", |135|:"87", |136|:"88", |137|:"89", |138|:"8A", |139|:"8B", |140|:"8C", |141|:"8D", |142|:"8E", |143|:"8F", |144|:"90", |145|:"91", |146|:"92", |147|:"93", |148|:"94", |149|:"95", |150|:"96", |151|:"97", |152|:"98", |153|:"99", |154|:"9A", |155|:"9B", |156|:"9C", |157|:"9D", |158|:"9E", |159|:"9F", |160|:"A0", |161|:"A1", |162|:"A2", |163|:"A3", |164|:"A4", |165|:"A5", |166|:"A6", |167|:"A7", |168|:"A8", |169|:"A9", |170|:"AA", |171|:"AB", |172|:"AC", |173|:"AD", |174|:"AE", |175|:"AF", |176|:"B0", |177|:"B1", |178|:"B2", |179|:"B3", |180|:"B4", |181|:"B5", |182|:"B6", |183|:"B7", |184|:"B8", |185|:"B9", |186|:"BA", |187|:"BB", |188|:"BC", |189|:"BD", |190|:"BE", |191|:"BF", |192|:"C0", |193|:"C1", |194|:"C2", |195|:"C3", |196|:"C4", |197|:"C5", |198|:"C6", |199|:"C7", |200|:"C8", |201|:"C9", |202|:"CA", |203|:"CB", |204|:"CC", |205|:"CD", |206|:"CE", |207|:"CF", |208|:"D0", |209|:"D1", |210|:"D2", |211|:"D3", |212|:"D4", |213|:"D5", |214|:"D6", |215|:"D7", |216|:"D8", |217|:"D9", |218|:"DA", |219|:"DB", |220|:"DC", |221|:"DD", |222|:"DE", |223|:"DF", |224|:"E0", |225|:"E1", |226|:"E2", |227|:"E3", |228|:"E4", |229|:"E5", |230|:"E6", |231|:"E7", |232|:"E8", |233|:"E9", |234|:"EA", |235|:"EB", |236|:"EC", |237|:"ED", |238|:"EE", |239|:"EF", |240|:"F0", |241|:"F1", |242|:"F2", |243|:"F3", |244|:"F4", |245|:"F5", |246|:"F6", |247|:"F7", |248|:"F8", |249|:"F9", |250|:"FA", |251|:"FB", |252|:"FC", |253|:"FD", |254|:"FE", |255|:"FF"} as record
to getHex(arg8BitNum)
  set ocid8Bit2HexDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocid8Bit2HexDict's setDictionary:(record8Bit2Hex)
  set str8BitNum to arg8BitNum as string
  set ocidValue to (ocid8Bit2HexDict's valueForKey:(str8BitNum))
  set strValue to ocidValue as text
return strValue
end getHex

to doMakeFolderImage2HTML(argDirPathURL)
  ####################################
  ####フォルタ以外は処理しない
  
  set ocidDirPathURL to argDirPathURL
  set listBoole to (ocidDirPathURL's getResourceValue:(reference) forKey:(refMe's NSURLIsDirectoryKey) |error|:(reference))
  set boolIsDir to (item 2 of listBoole) as boolean
  if boolIsDir is true then
log "フォルダなので処理開始"
  else
return "フォルダ以外は処理しない"
  end if
  
  
  ################################
  ##【本処理】フォルダの数だけ繰り返し
  ################################
  ###enumeratorAtURL用のBoolean用
  set ocidFalse to (refMe's NSNumber's numberWithBool:false)
  set ocidTrue to (refMe's NSNumber's numberWithBool:true)
  
  ###ファイルURLのみを格納するリスト
  set ocidFilePathURLAllArray to (refMe's NSMutableArray's alloc()'s initWithCapacity:0)
  ##################################
  #ファイルURLの収集
  ##プロパティ
  set ocidPropertieKeyArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
ocidPropertieKeyArray's addObject:(refMe's NSURLPathKey)
ocidPropertieKeyArray's addObject:(refMe's NSURLContentTypeKey)
  ##オプション(隠しファイルは含まない)
  set ocidOption to refMe's NSDirectoryEnumerationSkipsHiddenFiles
  ####ディレクトリのコンテツを収集(最下層まで)
  set appFileManager to refMe's NSFileManager's defaultManager()
  set ocidEmuDict to (appFileManager's enumeratorAtURL:(ocidDirPathURL) includingPropertiesForKeys:(ocidPropertieKeyArray) options:(ocidOption) errorHandler:(reference))
  ###戻り値をリストに格納
  set ocidEmuFileURLArray to ocidEmuDict's allObjects()
ocidFilePathURLAllArray's addObjectsFromArray:(ocidEmuFileURLArray)
  
  ##############################
  ####並び替え並び替え compare
  (*
compare:
caseInsensitiveCompare:
localizedCompare:
localizedStandardCompare:
localizedCaseInsensitiveCompare:
*)
  #NSSortDescriptor's
  set ocidSortDescriptorsArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
  set ocidSortDescriptor to (refMe's NSSortDescriptor's sortDescriptorWithKey:"absoluteString" ascending:(true) selector:"localizedStandardCompare:")
ocidSortDescriptorsArray's addObject:(ocidSortDescriptor)
  ##
ocidFilePathURLAllArray's sortUsingDescriptors:(ocidSortDescriptorsArray)
  ##############################
  ##まずはHTMLの基本的部分を生成
  ########################################
  #headerに渡すエレメント
  set ocidH3Element to refMe's NSXMLElement's elementWithName:("h3")
(ocidH3Element's setStringValue:("イメージ一覧"))
  
  ########################################
  #footerに渡すエレメント
  set ocidFotterAElement to refMe's NSXMLElement's elementWithName:("a")
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("href") stringValue:("https://quicktimer.cocolog-nifty.com/"))
(ocidFotterAElement's addAttribute:(ocidAddNode))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("target") stringValue:("_blank"))
(ocidFotterAElement's addAttribute:(ocidAddNode))
  set strContents to ("AppleScriptで生成しました") as text
(ocidFotterAElement's setStringValue:(strContents))
  
  ########################################
  #articleに渡すエレメント
  set ocidSetArticleElement to refMe's NSXMLElement's elementWithName:("div")
  set ocidH6Element to refMe's NSXMLElement's elementWithName:("h6")
(ocidH6Element's setStringValue:("イメージ一覧"))
ocidSetArticleElement's addChild:(ocidH6Element)
  #テーブル部生成開始
  set ocidTableElement to refMe's NSXMLElement's elementWithName:("table")
  #####【caption】
  set ocidCaptionElement to refMe's NSXMLElement's elementWithName:("caption")
ocidCaptionElement's setStringValue:("イメージファイル一覧(クリックで新しいWINDOWで開きます)")
ocidTableElement's addChild:(ocidCaptionElement)
  #####【colgroup】
  set ocidColgroupElement to refMe's NSXMLElement's elementWithName:("colgroup")
  #タイトル部の数だけ繰り返し
  set listColName to {"LineNo", "Image"} as list
  repeat with itemColName in listColName
    #######【col】col生成
    set ocidAddElement to (refMe's NSXMLElement's elementWithName:("col"))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(itemColName))
(ocidAddElement's addAttribute:(ocidAddNode))
(ocidColgroupElement's addChild:(ocidAddElement))
  end repeat
  #テーブルエレメントに追加
ocidTableElement's addChild:(ocidColgroupElement)
  #######【thead】
  set ocidTheadElement to refMe's NSXMLElement's elementWithName:("thead")
  #TR
  set ocidTrElement to refMe's NSXMLElement's elementWithName:("tr")
  #タイトル部の数だけ繰り返し
  repeat with itemColName in listColName
    if (itemColName as text) is "LineNo" then
      #ここはTDではなくてTHを利用
      set ocidAddElement to (refMe's NSXMLElement's elementWithName:("th"))
      ####項番処理
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(itemColName))
(ocidAddElement's addAttribute:(ocidAddNode))
      #
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("id") stringValue:(itemColName))
(ocidAddElement's addAttribute:(ocidAddNode))
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
(ocidAddElement's addAttribute:(ocidAddNode))
      #値を入れる
(ocidAddElement's setStringValue:("\"))
      #TH→TRにセット
(ocidTrElement's addChild:(ocidAddElement))
    else
      #ここはTDではなくてTHを利用
      set ocidAddElement to (refMe's NSXMLElement's elementWithName:("th"))
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(itemColName))
(ocidAddElement's addAttribute:(ocidAddNode))
      #
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("id") stringValue:(itemColName))
(ocidAddElement's addAttribute:(ocidAddNode))
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
(ocidAddElement's addAttribute:(ocidAddNode))
      #値を入れる
(ocidAddElement's setStringValue:(itemColName))
      #TH→TRにセット
(ocidTrElement's addChild:(ocidAddElement))
    end if
  end repeat
  #TRをTHEADにセット
ocidTheadElement's addChild:(ocidTrElement)
  #THEADをテーブルにセット
ocidTableElement's addChild:(ocidTheadElement)
  
  ##################################
  #本処理
  ######【tbody】
  set ocidTbodyElement to refMe's NSXMLElement's elementWithName:("tbody")
  set numCntRow to 1 as integer
  repeat with itemArray in ocidFilePathURLAllArray
    #TRの開始
    set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr"))
    ####項番処理
    set ocidThElement to (refMe's NSXMLElement's elementWithName:("th"))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("項目番号:" & numCntRow))
(ocidThElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("headers") stringValue:("LineNo"))
(ocidThElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
(ocidThElement's addAttribute:(ocidAddNode))
(ocidThElement's setStringValue:(numCntRow as text))
(ocidTrElement's addChild:(ocidThElement))
    ##################################
    set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
    ####
    #一つ上の階層を基準とした相対パスにする
    ##コンテナ
    set ocidPreDirPathURL to itemArray's URLByDeletingLastPathComponent()
    set ocidContainerName to ocidPreDirPathURL's lastPathComponent()
    set ocidFileName to itemArray's lastPathComponent()
    
    set ocidRelativePath to (ocidContainerName's stringByAppendingPathComponent:(ocidFileName))
    ###
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(ocidFileName))
(ocidTdElement's addAttribute:(ocidAddNode))
    # set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("headers") stringValue:(ocidFileName))
    #(ocidTdElement's addAttribute:(ocidAddNode))
    # set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
    # (ocidTdElement's addAttribute:(ocidAddNode))
    ###
    set ocidAElement to (refMe's NSXMLElement's elementWithName:("a"))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("href") stringValue:(ocidRelativePath))
(ocidAElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("target") stringValue:("_blank"))
(ocidAElement's addAttribute:(ocidAddNode))
    ###
    set ocidImgElement to (refMe's NSXMLElement's elementWithName:("img"))
(ocidImgElement's addAttribute:(refMe's NSXMLNode's attributeWithName:("src") stringValue:(ocidRelativePath)))
(ocidImgElement's addAttribute:(refMe's NSXMLNode's attributeWithName:("alt") stringValue:(ocidFileName)))
(ocidImgElement's addAttribute:(refMe's NSXMLNode's attributeWithName:("style") stringValue:("object-fit: cover;")))
(ocidAElement's addChild:(ocidImgElement))
    #
(ocidTdElement's addChild:(ocidAElement))
    ##
(ocidTrElement's addChild:(ocidTdElement))
(ocidTbodyElement's addChild:(ocidTrElement))
    set numCntRow to numCntRow + 1 as integer
  end repeat
  #TBODYをテーブルにセット
ocidTableElement's addChild:(ocidTbodyElement)
  
  
  ######【tfoot】 TRで
  set ocidTfootElement to refMe's NSXMLElement's elementWithName:("tfoot")
  set ocidTrElement to refMe's NSXMLElement's elementWithName:("tr")
  #項目数を取得して
  set numCntCol to (count of listColName) as integer
  #colspan指定して1行でセット
  set ocidThElement to (refMe's NSXMLElement's elementWithName:("th"))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("テーブルの終わり"))
(ocidThElement's addAttribute:(ocidAddNode))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("colspan") stringValue:(numCntCol as text))
(ocidThElement's addAttribute:(ocidAddNode))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("row"))
(ocidThElement's addAttribute:(ocidAddNode))
  #
  set numCntContents to (count of ocidFilePathURLAllArray) as integer
  set strContents to ("項目数 : " & (numCntContents)) as text
(ocidThElement's setStringValue:(strContents))
  #THをTRにセットして
ocidTrElement's addChild:(ocidThElement)
  #TRをTFOOTにセット
ocidTfootElement's addChild:(ocidTrElement)
  #TFOOTをテーブルにセット
ocidTableElement's addChild:(ocidTfootElement)
ocidSetArticleElement's addChild:(ocidTableElement)
  ##############################
  #HTMLにする
  ##############################
  set ocidHTML to doMakeRootElement({ocidH3Element, ocidSetArticleElement, ocidFotterAElement})
  ##############################
  #保存
  ##############################
  #読み取りやすい表示
  set ocidXMLdata to ocidHTML's XMLDataWithOptions:(refMe's NSXMLNodePrettyPrint)
  #
  set ocidSaveDirPathURL to ocidDirPathURL's URLByDeletingLastPathComponent()
  #
  set strSaveFileName to ("index.html") as text
  set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(strSaveFileName)
  
  set listDone to ocidXMLdata's writeToURL:(ocidSaveFilePathURL) options:(refMe's NSDataWritingAtomic) |error|:(reference)
  
  ####【6】ブラウザで開く
  ##デフォルトブラウザで開く場合
  (*
set aliasFilePath to (ocidSaveFilePathURL's absoluteURL()) as alias
tell application "Finder"
open location aliasFilePath
end tell
*)
  
  set aliasHTMLFilePath to (ocidSaveFilePathURL's absoluteURL()) as alias
  
  tell application "Finder"
open location aliasHTMLFilePath
  end tell
  
end doMakeFolderImage2HTML

############################################################
# 基本的なHTMLの構造
(*
doMakeRootElement({argHeaderContents, argArticleContents, argFooterContents})
HTMLのBODY部
header
article
footerにそれぞれAddchildするデータをリストで渡す
戻り値はRootエレメントにセットされた
NSXMLDocumentを戻すので 保存すればOK
*)
############################################################
to doMakeRootElement({argHeaderContents, argArticleContents, argFooterContents})
  #XML初期化
  set ocidXMLDoc to refMe's NSXMLDocument's alloc()'s init()
ocidXMLDoc's setDocumentContentKind:(refMe's NSXMLDocumentHTMLKind)
  # DTD付与
  set ocidDTD to refMe's NSXMLDTD's alloc()'s init()
ocidDTD's setName:("html")
ocidXMLDoc's setDTD:(ocidDTD)
  #
  set ocidRootElement to refMe's NSXMLElement's elementWithName:("html")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("lang") stringValue:("ja")
ocidRootElement's addAttribute:(ocidAddNode)
  #
  set ocidHeadElement to refMe's NSXMLElement's elementWithName:("head")
  #
  set ocidAddElement to refMe's NSXMLElement's elementWithName:("title")
ocidAddElement's setStringValue:("ImageList")
ocidHeadElement's addChild:(ocidAddElement)
  # http-equiv
  set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("http-equiv") stringValue:("Content-Type")
ocidAddElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("text/html; charset=UTF-8")
ocidAddElement's addAttribute:(ocidAddNode)
ocidHeadElement's addChild:(ocidAddElement)
  #
  set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("name") stringValue:("viewport")
ocidAddElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("width=720")
ocidAddElement's addAttribute:(ocidAddNode)
ocidHeadElement's addChild:(ocidAddElement)
  #
  set ocidAddElement to refMe's NSXMLElement's elementWithName:("style")
ocidAddElement's setStringValue:("body {margin: 10px;background-color: #FFFFFF;}table {max-width: 1280px;border-spacing: 0;caption-side: top;font-family: system-ui;}thead th {border: solid 1px #666666;padding: .5ch 1ch;border-block-width: 1px 0;border-inline-width: 1px 0;&:first-of-type {border-start-start-radius: .5em}&:last-of-type {border-start-end-radius: .5em;border-inline-end-width: 1px}}tbody th {border-spacing: 0;width: 40px !important;border: solid 1px #666666;padding: .5ch 1ch;border-block-width: 1px 0;border-inline-width: 1px 0;}tbody td {word-wrap: break-word;width: 720px;max-width: 720px;border-spacing: 0;border: solid 1px #666666;padding: .5ch 1ch;border-block-width: 1px 0;border-inline-width: 1px 0;&:last-of-type {border-inline-end-width: 1px}}tbody tr:nth-of-type(odd) {background: #F2F2F2;}.kind_string {font-size: 0.75em;}.date_string {font-size: 0.5em;}tfoot th {border: solid 1px #666666;padding: .5ch 1ch;&:first-of-type {border-end-start-radius: .5em}&:last-of-type {border-end-end-radius: .5em;border-inline-end-width: 1px}}img {max-width: 720px;}")
ocidHeadElement's addChild:(ocidAddElement)
ocidRootElement's addChild:(ocidHeadElement)
  #
  #ボディエレメント
  set ocidBodyElement to refMe's NSXMLElement's elementWithName:("body")
  #ヘッダー
  set ocidHeaderElement to refMe's NSXMLElement's elementWithName:("header")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("header")
ocidHeaderElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_header")
ocidHeaderElement's addAttribute:(ocidAddNode)
ocidHeaderElement's addChild:(argHeaderContents)
ocidBodyElement's addChild:(ocidHeaderElement)
  #アーティクル
  set ocidArticleElement to refMe's NSXMLElement's elementWithName:("article")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("article")
ocidArticleElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_article")
ocidArticleElement's addAttribute:(ocidAddNode)
ocidArticleElement's addChild:(argArticleContents)
  
ocidBodyElement's addChild:(ocidArticleElement)
  #フッター
  set ocidFooterElement to refMe's NSXMLElement's elementWithName:("footer")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("footer")
ocidFooterElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_footer")
ocidFooterElement's addAttribute:(ocidAddNode)
ocidFooterElement's addChild:(argFooterContents)
ocidBodyElement's addChild:(ocidFooterElement)
  #ボディをROOTエレメントにセット
ocidRootElement's addChild:(ocidBodyElement)
  #ROOTをXMLにセット
ocidXMLDoc's setRootElement:(ocidRootElement)
  #値を戻す
return ocidXMLDoc
end doMakeRootElement

|

[Python]FontのName要素を全て取得する(仮)


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
(*
com.cocolog-nifty.quicktimer.icefloe

Dutch Type LibraryのOTMasterで取得できる
NameID 情報『のみ』を取得出来るのを目指したが
処理時間がかかりすぎるため挫折した

Font NameID 詳細資料
https://learn.microsoft.com/en-us/typography/opentype/spec/name

フォントのNameIDを取得して
値をHTMLに出力します

Pythonのパッケージ fonttoolをインストールします
インストールしたくない方は実行しないでください

最後に選択したファイルのディレクトリを設定ファイルとして保持します
設定ファイルは以下のディレクトリに保存します
$HOME/Library/Application Support/com.cocolog-nifty.quicktimer

出力のHTMLはユーザーの書類フォルダ内に保存します
$HOME/Documents/Library/Fonts/FontInfo

v2
保存ファイル名をpostscript名に変更しました
v3
Pythonのインストールチェックは初回実行時のみに変更

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

property refMe : a reference to current application
property refBundleID : "com.cocolog-nifty.quicktimer.getFontInfoPy" as text
property listUTI : {"public.opentype-font", "public.truetype-ttf-font", "public.truetype-collection-font", "public.opentype-collection-font"} as list
property refNSNotFound : a reference to 9.22337203685477E+18 + 5807
########################
##RUN
########################
on run
  ####################
  #前回の設定を読み出す
  set listReturn to doGetDefDirURL()
  set ocidDefaultDirPathURL to (item 1 of listReturn)
  set aliasDefaultDirPath to (ocidDefaultDirPathURL's absoluteURL()) as alias
  set strBinPath to (item 2 of listReturn) as text
  ####################
  ###Pythonイストールチェック
  if strBinPath is ("missing value") then
    set listReturn to doChkPython3()
    set boolDone to (item 1 of listReturn) as boolean
    set strBinPath to (item 2 of listReturn) as text
    if boolDone is false then
return "Pythonパッケージのインストールに失敗しました"
    else if strBinPath is ("missing value") then
return "Pythonがインストールされていません"
    end if
  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 listChooseFileUTI to {"public.font"}
  set strPromptText to "fontファイルを選んでください" as text
  set listAliasFilePath to (choose file with prompt strPromptText default location (aliasDefaultDirPath) of type listChooseFileUTI with invisibles and multiple selections allowed without showing package contents) as list
  ####################
  ###戻り値の最初の1つ
  set aliasChooseFilePath to (item 1 of listAliasFilePath) as alias
  set strChooseFilePath to (POSIX path of aliasChooseFilePath) as text
  set ocidChooseFilePathStr to refMe's NSString's stringWithString:(strChooseFilePath)
  set ocidChooseFilePath to ocidChooseFilePathStr's stringByStandardizingPath()
  set ocidChooseFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidChooseFilePath) isDirectory:false)
  set ocidLastDirPathURL to ocidChooseFilePathURL's URLByDeletingLastPathComponent()
  ####################
  #設定を書き込み
  set boolDone to doWriteDefDirURL(ocidLastDirPathURL, strBinPath)
  if boolDone is false then
log "設定の書き込みに失敗しました"
  end if
  ####################
  set listReturnOpen to {listAliasFilePath, strBinPath} as list
  #選択したファイルをOpenに渡す
open listReturnOpen
end run

########################
##OPEN
########################
on open listReturnOpen
  set listAliasFilePath to (item 1 of listReturnOpen) as list
  set strBinPath to (item 2 of listReturnOpen) as text
  ########################
  ##python3イストールチェック
  if strBinPath is ("missing value") then
    set listReturn to doChkPython3()
    set boolDone to (item 1 of listReturn) as boolean
    set strBinPath to (item 2 of listReturn) as text
    if refReturn is false then
return "Pythonパッケージのインストールに失敗しました"
    else if strBinPath is ("missing value") then
    else
      set strBinPath to refReturn as text
      #set strBinPath to ("/usr/bin/python3") as text
    end if
  end if
  
  ########################
  ##対象ファイルだけにする
  set ocidFilePathArray to doMakeProcessingArray(listAliasFilePath)
  ########################################
  ## 本処理
  ########################################
  ##ファイルの数だけ繰り返し
  repeat with itemFilePath in ocidFilePathArray
    #ファイル名
    set ocidFileName to itemFilePath's lastPathComponent()
    #テキストパス
    set strFilePath to itemFilePath as text
    #拡張子による分岐
    set ocidExtensionName to itemFilePath's pathExtension()
    set strExtension to (ocidExtensionName's lowercaseString) as text
    #戻り値格納用
    if ("ttf otf") contains strExtension then
log "単体フォントファイルです"
      ##フォント情報を取得する
      set ocidFontToolsDict to doGetFontInfoDicTTF(strFilePath, strBinPath)
      ##フォント情報を元にHTMLを生成する
      set listResponse to doMakeFontInfoHtml(ocidFontToolsDict, strFilePath, 0)
    else if ("otc ttc") contains strExtension then
log "コレクションフォントです"
      ##同封されている書体数を数えて
      set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(len(TTCollection('" & strFilePath & "').fonts));\"") as text
      set numCntFont to (do shell script strCommandText) as integer
      repeat with itemTTCNo from 0 to (numCntFont - 1) by 1
        set ocidFontToolsDict to doGetFontInfoDicTTC(strFilePath, strBinPath, itemTTCNo)
        ##フォント情報を元にHTMLを生成する
        set listResponse to doMakeFontInfoHtml(ocidFontToolsDict, strFilePath, itemTTCNo)
      end repeat
    end if
  end repeat
  #HTMLの保存先を開く
  set aliasSaveDirPath to ((item 2 of listResponse)'s absoluteURL()) as alias
  tell application "Finder"
open location aliasSaveDirPath
  end tell
  
end open

########################
##本処理ファンクション
########################
to doMakeFontInfoHtml(argFontToolsDict, argFilePath, argTTCNo)
  ########################
  ##入力パス
  ########################
  set strFilePath to argFilePath 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)
  set ocidFileName to ocidFilePathURL's lastPathComponent()
  ########################
  ##言語コードレコード
  ########################
  set recordWinLangID to {|1025|:"ar-SA", |1069|:"eu-ES", |1026|:"bg-BG", |1027|:"ca-ES", |3076|:"zh-HK", |2052|:"zh-CN", |1028|:"zh-TW", |1050|:"hr-HR", |1029|:"cs-CZ", |1030|:"da-DK", |1043|:"nl-NL", |1033|:"en-US", |2057|:"en-GB", |1061|:"et-EE", |1035|:"fi-FI", |3084|:"fr-CA", |1036|:"fr-FR", |1110|:"gl-ES", |1031|:"de-DE", |1032|:"el-GR", |1037|:"he-IL", |1038|:"hu-HU", |1057|:"id-ID", |1040|:"it-IT", |1041|:"ja-JP", |1042|:"ko-KR", |1062|:"lv-LV", |1063|:"lt-LT", |1044|:"nb-NO", |1045|:"pl-PL", |1046|:"pt-BR", |2070|:"pt-PT", |1048|:"ro-RO", |1049|:"ru-RU", |1051|:"sk-SK", |1060|:"sl-SI", |2058|:"es-MX", |3082|:"es-ES", |1053|:"sv-SE", |1054|:"th-TH", |1055|:"tr-TR", |1058|:"uk-UA", |1066|:"vi-VN"} as record
  set ocidWinLangIDDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
(ocidWinLangIDDict's setDictionary:(recordWinLangID))
  
  set recordMacLangID to {|0|:"en", |1|:"fr", |2|:"de", |3|:"it", |4|:"nl", |5|:"sv", |6|:"es", |7|:"da", |8|:"pt", |9|:"no", |10|:"he", |11|:"ja", |12|:"ar", |13|:"fi", |14|:"el", |15|:"is", |16|:"mt", |17|:"tr", |18|:"hr", |19|:"zh-Hant", |20|:"ur", |21|:"hi", |22|:"th", |23|:"ko", |24|:"lt", |25|:"pl", |26|:"hu", |27|:"es", |28|:"lv", |29|:"se", |30|:"fo", |31|:"fa", |32|:"ru", |33|:"zh", |34|:"nl-BE", |35|:"ga", |36|:"sq", |37|:"ro", |38|:"cz", |39|:"sk", |40|:"sl", |41|:"yi", |42|:"sr", |43|:"mk", |44|:"bg", |45|:"uk", |46|:"be", |47|:"uz", |48|:"kk", |49|:"az-Cyrl", |50|:"az-Arab", |51|:"hy", |52|:"ka", |53|:"mo", |54|:"ky", |55|:"tg", |56|:"tk", |57|:"mn-CN", |58|:"mn", |59|:"ps", |60|:"ks", |61|:"ku", |62|:"sd", |63|:"bo", |64|:"ne", |65|:"sa", |66|:"mr", |67|:"bn", |68|:"as", |69|:"gu", |70|:"pa", |71|:"or", |72|:"ml", |73|:"kn", |74|:"ta", |75|:"te", |76|:"si", |77|:"my", |78|:"km", |79|:"lo", |80|:"vi", |81|:"id", |82|:"tl", |83|:"ms", |84|:"ms-Arab", |85|:"am", |86|:"ti", |87|:"om", |88|:"so", |89|:"sw", |90|:"rw", |91|:"rn", |92|:"ny", |93|:"mg", |94|:"eo", |128|:"cy", |129|:"eu", |130|:"ca", |131|:"la", |132|:"qu", |133|:"gn", |134|:"ay", |135|:"tt", |136|:"ug", |137|:"dz", |138|:"jv", |139|:"su", |140|:"gl", |141|:"af", |142|:"br", |143|:"iu", |144|:"gd", |145|:"gv", |146|:"ga", |147|:"to", |148|:"el-polyton", |149|:"kl", |150|:"az", |151|:"nn"} as record
  set ocidMacLangIDDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
(ocidMacLangIDDict's setDictionary:(recordMacLangID))
  
  #namelDとコメントのレコード
  set recordNameID to {|0|:"著作権", |1|:"フォントファミリ", |2|:"サブファミリ", |3|:"識別子", |4|:"フォント名", |5|:"バージョン", |6|:"PostScript名", |7|:"商標", |8|:"メーカー名", |9|:"デザイナー", |10|:"説明", |11|:"URL", |12|:"デザイナーURL", |13|:"ライセンス", |14|:"ライセンスURL", |15|:"未使用", |16|:"Preferredファミリー名", |17|:"Preferredサブファミリー名", |18|:"互換フォント名", |19|:"サンプルテキスト", |20|:"PostScriptCIDフォント名", |21|:"WWS太幅斜型ファミリ名", |22|:"WWS太幅斜型サブファミリ名", |23|:"CPALLカラーライト", |24|:"CPALDカラーダーク", |25|:"MultipleMaster名", |26|:"DebugPostScriptName"} as record
  set ocidNameIDDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
(ocidNameIDDict's setDictionary:(recordNameID))
  
  #MacEnc
  set recordMacEnc to {|0|:"Roman", |1|:"Japanese", |2|:"Chinese (Traditional)", |3|:"Korean", |4|:"Arabic", |5|:"Hebrew", |6|:"Greek", |7|:"Russian", |8|:"RSymbol", |9|:"Devanagari", |10|:"Gurmukhi", |11|:"Gujarati", |12|:"Odia", |13|:"Bangla", |14|:"Tamil", |15|:"Telugu", |16|:"Kannada", |17|:"Malayalam", |18|:"Sinhalese", |19|:"Burmese", |20|:"Khmer", |21|:"Thai", |22|:"Laotian", |23|:"Georgian", |24|:"Armenian", |25|:"Chinese (Simplified)", |26|:"Tibetan", |27|:"Mongolian", |28|:"Geez", |29|:"Slavic", |30|:"Vietnamese", |31|:"Sindhi", |32|:"Uninterpreted"} as record
  set ocidMacEncDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
(ocidMacEncDict's setDictionary:(recordNameID))
  #WinEnc
  set recordWinEnc to {|0|:"Symbol", |1|:"Unicode BMP", |2|:"ShiftJIS", |3|:"PRC", |4|:"Big5", |5|:"Wansung", |6|:"Johab", |7|:"Reserved", |8|:"Reserved", |9|:"Reserved", |10|:"Unicode full"} as record
  set ocidWinEncDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
(ocidWinEncDict's setDictionary:(recordNameID))
  
  ########################
  ##HTML生成開始
  ########################
  ##Header に渡すエレメント
  set ocidSetHeaderElement to (refMe's NSXMLElement's elementWithName:("div"))
  set ocidH3Element to (refMe's NSXMLElement's elementWithName:("h3"))
  set strSetValue to ("フォント情報: " & ocidFileName) as text
(ocidH3Element's setStringValue:(strSetValue))
(ocidSetHeaderElement's addChild:(ocidH3Element))
  ########################
  #footerに渡すエレメント
  set ocidSetFooterElement to (refMe's NSXMLElement's elementWithName:("div"))
  set ocidAElement to (refMe's NSXMLElement's elementWithName:("a"))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("href") stringValue:("https://quicktimer.cocolog-nifty.com/"))
(ocidAElement's addAttribute:(ocidAddNode))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("target") stringValue:("_blank"))
(ocidAElement's addAttribute:(ocidAddNode))
  set strSetValue to ("AppleScriptで生成しました") as text
(ocidAElement's setStringValue:(strSetValue))
(ocidSetFooterElement's addChild:(ocidAElement))
  ########################
  #Articleに渡すエレメント
  set ocidSetArticleElement to (refMe's NSXMLElement's elementWithName:("div"))
  set ocidH3Element to (refMe's NSXMLElement's elementWithName:("h3"))
  set strSetValue to ("フォント情報一覧: " & argFilePath) as text
(ocidH3Element's setStringValue:(strSetValue))
(ocidSetArticleElement's addChild:(ocidH3Element))
  ##################################
  #テーブル部生成開始
  set ocidTableElement to (refMe's NSXMLElement's elementWithName:("table"))
  ##################################
  #ファイル名にPs名を利用
  set ocidPostScriptName to (argFontToolsDict's valueForKey:("26,0,0,0"))
  if ocidPostScriptName = (missing value) then
    set ocidPostScriptName to ocidFileName
  end if
  #####【caption】
  set ocidCaptionElement to (refMe's NSXMLElement's elementWithName:("caption"))
(ocidCaptionElement's setStringValue:("fonttoolで取得した:" & (ocidPostScriptName as text) & "のNameID情報"))
(ocidTableElement's addChild:(ocidCaptionElement))
  ##################################
  #####【colgroup】
  set ocidColgroupElement to (refMe's NSXMLElement's elementWithName:("colgroup"))
  set listColName to {"#", "namelD", "platformiD", "encodingiD", "languagelD", "nameString", "Comment"}
  repeat with itemColName in listColName
    #######【col】col生成
    set ocidAddElement to (refMe's NSXMLElement's elementWithName:("col"))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(itemColName))
(ocidAddElement's addAttribute:(ocidAddNode))
(ocidColgroupElement's addChild:(ocidAddElement))
  end repeat
  #テーブルエレメントに追加
(ocidTableElement's addChild:(ocidColgroupElement))
  ##################################
  #######【thead】
  set ocidTheadElement to (refMe's NSXMLElement's elementWithName:("thead"))
  set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr"))
  repeat with itemColName in listColName
    #TH
    set ocidAddElement to (refMe's NSXMLElement's elementWithName:("th"))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(itemColName))
(ocidAddElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("id") stringValue:(itemColName))
(ocidAddElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
(ocidAddElement's addAttribute:(ocidAddNode))
(ocidAddElement's setStringValue:(itemColName))
(ocidTrElement's addChild:(ocidAddElement))
  end repeat
(ocidTheadElement's addChild:(ocidTrElement))
(ocidTableElement's addChild:(ocidTheadElement))
  ##################################
  #フォント情報のキーの一覧
  set ocidAllKey to argFontToolsDict's allKeys()
  #並び替え
  set ocidSortedAllKeys to ocidAllKey's sortedArrayUsingSelector:("localizedStandardCompare:")
  set numCntAllKey to (count of ocidSortedAllKeys) as integer
  ################################################
  ######【tbody】
  set ocidTbodyElement to (refMe's NSXMLElement's elementWithName:("tbody"))
  ##################################
  repeat with itemKeyNo from 0 to (numCntAllKey - 1) by 1
    ##############
    #TRの開始
    set ocidTrElement to (refMe's NSXMLElement's elementWithName:("tr"))
    ####【TH】項番処理
    set strSetValue to (itemKeyNo + 1) as text
    set ocidThElement to (refMe's NSXMLElement's elementWithName:("th"))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("項目番号:" & strSetValue))
(ocidThElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("headers") stringValue:("LineNO"))
(ocidThElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
(ocidThElement's addAttribute:(ocidAddNode))
(ocidThElement's setStringValue:(strSetValue))
(ocidTrElement's addChild:(ocidThElement))
    ###
    set ocidKeyCSV to (ocidSortedAllKeys's objectAtIndex:(itemKeyNo))
    set ocidKeyArray to (ocidKeyCSV's componentsSeparatedByString:(","))
    set listColName to {"namelD", "platformiD", "encodingiD", "languagelD"}
    set numCntItemKeyArray to (count of ocidKeyArray) as list
    repeat with itemItemKeyNo from 0 to (numCntItemKeyArray - 1) by 1
      set strColValue to (item (itemItemKeyNo + 1) of listColName) as text
      set strSetValue to (ocidKeyArray's objectAtIndex:(itemItemKeyNo))
      set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:(strColValue))
(ocidTdElement's addAttribute:(ocidAddNode))
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("headers") stringValue:(strColValue))
(ocidTdElement's addAttribute:(ocidAddNode))
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
(ocidTdElement's addAttribute:(ocidAddNode))
      set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("class") stringValue:("wid"))
(ocidTdElement's addAttribute:(ocidAddNode))
(ocidTdElement's setStringValue:(strSetValue))
(ocidTrElement's addChild:(ocidTdElement))
    end repeat
    ####値欄
    set ocidSetValue to (argFontToolsDict's valueForKey:(ocidKeyCSV))
    set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("nameString"))
(ocidTdElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("headers") stringValue:("nameString"))
(ocidTdElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
(ocidTdElement's addAttribute:(ocidAddNode))
(ocidTdElement's setStringValue:(ocidSetValue))
(ocidTrElement's addChild:(ocidTdElement))
    ####コメント欄
    ####NameiD
    set strNameiD to (ocidKeyArray's objectAtIndex:0) as text
    set numNameiD to strNameiD as integer
    if numNameiD > 25 then
      set strSetValue to ("Font-Specific ") as text
    else
      set strNameiD to numNameiD as text
      set strNameDiscription to (ocidNameIDDict's valueForKey:(strNameiD)) as text
      set strSetValue to (strNameDiscription & " ") as text
    end if
    ####PlatformiD
    set recordPlatForm to {|0|:"汎用", |1|:"Mac", |2|:"Win"} as record
    set ocidPlatFormDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
(ocidPlatFormDict's setDictionary:(recordPlatForm))
    
    set strPlatformiD to (ocidKeyArray's objectAtIndex:1) as text
    set numPlatformiD to strPlatformiD as integer
    if numPlatformiD = 1 then
      set strSetValue to (strSetValue & "Mac ") as text
    else if numPlatformiD = 3 then
      set strSetValue to (strSetValue & "Win ") as text
    else
      set strSetValue to (strSetValue & "UniPlatform ") as text
    end if
    ###EncodingiD
    set strEncodingiD to (ocidKeyArray's objectAtIndex:2) as text
    set numEncodingiD to strEncodingiD as integer
    if numEncodingiD = 0 then
      set strSetValue to (strSetValue & "Roman ") as text
    else if numEncodingiD = 1 then
      set strSetValue to (strSetValue & "Uni1.1 ") as text
    else if numEncodingiD = 2 then
      set strSetValue to (strSetValue & "Uni10646 ") as text
    else if numEncodingiD = 3 then
      set strSetValue to (strSetValue & "Uni2.0BMP ") as text
    else if numEncodingiD = 4 then
      set strSetValue to (strSetValue & "Uni2.0FULL ") as text
    end if
    ###LanguagelD
    set strLanguagelD to (ocidKeyArray's objectAtIndex:3) as text
    set strLangIdName to (ocidMacLangIDDict's valueForKey:(strLanguagelD))
    if strLangIdName = (missing value) then
      set strLangIdName to (ocidWinLangIDDict's valueForKey:(strLanguagelD))
      if strLangIdName = (missing value) then
        set strSetValue to (strSetValue & "Other ") as text
      else
        set strSetValue to (strSetValue & strLangIdName & " ") as text
      end if
    else
      set strSetValue to (strSetValue & strLangIdName & " ")
    end if
    set ocidTdElement to (refMe's NSXMLElement's elementWithName:("td"))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("Comment"))
(ocidTdElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("headers") stringValue:("Comment"))
(ocidTdElement's addAttribute:(ocidAddNode))
    set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("col"))
(ocidTdElement's addAttribute:(ocidAddNode))
(ocidTdElement's setStringValue:(strSetValue))
(ocidTrElement's addChild:(ocidTdElement))
    #
(ocidTbodyElement's addChild:(ocidTrElement))
  end repeat
  #Tbodyをテーブルにセット
ocidTableElement's addChild:(ocidTbodyElement)
  ######【tfoot】 TRで
  set ocidTfootElement to refMe's NSXMLElement's elementWithName:("tfoot")
  set ocidTrElement to refMe's NSXMLElement's elementWithName:("tr")
  #colspan指定して1行でセット
  set ocidThElement to (refMe's NSXMLElement's elementWithName:("th"))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("title") stringValue:("テーブルの終わり"))
(ocidThElement's addAttribute:(ocidAddNode))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("colspan") stringValue:("7"))
(ocidThElement's addAttribute:(ocidAddNode))
  set ocidAddNode to (refMe's NSXMLNode's attributeWithName:("scope") stringValue:("row"))
(ocidThElement's addAttribute:(ocidAddNode))
  #
  set strContents to ("項目数 : " & (numCntAllKey)) as text
(ocidThElement's setStringValue:(strContents))
  #THをTRにセットして
ocidTrElement's addChild:(ocidThElement)
  #TRをTFOOTにセット
ocidTfootElement's addChild:(ocidTrElement)
  #TFOOTをテーブルにセット
ocidTableElement's addChild:(ocidTfootElement)
ocidSetArticleElement's addChild:(ocidTableElement)
  ##############################
  #HTMLにする
  ##############################
  set strSetTitleValue to ("フォント情報一覧: " & strFilePath) as text
  set ocidHTML to doMakeRootElement({ocidSetHeaderElement, ocidSetArticleElement, ocidSetFooterElement, strSetTitleValue})
  ##############################
  #保存先
  set appFileManager to refMe's NSFileManager's defaultManager()
  set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDocumentDirectory) inDomains:(refMe's NSUserDomainMask))
  set ocidDocumentDirPathURL to ocidURLsArray's firstObject()
  set ocidSaveDirPathURL to ocidDocumentDirPathURL's URLByAppendingPathComponent:("Library/Fonts/FontInfo") isDirectory:(true)
  set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
  set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
  #保存ファイル名
  set ocidSetValue to (ocidPostScriptName's stringByReplacingOccurrencesOfString:(".") withString:(""))
  set ocidSaveBaseFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(ocidSetValue)
  if argTTCNo = 0 then
    set ocidSaveFilePathURL to ocidSaveBaseFilePathURL's URLByAppendingPathExtension:("html")
  else
    set strSetValue to (argTTCNo & ".html") as text
    set ocidSaveFilePathURL to ocidSaveBaseFilePathURL's URLByAppendingPathExtension:(strSetValue)
  end if
  #読み取りやすい表示
  set ocidXMLdata to ocidHTML's XMLDataWithOptions:(refMe's NSXMLNodePrettyPrint)
  set listDone to ocidXMLdata's writeToURL:(ocidSaveFilePathURL) options:(refMe's NSDataWritingAtomic) |error|:(reference)
  set boolDone to (item 1 of listDone) as boolean
return {boolDone, ocidSaveDirPathURL, ocidSaveFilePathURL}
end doMakeFontInfoHtml


############################################################
# 基本的なHTMLの構造
(*
doMakeRootElement({argHeaderContents, argArticleContents, argFooterContents})
HTMLのBODY部
header
article
footerにそれぞれAddchildするデータをリストで渡す
戻り値はRootエレメントにセットされた
NSXMLDocumentを戻すので 保存すればOK
*)
############################################################
to doMakeRootElement({argHeaderContents, argArticleContents, argFooterContents, argTitle})
  #XML初期化
  set ocidXMLDoc to refMe's NSXMLDocument's alloc()'s init()
ocidXMLDoc's setDocumentContentKind:(refMe's NSXMLDocumentHTMLKind)
  # DTD付与
  set ocidDTD to refMe's NSXMLDTD's alloc()'s init()
ocidDTD's setName:("html")
ocidXMLDoc's setDTD:(ocidDTD)
  #
  set ocidRootElement to refMe's NSXMLElement's elementWithName:("html")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("lang") stringValue:("ja")
ocidRootElement's addAttribute:(ocidAddNode)
  #
  set ocidHeadElement to refMe's NSXMLElement's elementWithName:("head")
  #
  set ocidAddElement to refMe's NSXMLElement's elementWithName:("title")
ocidAddElement's setStringValue:(argTitle)
ocidHeadElement's addChild:(ocidAddElement)
  # http-equiv
  set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("http-equiv") stringValue:("Content-Type")
ocidAddElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("text/html; charset=UTF-8")
ocidAddElement's addAttribute:(ocidAddNode)
ocidHeadElement's addChild:(ocidAddElement)
  #
  set ocidAddElement to refMe's NSXMLElement's elementWithName:("meta")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("name") stringValue:("viewport")
ocidAddElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("content") stringValue:("width=720")
ocidAddElement's addAttribute:(ocidAddNode)
ocidHeadElement's addChild:(ocidAddElement)
  #
  set ocidAddElement to refMe's NSXMLElement's elementWithName:("style")
ocidAddElement's setStringValue:("body {margin: 10px;background-color: #FFFFFF;font-family: system-ui;}table {max-width: 1280px;border-spacing: 0;caption-side: top;}thead th {border: solid 1px #666666;padding: .5ch .1ch;border-block-width: 1px 0;border-inline-width: 1px 0;&:first-of-type {border-start-start-radius: .5em}&:last-of-type {border-start-end-radius: .5em;border-inline-end-width: 1px}}tbody th {border-spacing: 0;max-width: 360px;border: solid 1px #666666;border-block-width: 1px 0;border-inline-width: 1px 0;}tbody td {max-width: 360px;border-spacing: 0;border: solid 1px #666666;padding: .5ch 1ch;border-block-width: 1px 0;border-inline-width: 1px 0;overflow-wrap: break-word;white-space: pre-wrap;&:last-of-type {border-inline-end-width: 1px}}tbody td.wid {width: 40px !important;max-width: 60px !important;text-align: right;}tbody tr:nth-of-type(odd) {background: #F2F2F2;}.kind_string {font-size: 0.75em;}.date_string {font-size: 0.5em;}tfoot th {border: solid 1px #666666;padding: .5ch 1ch;&:first-of-type {border-end-start-radius: .5em}&:last-of-type {border-end-end-radius: .5em;border-inline-end-width: 1px}}")
ocidHeadElement's addChild:(ocidAddElement)
ocidRootElement's addChild:(ocidHeadElement)
  #
  #ボディエレメント
  set ocidBodyElement to refMe's NSXMLElement's elementWithName:("body")
  #ヘッダー
  set ocidHeaderElement to refMe's NSXMLElement's elementWithName:("header")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("header")
ocidHeaderElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_header")
ocidHeaderElement's addAttribute:(ocidAddNode)
ocidHeaderElement's addChild:(argHeaderContents)
ocidBodyElement's addChild:(ocidHeaderElement)
  #アーティクル
  set ocidArticleElement to refMe's NSXMLElement's elementWithName:("article")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("article")
ocidArticleElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_article")
ocidArticleElement's addAttribute:(ocidAddNode)
ocidArticleElement's addChild:(argArticleContents)
ocidBodyElement's addChild:(ocidArticleElement)
  #フッター
  set ocidFooterElement to refMe's NSXMLElement's elementWithName:("footer")
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("id") stringValue:("footer")
ocidFooterElement's addAttribute:(ocidAddNode)
  set ocidAddNode to refMe's NSXMLNode's attributeWithName:("class") stringValue:("body_footer")
ocidFooterElement's addAttribute:(ocidAddNode)
ocidFooterElement's addChild:(argFooterContents)
ocidBodyElement's addChild:(ocidFooterElement)
  #ボディをROOTエレメントにセット
ocidRootElement's addChild:(ocidBodyElement)
  #ROOTをXMLにセット
ocidXMLDoc's setRootElement:(ocidRootElement)
  #値を戻す
return ocidXMLDoc
end doMakeRootElement



########################
## TTCフォント用
########################
to doGetFontInfoDicTTC(argFontFilePath, argBinPath, argItemNO)
  set strCommandText to ("\"" & argBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & argFontFilePath & "').fonts[" & argItemNO & "]['name'].names);\"") as text
  set strResponse to (do shell script strCommandText) as text
  set ocidFontToolsArray to doFormattingDic(strResponse)
  ##戻り値格納用のDICT
  set ocidFontToolsDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
  #['name'].namesの戻り値の数だけ繰り返し
  repeat with itemFontToolsArray in ocidFontToolsArray
    #各IDを定義
    set strNamelD to (item 1 of itemFontToolsArray) as text
    set strPlatformiD to (item 2 of itemFontToolsArray) as text
    set strLanguagelD to (item 3 of itemFontToolsArray) as text
    if strLanguagelD is "0" then
      set strEncodingiD to "0" as text
    else
      set strEncodingiD to "1" as text
    end if
    # namelD platformiD encodingiD languagelD
    set strSetValue to (strNamelD & "," & strPlatformiD & "," & strEncodingiD & "," & strLanguagelD) as text
    set strCommandText to ("\"" & argBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & argFontFilePath & "').fonts[" & argItemNO & "]['name'].getName(" & strSetValue & "));\"") as text
    set strResponse to (do shell script strCommandText) as text
    if strResponse is "None" then
      set strSetValue to (strNamelD & "," & strPlatformiD & ",1," & strLanguagelD) as text
      set strCommandText to ("\"" & argBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & argFontFilePath & "').fonts[" & argItemNO & "]['name'].getName(" & strSetValue & "));\"") as text
      set strResponse to (do shell script strCommandText) as text
    end if
    #戻り値をDictに入れていく
(ocidFontToolsDict's setValue:(strResponse) forKey:(strSetValue))
    ##getDebugName post script
    set strCommandText to ("\"" & argBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & argFontFilePath & "').fonts[" & argItemNO & "]['name'].getDebugName(6));\"") as text
    set strPostScriptName to (do shell script strCommandText) as text
    if strPostScriptName is "None" then
      set strCommandText to ("\"" & argBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & argFontFilePath & "').fonts[" & argItemNO & "]['name'].getName(6,3,1,1033));\"") as text
      set strPostScriptName to (do shell script strCommandText) as text
      if strPostScriptName is "None" then
        set strCommandText to ("\"" & argBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & argFontFilePath & "').fonts[" & argItemNO & "]['name'].getName(6,1,0,0));\"") as text
        set strPostScriptName to (do shell script strCommandText) as text
      end if
    end if
    
(ocidFontToolsDict's setValue:(strPostScriptName) forKey:("26,0,0,0"))
  end repeat
return ocidFontToolsDict
end doGetFontInfoDicTTC

########################
#単体TTフォント用
########################
to doGetFontInfoDicTTF(argFontFilePath, argPysonBinPath)
  ###
  set strCommandText to ("\"" & argPysonBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & argFontFilePath & "')['name'].names);\"") as text
  set strResponse to (do shell script strCommandText) as text
  set ocidFontToolsArray to doFormattingDic(strResponse)
  ##戻り値格納用のDICT
  set ocidFontToolsDict to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
  #['name'].namesの戻り値の数だけ繰り返し
  repeat with itemFontToolsArray in ocidFontToolsArray
    #各IDを定義
    set strNamelD to (item 1 of itemFontToolsArray) as text
    set strPlatformiD to (item 2 of itemFontToolsArray) as text
    set strLanguagelD to (item 3 of itemFontToolsArray) as text
    if strLanguagelD is "0" then
      set strEncodingiD to "0" as text
    else
      set strEncodingiD to "1" as text
    end if
    # namelD platformiD encodingiD languagelD
    set strSetValue to (strNamelD & "," & strPlatformiD & "," & strEncodingiD & "," & strLanguagelD) as text
    set strCommandText to ("\"" & argPysonBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & argFontFilePath & "')['name'].getName(" & strSetValue & "));\"") as text
    set strResponse to (do shell script strCommandText) as text
    if strResponse is "None" then
      set strSetValue to (strNamelD & "," & strPlatformiD & ",1," & strLanguagelD) as text
      set strCommandText to ("\"" & argPysonBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & argFontFilePath & "')['name'].getName(" & strSetValue & "));\"") as text
      set strResponse to (do shell script strCommandText) as text
    end if
    #戻り値をDictに入れていく
(ocidFontToolsDict's setValue:(strResponse) forKey:(strSetValue))
    ##getDebugName PostScriptname
    set strCommandText to ("\"" & argPysonBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & argFontFilePath & "')['name'].getDebugName(6));\"") as text
    set strPostScriptName to (do shell script strCommandText) as text
(ocidFontToolsDict's setValue:(strPostScriptName) forKey:("26,0,0,0"))
  end repeat
return ocidFontToolsDict
end doGetFontInfoDicTTF

########################
#fontToolのDictをArrayに
########################
to doFormattingDic(argText)
  set ocidResponse to refMe's NSString's stringWithString:(argText)
  set ocidRepStrings to (ocidResponse's stringByReplacingOccurrencesOfString:("[") withString:(""))
  set ocidRepStrings to (ocidRepStrings's stringByReplacingOccurrencesOfString:("]") withString:(""))
  set ocidRepStrings to (ocidRepStrings's stringByReplacingOccurrencesOfString:("<") withString:(""))
  set ocidRepStrings to (ocidRepStrings's stringByReplacingOccurrencesOfString:(">") withString:(""))
  set ocidStringArray to ocidRepStrings's componentsSeparatedByString:(",")
  #
  set ocidNamesArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
  repeat with itemArray in ocidStringArray
    set ocidItemArrayM to (refMe's NSMutableArray's alloc()'s initWithCapacity:(0))
    set ocidSubArray to (itemArray's componentsSeparatedByString:(";"))
    repeat with itemSubArray in ocidSubArray
      set ocidGetArray to (itemSubArray's componentsSeparatedByString:("="))
      set strID to ocidGetArray's lastObject()
(ocidItemArrayM's addObject:(strID))
    end repeat
(ocidNamesArrayM's addObject:(ocidItemArrayM))
  end repeat
  ##戻り値はArrayINArray
return ocidNamesArrayM
end doFormattingDic



########################
##処理対象ファイルだけ処理に回す
########################
to doMakeProcessingArray(argListAliasFilePath)
  set ocidUTIarray to refMe's NSArray's arrayWithArray:(listUTI)
  #処理するパスを格納する
  set ocidDoPathArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
  #
  repeat with itemAliasFilePath in argListAliasFilePath
    set aliasFilePath to itemAliasFilePath 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 alloc()'s initFileURLWithPath:(ocidFilePath))
    set listResourceValue to (ocidFilePathURL's getResourceValue:(reference) forKey:(refMe's NSURLContentTypeKey) |error|:(reference))
    set ocidContentType to (item 2 of listResourceValue)
    set strUTI to (ocidContentType's identifier) as text
    set boolContain to (ocidUTIarray's containsObject:(strUTI))
    if boolContain is true then
log "対象フォントです"
      ##URLを使う場合
      # (ocidDoPathArray's addObject:(ocidFilePathURL))
      ##パスが必要な場合
(ocidDoPathArray's addObject:(ocidFilePath))
      ##テキストパスを戻す場合
      # (ocidDoPathArray's addObject:(strFilePath))
    else
log "対象外のファイルですリストに追加しません"
    end if
  end repeat
  ###戻り値はArray
return ocidDoPathArray
end doMakeProcessingArray

####################
#設定ファイル書き込み
####################
to doWriteDefDirURL(argDirPathURL, argBinPath)
  #設定ファイルのパス
  set appFileManager to refMe's NSFileManager's defaultManager()
  set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSApplicationSupportDirectory) inDomains:(refMe's NSUserDomainMask))
  set ocidApplicationSupportDirPathURL to ocidURLsArray's firstObject()
  set ocidPrefFilePathURL to ocidApplicationSupportDirPathURL's URLByAppendingPathComponent:("com.cocolog-nifty.quicktimer/" & refBundleID)
  set ocidPrefFilePathURL to ocidPrefFilePathURL's URLByAppendingPathExtension:("plist")
  #NSDATAでデータを読み出して
  set listResponse to refMe's NSData's dataWithContentsOfURL:(ocidPrefFilePathURL) options:(refMe's NSDataReadingMappedIfSafe) |error|:(reference)
  set ocidPlistData to (item 1 of listResponse)
  #NSKeyedArchiverで圧縮されているのでUnarchive解凍する
  set listResponse to refMe's NSKeyedUnarchiver's unarchivedObjectOfClass:((refMe's NSObject)'s class) fromData:(ocidPlistData) |error|:(reference)
  set ocidPlistDict to (item 1 of listResponse)
  if ocidPlistDict = (missing value) then
    set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
  end if
  #NSURLを保存
ocidPlistDict's setObject:(argDirPathURL) forKey:("LastChooseDir")
  #Pyのパスを保存する
  if argBinPath is not (missing value) then
ocidPlistDict's setObject:(argBinPath) forKey:("PythonPath")
  end if
  #NSKeyedArchiverで圧縮して
  set listSaveData to refMe's NSKeyedArchiver's archivedDataWithRootObject:(ocidPlistDict) requiringSecureCoding:(true) |error|:(reference)
  set ocidSaveData to (item 1 of listSaveData)
  #NSDATAで保存
  set listDone to ocidSaveData's writeToURL:(ocidPrefFilePathURL) options:0 |error|:(reference)
  #戻り値は成功したかのBOOL値
  set boolDone to (item 1 of listDone) as boolean
return boolDone
end doWriteDefDirURL


####################
#設定ファイル読み出し
####################
to doGetDefDirURL()
  #設定ファイルの保存先
  set appFileManager to refMe's NSFileManager's defaultManager()
  set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSApplicationSupportDirectory) inDomains:(refMe's NSUserDomainMask))
  set ocidApplicationSupportDirPathURL to ocidURLsArray's firstObject()
  #フォルダは一応作る
  set ocidConfDirPathURL to ocidApplicationSupportDirPathURL's URLByAppendingPathComponent:("com.cocolog-nifty.quicktimer")
  set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
  set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidConfDirPathURL) withIntermediateDirectories:(true) attributes:(ocidAttrDict) |error|:(reference)
  #設定ファイルのパス
  set ocidPrefFilePathURL to ocidConfDirPathURL's URLByAppendingPathComponent:(refBundleID)
  set ocidPlistFilePathURL to ocidPrefFilePathURL's URLByAppendingPathExtension:("plist")
  #NSDATAで読み出して
  set listResponse to refMe's NSData's dataWithContentsOfURL:(ocidPlistFilePathURL) options:(refMe's NSDataReadingMappedIfSafe) |error|:(reference)
  set ocidPlistData to (item 1 of listResponse)
  #NSKeyedArchiverで圧縮されているのでUnarchive解凍する
  set listResponse to refMe's NSKeyedUnarchiver's unarchivedObjectOfClass:((refMe's NSObject)'s class) fromData:(ocidPlistData) |error|:(reference)
  set ocidPlistDict to (item 1 of listResponse)
  #戻り値が空なら
  if ocidPlistDict = (missing value) then
log "初回起動です"
    #フォントフォルダをデフォルトとして登録する
    set ocidDirPathURLArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
    set ocidDirPathURL to ocidDirPathURLArray's firstObject()
    set ocidDefaultDirPathURL to ocidDirPathURL's URLByAppendingPathComponent:("Fonts")
    #保存するDICT
log doWriteDefDirURL(ocidDefaultDirPathURL, (missing value))
    set strBinPath to (missing value)
  else
    set ocidDefaultDirPathURL to ocidPlistDict's valueForKey:("LastChooseDir")
    set strBinPath to ocidPlistDict's valueForKey:("PythonPath")
  end if
  #戻り値は設定ファイルから取得してNSURL
  set listReturn to {ocidDefaultDirPathURL, strBinPath} as list
return listReturn
end doGetDefDirURL

####################
## python3のチェック
####################
to doChkPython3()
  ## python3のパス
  try
    set strCmdText to ("/usr/bin/which python3") as text
    set strBinPath to (do shell script strCmdText) as text
  on error
log "python3が見つかりませんでした終了します"
return {false, (missing value)} as list
  end try
  ###fonttoolのインストールチェック
  set strCmdText to ("\"" & strBinPath & "\" -m pip show fontTools") as text
  try
    set strPipDone to (do shell script strCmdText) as text
  on error
    try
      set strCmdText to ("/bin/mkdir -p $HOME/Library/Caches/pip") as text
do shell script strCmdText
      set strCmdText to ("/bin/chmod 777 $HOME/Library/Caches/pip") as text
do shell script strCmdText
      set strCmdText to ("/bin/mkdir -p $HOME/Library/Python/3.9/lib/python/site-packages") as text
do shell script strCmdText
      set strCmdText to ("/bin/chmod 755 $HOME/Library/Python/3.9/lib/python/site-packages") as text
do shell script strCmdText
    end try
    try
      ##pipのアップデート
      set strCmdText to ("\"" & strBinPath & "\" -m pip install --upgrade --user pip") as text
      set strPipDone to (do shell script strCmdText) as text
    on error
log "pipのアップデートに失敗しました"
return {false, (missing value)} as list
    end try
    try
      ##インストールされていなければインストールする
      set strCmdText to ("\"" & strBinPath & "\" -m pip install --user fontTools") as text
      set strPipDone to (do shell script strCmdText) as text
    on error
log "fontToolsのインストールに失敗しました"
return {false, (missing value)} as list
    end try
  end try
return {true, strBinPath} as list
end doChkPython3


|

[python3]フォントのファミリー名のフォルダを作って中にフォント入れる(フォントファイル整理用)


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# python3を利用します
# fontToolsがインストールされていない場合インストールします
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

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

###python3のパスチェック
try
  set strCmdText to ("/usr/bin/which python3") as text
  set strBinPath to (do shell script strCmdText) as text
on error
return "python3が見つかりませんでした終了します"
end try
###fonttoolのインストールチェック
set strCmdText to ("\"" & strBinPath & "\" -m pip show fontTools") as text
try
  set strPipDone to (do shell script strCmdText) as text
on error
  try
    set strCmdText to ("/bin/mkdir -p $HOME/Library/Caches/pip") as text
do shell script strCmdText
    set strCmdText to ("/bin/chmod 777 $HOME/Library/Caches/pip") as text
do shell script strCmdText
    set strCmdText to ("/bin/mkdir -p $HOME/Library/Python/3.9/lib/python/site-packages") as text
do shell script strCmdText
    set strCmdText to ("/bin/chmod 755 $HOME/Library/Python/3.9/lib/python/site-packages") as text
do shell script strCmdText
  end try
  ##インストールされていなければインストールする
  set strCmdText to ("\"" & strBinPath & "\" -m pip install --user fontTools") as text
  set strPipDone to (do shell script strCmdText) as text
end try

###ダイアログを前面に出す
set strName to (name of current application) as text
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
# デフォルトロケーション
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set aliasDesktopDirPath to (ocidDesktopDirPathURL's absoluteURL()) as alias
#UTIリスト
set listUTI to {"public.opentype-font", "public.truetype-ttf-font", "public.truetype-collection-font", "public.opentype-collection-font"} as list
#メッセージ
set strMes to ("フォント・ファイルを選んでください") as text
set strPrompt to ("フォント・ファイルを選んでください") as text
try
  #ファイル選択
  set listAliasFilePath to (choose file strMes with prompt strPrompt default location aliasDesktopDirPath of type listUTI with invisibles, multiple selections allowed and showing package contents) as list
on error
log "エラーしました"
return "エラーしました"
end try
if listAliasFilePath is {} then
return "選んでください"
end if


repeat with itemAliasFilePath in listAliasFilePath
  set strFontFilePath to (POSIX path of itemAliasFilePath) as text
  set ocidFontFilePathStr to (refMe's NSString's stringWithString:(strFontFilePath))
  set ocidFontFilePath to ocidFontFilePathStr's stringByStandardizingPath()
  #
  set ocidExtensionName to (ocidFontFilePath's pathExtension())
  set strExtensionName to (ocidExtensionName's lowercaseString) as text
  #
  #
  set strResponseText to ("") as text
  if ("ttf otf") contains strExtensionName then
log "単体フォントファイルです"
    ##【1】NameID=1; PlatformID=1; EncodinglD=1; LanguageID=11 日本語Mac
    set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & strFontFilePath & "')['name'].getName(1,1,1,11));\"") as text
    set strFontFamilyName to (do shell script strCommandText) as text
    if strFontFamilyName is "None" then
      ##【2】NameID=1; PlatformID=1; EncodinglD=1; LanguageID=1041 日本 Mac
      set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & strFontFilePath & "')['name'].getName(1,1,1,1041));\"") as text
      set strFontFamilyName to (do shell script strCommandText) as text
      if strFontFamilyName is "None" then
        ##【3】NameID=1; PlatformID=3; EncodinglD=1; LanguageID= 1041 日本語 Win
        set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & strFontFilePath & "')['name'].getName(1, 3, 1, 1041));\"") as text
        set strFontFamilyName to (do shell script strCommandText) as text
        if strFontFamilyName is "None" then
          ##【4】NameID=1; PlatformID=1; EncodinglD=0; LanguageID=0 英語 Mac
          set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & strFontFilePath & "')['name'].getName(1, 1, 0, 0));\"") as text
          set strFontFamilyName to (do shell script strCommandText) as text
          if strFontFamilyName is "None" then
##【5】NameID=1; PlatformID=3; EncodinglD=1; LanguageID=1033 英語 Win
set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & strFontFilePath & "')['name'].getName(1, 3, 1, 1033));\"") as text
set strFontFamilyName to (do shell script strCommandText) as text
          end if
        end if
      end if
    end if
    ################################
  else if ("otc ttc") contains strExtensionName then
log "コレクションフォントです"
    #1書体目のファミリー目を取得
    set itemIntNo to 0 as integer
    ##【1】NameID=1; PlatformID=1; EncodinglD=1; LanguageID=11 日本語Mac
    set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & strFontFilePath & "').fonts[" & itemIntNo & "]['name'].getName(1,1,1,11));\"") as text
    set strFontFamilyName to (do shell script strCommandText) as text
    if strFontFamilyName is "None" then
      ##【2】NameID=1; PlatformID=1; EncodinglD=1; LanguageID= 1041 日本 Mac
      set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & strFontFilePath & "').fonts[" & itemIntNo & "]['name'].getName(1, 1, 1, 1041));\"") as text
      set strFontFamilyName to (do shell script strCommandText) as text
      if strFontFamilyName is "None" then
        ##【4】NameID=1; PlatformID=3; EncodinglD=1; LanguageID= 1041 日本語 Win
        set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & strFontFilePath & "').fonts[" & itemIntNo & "]['name'].getName(1, 3, 1, 1041));\"") as text
        set strFontFamilyName to (do shell script strCommandText) as text
        if strFontFamilyName is "None" then
          ##【3】NameID=1; PlatformID=1; EncodinglD=0; LanguageID=0 英語 Mac
          set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & strFontFilePath & "').fonts[" & itemIntNo & "]['name'].getName(1, 1, 0, 0));\"") as text
          set strFontFamilyName to (do shell script strCommandText) as text
          if strFontFamilyName is "None" then
##【5】NameID=1; PlatformID=3; EncodinglD=1; LanguageID=1033 英語 Win
set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & strFontFilePath & "').fonts[" & itemIntNo & "]['name'].getName(1, 3, 1, 1033));\"") as text
set strFontFamilyName to (do shell script strCommandText) as text
          end if
        end if
      end if
    end if
  end if
  
  
  ##
  set ocidFilePathStr to (refMe's NSString's stringWithString:(strFontFilePath))
  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
  set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
  set ocidFileName to ocidFilePathURL's lastPathComponent()
  ##
  set ocidContainerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()
  #ファミリー名を追加したパス
  set ocidMakeDirPathURL to (ocidContainerDirPathURL's URLByAppendingPathComponent:(strFontFamilyName))
  #↑のフォルダの中にフォントファイル入れるパス
  set ocidDistFilePathURL to (ocidMakeDirPathURL's URLByAppendingPathComponent:(ocidFileName))
  #フォルダを先に作って
  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:(ocidMakeDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference))
  #移動する
  set listDone to (appFileManager's moveItemAtURL:(ocidFilePathURL) toURL:(ocidDistFilePathURL) |error|:(reference))
  
end repeat





|

[Font]postscript名を取得する(python利用)


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

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
# python3を利用します
# fontToolsがインストールされていない場合インストールします
# インストールしたくない人は実行しないでください
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions

property refMe : a reference to current application

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

###python3のパスチェック
try
  set strCmdText to ("/usr/bin/which python3") as text
  set strBinPath to (do shell script strCmdText) as text
on error
return "python3が見つかりませんでした終了します"
end try
###fonttoolのインストールチェック
set strCmdText to ("\"" & strBinPath & "\" -m pip show fontTools") as text
try
  set strPipDone to (do shell script strCmdText) as text
on error
  try
    set strCmdText to ("/bin/mkdir -p $HOME/Library/Caches/pip") as text
do shell script strCmdText
    set strCmdText to ("/bin/chmod 777 $HOME/Library/Caches/pip") as text
do shell script strCmdText
    set strCmdText to ("/bin/mkdir -p $HOME/Library/Python/3.9/lib/python/site-packages") as text
do shell script strCmdText
    set strCmdText to ("/bin/chmod 755 $HOME/Library/Python/3.9/lib/python/site-packages") as text
do shell script strCmdText
  end try
  ##インストールされていなければインストールする
  set strCmdText to ("\"" & strBinPath & "\" -m pip install --user fontTools") as text
  set strPipDone to (do shell script strCmdText) as text
end try

###ダイアログを前面に出す
set strName to (name of current application) as text
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
# デフォルトロケーション
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 ocidFontsDirPathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Fonts")
set aliasFontsDirPath to (ocidFontsDirPathURL's absoluteURL()) as alias
#UTIリスト
set listUTI to {"public.opentype-font", "public.truetype-ttf-font", "public.truetype-collection-font", "public.opentype-collection-font"} as list
#メッセージ
set strMes to ("フォント・ファイルを選んでください") as text
set strPrompt to ("フォント・ファイルを選んでください") as text
try
  #ファイル選択
  set listAliasFilePath to (choose file strMes with prompt strPrompt default location aliasFontsDirPath of type listUTI with invisibles, multiple selections allowed and showing package contents) as list
on error
log "エラーしました"
return "エラーしました"
end try
if listAliasFilePath is {} then
return "選んでください"
end if


repeat with itemAliasFilePath in listAliasFilePath
  set strFontFilePath to (POSIX path of itemAliasFilePath) as text
  ##
  set ocidFilePathStr to (refMe's NSString's stringWithString:(strFontFilePath))
  set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
  set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
  set ocidFileName to ocidFilePathURL's lastPathComponent()
  set ocidExtensionName to ocidFilePathURL's pathExtension()
  set strExtensionName to (ocidExtensionName's lowercaseString) as text
  #
  set strDefaultAnswer to ("") as text
  if ("ttf otf") contains strExtensionName then
log "単体フォントファイルです"
    ##【2】NameID=6
    set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & strFontFilePath & "')['name'].getDebugName(6));\"") as text
    set strPostScriptName to (do shell script strCommandText) as text
    if strPostScriptName is "None" then
      ##【2】NameID=6; PlatformID=1; EncodinglD=0; LanguageID=0 英語 Mac
      set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & strFontFilePath & "')['name'].getName(6, 1, 0, 0));\"") as text
      set strPostScriptName to (do shell script strCommandText) as text
    end if
    if strPostScriptName is "None" then
      ##【3】NameID=6; PlatformID=3; EncodinglD=1; LanguageID=1033 英語 Win
      set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTFont;print(TTFont('" & strFontFilePath & "')['name'].getName(6, 3, 1, 1033));\"") as text
      set strPostScriptName to (do shell script strCommandText) as text
    end if
    if strPostScriptName is "None" then
      set strDefaultAnswer to "取得に失敗しました"
    else
      set strDefaultAnswer to (strPostScriptName) as text
    end if
    ################################
  else if ("otc ttc") contains strExtensionName then
log "コレクションフォントです"
    ##同封されている書体数を数えて
    set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(len(TTCollection('" & strFontFilePath & "').fonts));\"") as text
    set numCntFont to (do shell script strCommandText) as integer
    
    repeat with itemIntNo from 0 to (numCntFont - 1) by 1
      ##【1】getDebugName
      set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & strFontFilePath & "').fonts[" & itemIntNo & "]['name'].getDebugName(6));\"") as text
      set strPostScriptName to (do shell script strCommandText) as text
      if strPostScriptName is "None" then
        ##【3】NameID=1; PlatformID=1; EncodinglD=0; LanguageID=0 英語 Mac
        set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & strFontFilePath & "').fonts[" & itemIntNo & "]['name'].getName(6, 1, 0, 0));\"") as text
        set strPostScriptName to (do shell script strCommandText) as text
      end if
      if strPostScriptName is "None" then
        ##【5】NameID=1; PlatformID=3; EncodinglD=1; LanguageID=1033 英語 Win
        set strCommandText to ("\"" & strBinPath & "\" -c \"from fontTools.ttLib import TTCollection;print(TTCollection('" & strFontFilePath & "').fonts[" & itemIntNo & "]['name'].getName(6, 3, 1, 1033));\"") as text
        set strPostScriptName to (do shell script strCommandText) as text
      end if
      if strPostScriptName is "None" then
        set strPostScriptName to "取得に失敗しました"
      end if
      set strDefaultAnswer to (strDefaultAnswer & strPostScriptName & "\n") as text
    end repeat
    
    
  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 strSetValue to ("ID=6 PostScript Name名 戻り値です\n" & strFontFilePath) as text
  set aliasIconPath to (POSIX file "/System/Applications/Font Book.app/Contents/Resources/AppIcon.icns") as alias
  set recordResult to (display dialog strSetValue with title "PostScriptName" default answer strDefaultAnswer buttons {"クリップボードにコピー", "キャンセル", "OK"} default button "OK" cancel button "キャンセル" giving up after 20 with icon aliasIconPath without hidden answer)
  ###クリップボードコピー
  if button returned of recordResult is "クリップボードにコピー" then
    set strText to text returned of recordResult as text
    ####ペーストボード宣言
    set appPasteboard to refMe's NSPasteboard's generalPasteboard()
    set ocidText to (refMe's NSString's stringWithString:(strText))
appPasteboard's clearContents()
(appPasteboard's setString:(ocidText) forType:(refMe's NSPasteboardTypeString))
  end if
  
  
end repeat










|

[python3]フォント情報をHTMLで表示する

ダウンロード - fontinfo2htmlpy.zip


↑試す時はダウンロードして実行してください
セットアップ用のscriptを同封しています

#!/usr/bin/env python3
#coding: utf-8
import sys
import os
from fontTools.ttLib import TTFont
from fontTools.ttLib import TTCollection

#font_path = "/System/Library/Fonts/Supplemental/Arial Bold.ttf"
#font_path = "/System/Library/Fonts/ヒラギノ明朝 ProN.ttc"
font_path = sys.argv[1]

"""
NameID
NameID 内容 備考
0 著作権 Copyright notice
1 フォントファミリ Font Family name
2 サブファミリ Font Subfamily name
3 識別子 Unique font identifi
4 フォント名 Full font name
5 バージョン Version string
6 PostScript名 Postscript name
7 商標 Trademark
8 メーカー名 Manufacturer Name
9 デザイナー Designer
10 説明 Description
11 URL URL
12 デザイナーURL URL Designer
13 ライセンス License Description
14 ライセンスURL License Info URL
15 未使用
16 タイポファミリ名 Preferred Family
17 タイポサブファミリ名 Preferred Subfamily
18 Mac用のメニュー表示  
19 サンプルテキスト  
20 PostScriptCID find PostScriptCIDフォント名
21 WWS ファミリ名 weight width slope※
22 WWS サブファミリー名 weight width slope
23 CPALL Color Palette Light カラーフォント用
24 CPALD Color Palette Dark カラーフォント用
25 PostScriptバリエーション名 Multiple Master用


###LanguageID
Win 0x0411: 'ja',
Mac 11: 'ja',
0 1033 英語 0=English; 1033=United States;
11 1041 日本語 11=日本語 1041=日本
##EncodinglD
0 Roman;
1 Unicode
###Platform ID
0 Unicode Indicates Unicode version.
1 Macintosh QuickDraw Script Manager code.
2 (reserved; do not use)
3 Microsoft Microsoft encoding.

https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html/nfunction
"""

def ttc_func(font_path):
font_collection = TTCollection(font_path)
str_join_text = ""
str_join_text = str_join_text + (" \t" + str(font_path))
  for item_font in font_collection.fonts:
font_dic = item_font["name"].names
str_join_text = str_join_text + "\n" + str("-\t-" )
    for item in font_dic:
name_id = str(item.nameID)
item_value = str(item)
str_join_text = (str_join_text + "\n" + name_id + '\t' + item_value)

print(str_join_text)


def ttf_func(font_path):
font_single = TTFont(font_path)
font_dic = font_single["name"].names
  for item in font_dic:
name_id = str(item.nameID)
item_value = str(item)
str_join_text = ''.join(name_id + '\t' + item_value)
print(str_join_text)

#######
_, extension = os.path.splitext(font_path)
extension_lower = extension.lower()
if extension_lower == ".ttc":
ttc_func(font_path)
elif extension_lower == ".otc":
ttc_func(font_path)
elif extension_lower == ".otf":
ttf_func(font_path)
elif extension_lower == ".ttf":
ttf_func(font_path)

|

[Font]NameiD

詳しくはMicrosoftのサイトを見てください
https://learn.microsoft.com/en-us/typography/opentype/spec/name
Appleのドキュメントの方が詳細
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6name.html

NameID
NameID内容備考
0著作権Copyright notice
1フォントファミリFont Family name
2サブファミリFont Subfamily name
3識別子Unique font identifi
4フォント名Full font name
5バージョンVersion string
6PostScript名Postscript name
7商標Trademark
8メーカー名Manufacturer Name
9デザイナーDesigner
10説明Description
11URLURL
12デザイナーURLURL Designer
13ライセンスLicense Description
14ライセンスURLLicense Info URL
15未使用
16タイポファミリ名Preferred Family
17タイポサブファミリ名Preferred Subfamily
18Mac用のメニュー表示 
19サンプルテキスト 
20PostScriptCID findPostScriptCIDフォント名
21WWS ファミリ名weight width slope※
22WWS サブファミリー名weight width slope
23CPALLColor Palette Light カラーフォント用
24CPALDColor Palette Dark カラーフォント用
25PostScriptバリエーション名Multiple Master用
slopeは斜体の角度
項目数 : 26

|

[python3]インストールしていないフォントのpostscript名を取得する(TTC・OTC対応)

ダウンロード - getpostscriptname.zip

試す場合は↑をダウンロードして使ってください
↓だけでは動作しません

#!/usr/bin/env python3
#coding: utf-8
import sys
import os
from fontTools.ttLib import TTFont
from fontTools.ttLib import TTCollection

#font_path = "/System/Library/Fonts/Supplemental/Arial Black.ttf"
#font_path = "/System/Library/Fonts/Supplemental/GillSans.ttc"
font_path = sys.argv[1]


def ttc_func(font_path):
font_collection = TTCollection(font_path)
  for item_font in font_collection.fonts:
postScriptName = item_font['name'].getDebugName(6)
print(postScriptName)

def ttf_func(font_path):
font_single = TTFont(font_path)
postScriptName = font_single['name'].getDebugName(6)
print(postScriptName)

#######
_, extension = os.path.splitext(font_path)
extension_lower = extension.lower()
if extension_lower == ".ttc":
ttc_func(font_path)
elif extension_lower == ".otc":
ttc_func(font_path)
elif extension_lower == ".otf":
ttf_func(font_path)
elif extension_lower == ".ttf":
ttf_func(font_path)

|

Microsoft OfficeのフォントをFontBookに登録する


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

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

###フォントブックを終了
tell application id "com.apple.FontBook"
quit
end tell

##############################
###ライブラリ名を指定 ダイアログ
set appFileManager to refMe's NSFileManager's defaultManager()
###FontCollectionsのフォルダパス
set ocidUserLibraryPathArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidUserLibraryPath to ocidUserLibraryPathArray's firstObject()
set ocidFilePathURL to ocidUserLibraryPath's URLByAppendingPathComponent:("FontCollections/Microsoft Fonts.library") isDirectory:(false)

##############################
##### フォント選択
set strFontsDirPath to "/Applications/Microsoft Word.app/Contents/Resources/DFonts"
set ocidFontsDirPathStr to refMe's NSString's stringWithString:(strFontsDirPath)
set ocidFontsDirPath to ocidFontsDirPathStr's stringByStandardizingPath()
set ocidFontsDirPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFontsDirPath) isDirectory:false)

set boolDirExists to appFileManager's fileExistsAtPath:(ocidFontsDirPath) isDirectory:(true)
if boolDirExists = true then
log "フォントがあります処理継続"
else if boolDirExists = false then
return "まずはMicrosoft Officeをインストールしてから実行してください"
end if

##############################
#####enumeratorAtURLL格納するリスト
set ocidEmuFileURLArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
###フォントファイルのURLのみを格納するリスト
set ocidFontFilePathURLArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0

##############################
#####ディレクトリのコンテツを収集
###収集する付随プロパティ
set ocidPropertiesForKeys to {(refMe's NSURLContentTypeKey), (refMe's NSURLIsRegularFileKey)}
####ディレクトリのコンテツを収集
set ocidEmuDict to (appFileManager's enumeratorAtURL:(ocidFontsDirPathURL) includingPropertiesForKeys:ocidPropertiesForKeys options:(refMe's NSDirectoryEnumerationSkipsHiddenFiles) errorHandler:(reference))
###戻り値用のリストに格納
ocidEmuFileURLArray's addObjectsFromArray:(ocidEmuDict's allObjects)

##############################
#####『ファイル』だけ取り出したリストにする
####enumeratorAtURLのかずだけ繰り返し
repeat with itemEmuFileURL in ocidEmuFileURLArray
  
  ####URLをforKeyで取り出し
  set listResult to (itemEmuFileURL's getResourceValue:(reference) forKey:(refMe's NSURLIsRegularFileKey) |error|:(reference))
  ###リストからNSURLIsRegularFileKeyのBOOLを取り出し
  set boolIsRegularFileKey to item 2 of listResult
log boolIsRegularFileKey as text
  ####ファイルのみを(ディレクトリやリンボリックリンクは含まない)
  if boolIsRegularFileKey is (refMe's NSNumber's numberWithBool:true) then
    set listResult to (itemEmuFileURL's getResourceValue:(reference) forKey:(refMe's NSURLContentTypeKey) |error|:(reference))
    set ocidContentType to item 2 of listResult
    set strUTI to (ocidContentType's identifier) as text
    if strUTI contains "font" then
      ####リストにする
(ocidFontFilePathURLArray's addObject:(itemEmuFileURL))
    end if
  end if
end repeat

##############################
#####URL格納用(absoluteString)
set ocidFontPathArray to refMe's NSMutableArray's alloc()'s initWithCapacity:0
repeat with itemAliasFontPath in ocidFontFilePathURLArray
(ocidFontPathArray's addObject:(itemAliasFontPath))
end repeat

##############################
##### PLIST処理
###PLISTのデータになるDict
set ocidPlistDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
###bookmarks
set ocidBookmarks to refMe's NSMutableDictionary's alloc()'s init()
ocidPlistDict's setObject:(ocidBookmarks) forKey:("bookmarks")
#####################
###containerURLs
set ocidContainerURLs to refMe's NSMutableArray's alloc()'s initWithCapacity:0
###フォントのURLを追加(absoluteString形式)
repeat with itemFontPathArray in ocidFontPathArray
  set strAbsoluteStringPath to (itemFontPathArray's absoluteString())
(ocidContainerURLs's addObject:(strAbsoluteStringPath))
end repeat
ocidPlistDict's setObject:(ocidContainerURLs) forKey:("containerURLs")
###disabled
set ocidFalse to (refMe's NSNumber's numberWithBool:false)
ocidPlistDict's setValue:(ocidFalse) forKey:("disabled")
###name
ocidPlistDict's setValue:("Microsoft Fonts") forKey:("name")
###reference
set ocidReference to refMe's NSNumber's numberWithInteger:(1)
ocidPlistDict's setValue:(ocidReference) forKey:("reference")
###date
set ocidDate to (refMe's NSDate's |date|())
set ocidFormatter to refMe's NSDateFormatter's alloc()'s init()
ocidFormatter's setDateFormat:("yyyy-MM-dd'T'HH:mm:ss'Z'")
ocidFormatter's setTimeZone:(refMe's NSTimeZone's timeZoneWithAbbreviation:("UTC"))
set ocidSetDate to ocidFormatter's stringFromDate:(ocidDate)
-->string形式でセットするのでsetValueで
ocidPlistDict's setValue:(ocidSetDate) forKey:("date")
#####################
###urlAddedDates
set ocidUrlAddedDates to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
###フォントのURLを追加(absoluteString形式)
repeat with itemFontPathArray in ocidFontPathArray
  set strPath to (itemFontPathArray's |path|())
(ocidUrlAddedDates's setValue:(ocidSetDate) forKey:(strPath))
end repeat
ocidPlistDict's setObject:(ocidUrlAddedDates) forKey:("urlAddedDates")
###version
ocidFormatter's setDateFormat:("yyyyMMdd")
set ocidversion to ocidFormatter's stringFromDate:(ocidDate)
ocidPlistDict's setValue:(ocidversion) forKey:("version")

######################
###XML形式
set ocidXmlplist to refMe's NSPropertyListXMLFormat_v1_0
####書き込み用にXMLに変換
set ocidPlistEditData to refMe's NSPropertyListSerialization's dataWithPropertyList:(ocidPlistDict) format:(ocidXmlplist) options:0 |error|:(missing value)
####書き込み
ocidPlistEditData's writeToURL:(ocidFilePathURL) atomically:true

###フォントブックを起動
tell application id "com.apple.FontBook"
launch
end tell


return

|

FontBookからコピーした値からフォントサンプル画像を生成する(縦型用)


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

#!/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 "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application

###################################
#####設定項目
###################################
###画像に印字するテキスト
set strInputText3 to "美しい日本語" as text
set strInputText4 to "ABCDEFGHIJKLMNOPQRSTUVWXYZ" as text
set strInputText5 to "abcdefghijklmnopqrstuvwxyz" as text
set strInputText6 to "*0123456789=*%&#¥@{}" as text

set strInputText7 to "090-1234-5678" as text

########################
## クリップボードの中身取り出し
########################
###初期化
set ocidPasteboard to refMe's NSPasteboard's generalPasteboard()
##中身の要素
set ocidPastBoardTypeArray to ocidPasteboard's types
#
set boolContain to ocidPastBoardTypeArray's containsObject:("NSStringPboardType")
if boolContain is true then
  set ocidClassesArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
ocidClassesArrayM's addObject:(refMe's NSString)
  set ocidReadArray to ocidPasteboard's readObjectsForClasses:(ocidClassesArrayM) options:(missing value)
end if
set ocidReadStrings to ocidReadArray's firstObject()

########################
## 改行区切りでリスト化
########################
set ocidLFChar to refMe's NSString's stringWithString:("\n")
set ocidLineArray to (ocidReadStrings's componentsSeparatedByString:(ocidLFChar))
###############################
## テキスト形式のURLをNSURLに
###############################
#URLとポストスクリプト名を格納するDICT
set ocidFilePathDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
#URLだけを格納するARRAY
set ocidFileURLArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
#PostScriptNameの保存用
set ocidPostScriptNameArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
#コピーしたファイルの数だけ繰り返し
repeat with itemArray in ocidLineArray
  ##URLに
  set ocidURL to (refMe's NSURL's alloc()'s initWithString:(itemArray))
  #fragmentを取得して
  set ocidFragment to ocidURL's fragment()
  if ocidFragment = (missing value) then
return "FontBooKで選んでください"
  end if
  #fragmentからPostScriptNameの取得
  set ocidSepChar to (refMe's NSString's stringWithString:("="))
  set ocidFragmentArray to (ocidFragment's componentsSeparatedByString:(ocidSepChar))
  set ocidPostScriptName to (ocidFragmentArray's objectAtIndex:(1))
  #PostScript名用のリストに追加していく
(ocidPostScriptNameArray's addObject:(ocidPostScriptName))
  #NSURLComponentsに分割して
  set ocidURLomponents to (refMe's NSURLComponents's componentsWithURL:(ocidURL) resolvingAgainstBaseURL:(false))
  #fragmentを削除してNSURLにする
(ocidURLomponents's setFragment:(missing value))
  set ocidFilePathURL to ocidURLomponents's |URL|
  #ファイル名
  set ocidFileName to ocidFilePathURL's lastPathComponent()
  #リストに追加していく
(ocidFileURLArray's addObject:(ocidFilePathURL))
  #DICTに追加していく
(ocidFilePathDict's setObject:(ocidFilePathURL) forKey:(ocidPostScriptName))
end repeat

###############################
## 保存先
###############################
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
tell application "Finder"
  set aliasDefaultLocation to path to desktop folder from user domain as alias
end tell
try
  set aliasFolderPath to (choose folder "出来あがり画像の保存先フォルダを選んでください" with prompt "出来あがり画像の保存先フォルダを選択してください" default location aliasDefaultLocation without multiple selections allowed, invisibles and showing package contents) as alias
on error
log "エラーしました"
return
end try
###保存先フォルダパス
set strSaveDirPath to (POSIX path of aliasFolderPath) as text
set ocidSaveDirPathStr to refMe's NSString's stringWithString:(strSaveDirPath)
set ocidSaveDirPath to ocidSaveDirPathStr's stringByStandardizingPath()
set ocidSaveDirPathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidSaveDirPath) isDirectory:true)
###############################
## 背景色
###############################
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 the listRGB16bitColor to (choose color default color {65535, 55535, 0, 0}) as list
set numRcolor16Bit to (item 1 of listRGB16bitColor) as integer
set numGcolor16Bit to (item 2 of listRGB16bitColor) as integer
set numBcolor16Bit to (item 3 of listRGB16bitColor) as integer
#
set numRcolorFloat to (numRcolor16Bit / 65535) as number
set numGcolorFloat to (numGcolor16Bit / 65535) as number
set numBcolorFloat to (numBcolor16Bit / 65535) as number
###############################
## 文字色
###############################
set the listRGB16bitColor to (choose color default color {0, 0, 0, 0}) as list
set numRcolor16Bit to (item 1 of listRGB16bitColor) as integer
set numGcolor16Bit to (item 2 of listRGB16bitColor) as integer
set numBcolor16Bit to (item 3 of listRGB16bitColor) as integer
#
set numRcolorFloatText to (numRcolor16Bit / 65535) as number
set numGcolorFloatText to (numGcolor16Bit / 65535) as number
set numBcolorFloatText to (numBcolor16Bit / 65535) as number

###############################
## PostScriptNameArrayの処理
###############################
###画像サイズ
set intWidthPx to 1214 as integer
set intHightPx to 2160 as integer
###余白 px
set numPadding to 10 as integer

###カーニング値 詰めたい場合は -1.7 等マイナス値
set numKern to 0 as number
### テキスト色の透過   透過あり 0.0 - 1.0 透過なし
set numAlpha to 1.0 as number
###ドロップシャドウの有無 true or false
set boolDropShadow to false as boolean


repeat with itemArray in ocidPostScriptNameArray
  set strPostScriptName to itemArray as text
  #
  set intWidth to intWidthPx as integer
  set intHight to intHightPx as integer
  ###################################################
  ##画像生成開始
  set ocidBitmapFormat to refMe's NSBitmapFormatAlphaFirst
  set ocidColorSpaceName to refMe's NSDeviceRGBColorSpace
  set ocidNSBitmapImageFileType to refMe's NSBitmapImageFileTypePNG
  set ocidArtBoardRep to (refMe's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:(intWidth) pixelsHigh:(intHight) bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(ocidColorSpaceName) bitmapFormat:(ocidBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
  ###################################################
  ###初期化
refMe's NSGraphicsContext's saveGraphicsState()
  ###Context
  set ocidContext to (refMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:(ocidArtBoardRep))
  ###生成された画像でNSGraphicsContext初期化
(refMe's NSGraphicsContext's setCurrentContext:(ocidContext))
  ###塗り色
  set ocidSetColor to (refMe's NSColor's colorWithDeviceRed:(numRcolorFloat) green:(numGcolorFloat) blue:(numBcolorFloat) alpha:1)
ocidSetColor's |set|()
  ##画像にする
refMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:intWidth, height:intHight}})
  ####画像作成終了
refMe's NSGraphicsContext's restoreGraphicsState()
  
  ###################################
  #####テキスト生成
  ###################################
  ###フォント初期化
  set appFontManager to refMe's NSFontManager
  set appSharedMaanager to appFontManager's sharedFontManager()
  
  ###設定用のレコード
  set ocidTextAttr to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
  ###################
  ###文字色
  set ocidTextColor to (refMe's NSColor's colorWithSRGBRed:(numRcolorFloatText) green:(numGcolorFloatText) blue:(numBcolorFloatText) alpha:(numAlpha))
  #
(ocidTextAttr's setObject:(ocidTextColor) forKey:(refMe's NSForegroundColorAttributeName))
  
  ###################
  ##行間
  set ocidStyle to refMe's NSParagraphStyle's defaultParagraphStyle
(ocidTextAttr's setObject:(ocidStyle) forKey:(refMe's NSParagraphStyleAttributeName))
  ###################
  ##カーニング
  set ocidKern to numKern
(ocidTextAttr's setObject:(ocidKern) forKey:(refMe's NSKernAttributeName))
  ###################
  if boolDropShadow is true then
    ##ドロップシャドウ
    set ocidShadow to refMe's NSShadow's alloc()'s init()
    ###テキスト色と同色にする場合
    set ocidShadowColor to (ocidTextColor's colorWithAlphaComponent:0.8)
    ###色指定する場合
    set ocidShadowColor to (refMe's NSColor's colorWithDeviceRed:0 green:0 blue:0 alpha:0.5)
(ocidShadow's setShadowColor:(ocidShadowColor))
(ocidShadow's setShadowOffset:(refMe's NSMakeSize(1, -1)))
(ocidShadow's setShadowBlurRadius:4)
(ocidTextAttr's setObject:(ocidShadow) forKey:(refMe's NSShadowAttributeName))
  end if
  ###################
  set ocidTempFont to (refMe's NSFont's fontWithName:(strPostScriptName) matrix:(missing value))
  set strDisplayName to ocidTempFont's displayName as text
  ##描画する文字列
  set ocidText1 to (refMe's NSString's stringWithString:(strDisplayName))
  set ocidText2 to (refMe's NSString's stringWithString:(strPostScriptName))
  set ocidText3 to (refMe's NSString's stringWithString:(strInputText3))
  set ocidText4 to (refMe's NSString's stringWithString:(strInputText4))
  set ocidText5 to (refMe's NSString's stringWithString:(strInputText5))
  set ocidText6 to (refMe's NSString's stringWithString:(strInputText6))
  #
  set ocidText7 to (refMe's NSString's stringWithString:(strInputText7))
  ###################
  ####モバイル端末用の位置調整
  set intHight to (intHight - 140) as integer
  set numHightPost to intHight
  ####描画されるテキストボックスのサイズ
  ##【52】フォント サイズ
  ###フォントサイズ
  set numFontSize to 52 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
  #
  set ocidTextSize1 to (ocidText1's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize1's width)) / 2) as integer
  set numTextHigh to (intHight - (ocidTextSize1's height)) as integer
  set numTextHigh1 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin1 to refMe's NSMakePoint(numTextwidth, numTextHigh1)
  #
  set ocidTextSize2 to (ocidText2's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize2's width)) / 2) as integer
  set numTextHigh to (numTextHigh1 - (ocidTextSize2's height)) as integer
  set numTextHigh2 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin2 to refMe's NSMakePoint(numTextwidth, numTextHigh2)
  #
  set ocidTextSize3 to (ocidText3's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize3's width)) / 2) as integer
  set numTextHigh to (numTextHigh2 - (ocidTextSize3's height)) as integer
  set numTextHigh3 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin3 to refMe's NSMakePoint(numTextwidth, numTextHigh3)
  #
  set ocidTextSize4 to (ocidText4's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize4's width)) / 2) as integer
  set numTextHigh to (numTextHigh3 - (ocidTextSize4's height)) as integer
  set numTextHigh4 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin4 to refMe's NSMakePoint(numTextwidth, numTextHigh4)
  #
  set ocidTextSize5 to (ocidText5's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize5's width)) / 2) as integer
  set numTextHigh to (numTextHigh4 - (ocidTextSize5's height)) as integer
  set numTextHigh5 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin5 to refMe's NSMakePoint(numTextwidth, numTextHigh5)
  #
  set ocidTextSize6 to (ocidText6's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize6's width)) / 2) as integer
  set numTextHigh to (numTextHigh5 - (ocidTextSize6's height)) as integer
  set numTextHigh6 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin6 to refMe's NSMakePoint(numTextwidth, numTextHigh6)
  #############################
  ##【36】フォント サイズ
  set numFontSize to 36 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:(numFontSize))
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
  #余白分
  set numTextHigh6 to (numTextHigh6 - numFontSize) as integer
  #
  set ocidTextSize7 to (ocidText3's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize7's width)) / 2) as integer
  set numTextHigh to (numTextHigh6 - (ocidTextSize7's height)) as integer
  set numTextHigh7 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin7 to refMe's NSMakePoint(numTextwidth, numTextHigh7)
  #
  set ocidTextSize8 to (ocidText4's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize8's width)) / 2) as integer
  set numTextHigh to (numTextHigh7 - (ocidTextSize8's height)) as integer
  set numTextHigh8 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin8 to refMe's NSMakePoint(numTextwidth, numTextHigh8)
  #
  set ocidTextSize9 to (ocidText5's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize9's width)) / 2) as integer
  set numTextHigh to (numTextHigh8 - (ocidTextSize9's height)) as integer
  set numTextHigh9 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin9 to refMe's NSMakePoint(numTextwidth, numTextHigh9)
  #
  set ocidTextSize10 to (ocidText6's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize10's width)) / 2) as integer
  set numTextHigh to (numTextHigh9 - (ocidTextSize10's height)) as integer
  set numTextHigh10 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin10 to refMe's NSMakePoint(numTextwidth, numTextHigh10)
  #############################
  ##【72】フォント サイズ
  set numFontSize to 72 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
  #余白分
  set numTextHigh10 to (numTextHigh10 - numFontSize) as integer
  #
  set ocidTextSize11 to (ocidText3's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize11's width)) / 2) as integer
  set numTextHigh to (numTextHigh10 - (ocidTextSize11's height)) as integer
  set numTextHigh11 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin11 to refMe's NSMakePoint(numTextwidth, numTextHigh11)
  #
  set ocidTextSize12 to (ocidText4's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize12's width)) / 2) as integer
  set numTextHigh to (numTextHigh11 - (ocidTextSize12's height)) as integer
  set numTextHigh12 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin12 to refMe's NSMakePoint(numTextwidth, numTextHigh12)
  #
  set ocidTextSize13 to (ocidText5's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize13's width)) / 2) as integer
  set numTextHigh to (numTextHigh12 - (ocidTextSize13's height)) as integer
  set numTextHigh13 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin13 to refMe's NSMakePoint(numTextwidth, numTextHigh13)
  #
  set ocidTextSize14 to (ocidText6's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize14's width)) / 2) as integer
  set numTextHigh to (numTextHigh13 - (ocidTextSize14's height)) as integer
  set numTextHigh14 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin14 to refMe's NSMakePoint(numTextwidth, numTextHigh14)
  #############################
  ##【96】フォント サイズ
  set numFontSize to 96 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
  #余白分
  set numTextHigh14 to (numTextHigh14 - numFontSize) as integer
  #
  # set ocidTextSize15 to (ocidText3's sizeWithAttributes:(ocidTextAttr))
  set ocidTextSize15 to (ocidText7's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize15's width)) / 2) as integer
  set numTextHigh to (numTextHigh14 - (ocidTextSize15's height)) as integer
  set numTextHigh15 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin15 to refMe's NSMakePoint(numTextwidth, numTextHigh15)
  #
  set ocidTextSize16 to (ocidText4's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize16's width)) / 2) as integer
  set numTextHigh to (numTextHigh15 - (ocidTextSize16's height)) as integer
  set numTextHigh16 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin16 to refMe's NSMakePoint(numTextwidth, numTextHigh16)
  #
  set ocidTextSize17 to (ocidText5's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize17's width)) / 2) as integer
  set numTextHigh to (numTextHigh16 - (ocidTextSize17's height)) as integer
  set numTextHigh17 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin17 to refMe's NSMakePoint(numTextwidth, numTextHigh17)
  #
  set ocidTextSize18 to (ocidText6's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize18's width)) / 2) as integer
  set numTextHigh to (numTextHigh17 - (ocidTextSize18's height)) as integer
  set numTextHigh18 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin18 to refMe's NSMakePoint(numTextwidth, numTextHigh18)
  
  
  #############################
  ##【48】フォント サイズ
  set numFontSize to 48 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
  #余白分
  set numTextHigh18 to (numTextHigh18 - numFontSize) as integer
  #
  set ocidTextSize19 to (ocidText1's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize19's width)) / 2) as integer
  set numTextHigh to ((ocidTextSize19's height)) as integer
  set numTextHigh19 to (((numTextHigh * 2) + (numFontSize / 3))) as integer
  set ocidTextOrigin19 to refMe's NSMakePoint(numTextwidth, numTextHigh19)
  #
  set ocidTextSize20 to (ocidText2's sizeWithAttributes:(ocidTextAttr))
  set numTextwidth to ((intWidth - (ocidTextSize20's width)) / 2) as integer
  set numTextHigh to ((ocidTextSize20's height)) as integer
  set numTextHigh20 to ((numTextHigh - (numFontSize / 3))) as integer
  set ocidTextOrigin20 to refMe's NSMakePoint(numTextwidth, numTextHigh20)
  
  ###################################
  #####テキスト描画 本処理
  ###################################
  ####NSGraphicsContextは透明アートボード
  set ocidContext to (refMe's NSGraphicsContext's graphicsContextWithBitmapImageRep:(ocidArtBoardRep))
  ###初期化
refMe's NSGraphicsContext's saveGraphicsState()
  ###透明アートボードでNSGraphicsContext初期化
(refMe's NSGraphicsContext's setCurrentContext:(ocidContext))
  
  ###テキスト描画する
  set numFontSize to 52 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
(ocidText1's drawAtPoint:(ocidTextOrigin1) withAttributes:(ocidTextAttr))
(ocidText2's drawAtPoint:(ocidTextOrigin2) withAttributes:(ocidTextAttr))
(ocidText3's drawAtPoint:(ocidTextOrigin3) withAttributes:(ocidTextAttr))
(ocidText4's drawAtPoint:(ocidTextOrigin4) withAttributes:(ocidTextAttr))
(ocidText5's drawAtPoint:(ocidTextOrigin5) withAttributes:(ocidTextAttr))
(ocidText6's drawAtPoint:(ocidTextOrigin6) withAttributes:(ocidTextAttr))
  #
  set numFontSize to 36 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
(ocidText3's drawAtPoint:(ocidTextOrigin7) withAttributes:(ocidTextAttr))
(ocidText4's drawAtPoint:(ocidTextOrigin8) withAttributes:(ocidTextAttr))
(ocidText5's drawAtPoint:(ocidTextOrigin9) withAttributes:(ocidTextAttr))
(ocidText6's drawAtPoint:(ocidTextOrigin10) withAttributes:(ocidTextAttr))
  #
  set numFontSize to 72 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
(ocidText3's drawAtPoint:(ocidTextOrigin11) withAttributes:(ocidTextAttr))
(ocidText4's drawAtPoint:(ocidTextOrigin12) withAttributes:(ocidTextAttr))
(ocidText5's drawAtPoint:(ocidTextOrigin13) withAttributes:(ocidTextAttr))
(ocidText6's drawAtPoint:(ocidTextOrigin14) withAttributes:(ocidTextAttr))
  #
  set numFontSize to 96 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
  # (ocidText3's drawAtPoint:(ocidTextOrigin15) withAttributes:(ocidTextAttr))
(ocidText7's drawAtPoint:(ocidTextOrigin15) withAttributes:(ocidTextAttr))
  # (ocidText4's drawAtPoint:(ocidTextOrigin16) withAttributes:(ocidTextAttr))
  # (ocidText5's drawAtPoint:(ocidTextOrigin17) withAttributes:(ocidTextAttr))
  # (ocidText6's drawAtPoint:(ocidTextOrigin18) withAttributes:(ocidTextAttr))
  
  #
  set numFontSize to 48 as integer
  set ocidFont to (refMe's NSFont's fontWithName:(strPostScriptName) |size|:numFontSize)
(ocidTextAttr's setObject:(ocidFont) forKey:(refMe's NSFontAttributeName))
(ocidText1's drawAtPoint:(ocidTextOrigin19) withAttributes:(ocidTextAttr))
(ocidText2's drawAtPoint:(ocidTextOrigin20) withAttributes:(ocidTextAttr))
  
  
  ####画像作成終了
refMe's NSGraphicsContext's restoreGraphicsState()
  ###################################################
  ###プロパティ
  set ocidProperty to (refMe's NSMutableDictionary's alloc()'s initWithCapacity:0)
  ###
  set ocidColorSpace to refMe's NSColorSpace's displayP3ColorSpace()
  set ocidColorSpaceData to ocidColorSpace's ICCProfileData()
(ocidProperty's setObject:(ocidColorSpaceData) forKey:(refMe's NSImageColorSyncProfileData))
  ###
(ocidProperty's setObject:(false) forKey:(refMe's NSImageInterlaced))
  ###
  set numGamma to (1 / 2.2) as number
(ocidProperty's setObject:(false) forKey:(refMe's NSImageGamma))
  ####DATAに
  set ocidNSInlineData to (ocidArtBoardRep's representationUsingType:(ocidNSBitmapImageFileType) |properties|:(ocidProperty))
  ###################################
  #####保存
  ###################################
  
  ###ファイル名はフォント名
  set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strPostScriptName) isDirectory:false)
  set ocidFilePathURL to (ocidSaveFilePathURL's URLByAppendingPathExtension:"png")
  ###保存
  set boolDone to (ocidNSInlineData's writeToURL:(ocidFilePathURL) atomically:true)
  set ocidNSInlineData to ""
  set ocidContext to ""
  
  
  
end repeat





|

FontBookからコピーした値からパスやPostscript名を取得する


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

#!/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 "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application


########################
## クリップボードの中身取り出し
########################
###初期化
set ocidPasteboard to refMe's NSPasteboard's generalPasteboard()
##中身の要素
set ocidPastBoardTypeArray to ocidPasteboard's types
#
set boolContain to ocidPastBoardTypeArray's containsObject:("NSStringPboardType")
if boolContain is true then
  set ocidClassesArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
ocidClassesArrayM's addObject:(refMe's NSString)
  set ocidReadArray to ocidPasteboard's readObjectsForClasses:(ocidClassesArrayM) options:(missing value)
end if
set ocidReadStrings to ocidReadArray's firstObject()

########################
## 改行区切りでリスト化
########################
set ocidLFChar to refMe's NSString's stringWithString:("\n")
set ocidLineArray to (ocidReadStrings's componentsSeparatedByString:(ocidLFChar))
###############################
## テキスト形式のURLをNSURLに
###############################
#URLとポストスクリプト名を格納するDICT
set ocidFilePathDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
#URLだけを格納するARRAY
set ocidFileURLArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
#PostScriptNameの保存用
set ocidPostScriptNameArray to refMe's NSMutableArray's alloc()'s initWithCapacity:(0)
#コピーしたファイルの数だけ繰り返し
repeat with itemArray in ocidLineArray
  ##URLに
  set ocidURL to (refMe's NSURL's alloc()'s initWithString:(itemArray))
  #fragmentを取得して
  set ocidFragment to ocidURL's fragment()
  if ocidFragment = (missing value) then
return "FontBooKで選んでください"
  end if
  #fragmentからPostScriptNameの取得
  set ocidSepChar to (refMe's NSString's stringWithString:("="))
  set ocidFragmentArray to (ocidFragment's componentsSeparatedByString:(ocidSepChar))
  set ocidPostScriptName to (ocidFragmentArray's objectAtIndex:(1))
  #PostScript名用のリストに追加していく
(ocidPostScriptNameArray's addObject:(ocidPostScriptName))
  #NSURLComponentsに分割して
  set ocidURLomponents to (refMe's NSURLComponents's componentsWithURL:(ocidURL) resolvingAgainstBaseURL:(false))
  #fragmentを削除してNSURLにする
(ocidURLomponents's setFragment:(missing value))
  set ocidFilePathURL to ocidURLomponents's |URL|
  #ファイル名
  set ocidFileName to ocidFilePathURL's lastPathComponent()
  #リストに追加していく
(ocidFileURLArray's addObject:(ocidFilePathURL))
  #DICTに追加していく
(ocidFilePathDict's setObject:(ocidFilePathURL) forKey:(ocidPostScriptName))
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