フォント名を選ぶ
#!/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.6"
use framework "foundation"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application
##デフォルト
set strDefailtsFont to "Osaka-Mono" as text
set appFontManager to refMe's NSFontManager
set appSharedMaanager to appFontManager's sharedFontManager()
set ocidFontListArray to appSharedMaanager's availableFonts()
set numDefaultsFont to (ocidFontListArray's indexOfObject:(strDefailtsFont)) as integer
set listFontList to ocidFontListArray as list
try
set listResponse to (choose from list listFontList with title "選んでください" with prompt "フォントを選んでください" default items (item numDefaultsFont of listFontList) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
on error
log "エラーしました"
return "エラーしました"
end try
if listResponse is false then
return "キャンセルしました"
end if
set strFontName to (item 1 of listResponse)
| 固定リンク
「NSFontManager」カテゴリの記事
- [NSFontManager]フォント名の取得(修正)(2024.12.24)
- [NSFont]フォント名の取得(フォント名=FULLNAME 英語 日本語ローカライズ名 postscript名)(2024.12.11)
- Fontのpostscript名を取得する(訂正)(2024.09.24)
- [NSFontManager]フォントのリストを取得する(基本編)(2024.06.18)
- [font book]フォントライブラリを作成する(2023.06.19)