Menu

Skip to content
AppleScriptの穴
  • Home
  • Products
  • Books
  • Docs
  • Events
  • Forum
  • About This Blog
  • License
  • 仕事依頼

AppleScriptの穴

Useful & Practical AppleScript archive. Click '★Click Here to Open This Script' Link to download each AppleScript

カテゴリー: Calendar

CotEditorの最前面のテキストの日付フォーマットを変換する

Posted on 7月 7, 2018 by Takaaki Naganoya

CotEditorでオープン中の最前面の書類中のテキストの、日付フォーマットを変換するAppleScriptです。


▲スクリーンショットは作成中のものです

Blogのアーカイブ本のオマケとして(記事だけだとウンザリする仕上がりだったので)、冒頭にその年に何があったかをAppleのニュースリリースから抽出して掲載してみたのですが、日付の形式が独特だったので、手で打ち直していました。

繰り返して行うと面倒だったので、NSDataDetectorで自然言語テキスト(CotEditorの本文テキスト)から日付を自動検出して書き換えを試みたのですが、NSDataDetectorではこのサンプルのようなほんのちょっとだけ手の加わった日付テキストでは検出してくれませんでした。

一応、フォーマット自体は固定だったので、フォーマッターだけ指定すれば日付テキストとして認識し、常識的なYYYY/MM/DDの日付フォーマットに書き換えるようにしてみました。


▲日付フォーマット文字列の入力


▲日付フォーマット置換したテキスト(処理は一瞬)

ただし、日付フォーマットテキストが行で独立しているもの(添付スクリーンショットのように)を処理対象にしているので、あまり汎用性はなさそうです。

一般的には正規表現で指定することになるんでしょうけれど、その正規表現というかもともとの日付フォーマットを元のテキストから自動検出してくれることがベストだと思います。

なお、CotEditorに依存した処理はひとつもないので、JeditΩでもmiでもテキストエディットでもTextWranglerでもBBEditでも、対象にして処理することはかんたんです。クリップボードの内容に対して処理したほうがいいのかもしれません。

AppleScript名:CotEditorの最前面のテキストの日付フォーマットを変換する
— Created 2018-07-07 by Takaaki Naganoya
— 2018 Piyomaru Software
use AppleScript version "2.5"
use framework "Foundation"
use scripting additions

property NSArray : a reference to current application’s NSArray
property NSString : a reference to current application’s NSString
property NSLocale : a reference to current application’s NSLocale
property NSDictionary : a reference to current application’s NSDictionary
property NSCountedSet : a reference to current application’s NSCountedSet
property NSMutableArray : a reference to current application’s NSMutableArray
property NSSortDescriptor : a reference to current application’s NSSortDescriptor
property NSDateFormatter : a reference to current application’s NSDateFormatter

set tmpArray to NSMutableArray’s new()

–変換元(テキストから自動取得できるとよかったのに)
set dFfromStr to text returned of (display dialog "Input Date Format:(年=yyyy, 月=MM, 日=dd)" default answer "MM月 dd, yyyy")

–変換先
set dOutFormStr to "yyyy/MM/dd"

tell application "CotEditor"
  tell front document
    set aRes to contents of it
  end tell
  
  
set aList to paragraphs of aRes
end tell

repeat with i in aList
  set j to contents of i
  
set theDate to dateFromStringWithDateFormat(j, dFfromStr) of me
  
if theDate is not equal to missing value then
    set newDateStr to convDateObjToStrWithFormat(theDate, dOutFormStr) of me
    (
tmpArray’s addObject:newDateStr)
  else
    (tmpArray’s addObject:j)
  end if
end repeat

–NSArrayを指定デリミタをはさんでテキスト化
set tRes to tmpArray’s componentsJoinedByString:(return)
set ttRes to tRes as string

tell application "CotEditor"
  tell front document
    set (contents of it) to ttRes
  end tell
end tell

–日付文字列からdate objectを作成する
on dateFromStringWithDateFormat(dateString as string, dateFormat as string)
  set dStr to NSString’s stringWithString:dateString
  
set dateFormatStr to NSString’s stringWithString:dateFormat
  
  
set aDateFormatter to NSDateFormatter’s alloc()’s init()
  
aDateFormatter’s setDateFormat:dateFormatStr
  
aDateFormatter’s setLocale:(NSLocale’s alloc()’s initWithLocaleIdentifier:"en_US_POSIX")
  
  
set aDestDate to (aDateFormatter’s dateFromString:dStr)
  
  
return aDestDate as list of string or string
end dateFromStringWithDateFormat

–date objectから指定の日付文字列を作成する
on convDateObjToStrWithFormat(aDateO as date, aFormatStr as string)
  set aDF to NSDateFormatter’s alloc()’s init()
  
  
set aLoc to NSLocale’s currentLocale()
  
set aLocStr to (aLoc’s localeIdentifier()) as string
  
  
aDF’s setLocale:(NSLocale’s alloc()’s initWithLocaleIdentifier:aLocStr)
  
aDF’s setDateFormat:aFormatStr
  
set dRes to (aDF’s stringFromDate:aDateO) as string
  
return dRes
end convDateObjToStrWithFormat

★Click Here to Open This Script 

(Visited 168 times, 1 visits today)
Posted in Calendar Text | Tagged 10.11savvy 10.12savvy 10.13savvy CotEditor NSArray NSCountedSet NSDateFormatter NSDictionary NSLocale NSMutableArray NSSortDescriptor NSString | Leave a comment

日付テキストを年単位で集計

Posted on 6月 29, 2018 by Takaaki Naganoya

yyyy-MM-dd HH:mm:ss形式の日付テキストをdateオブジェクトに変換して日付を年単位で集計するAppleScriptです。

Blog Archiveのデータベースのダンプテキストを読み取って、年別の投稿記事本数の集計を行うために作成しました(といっても、既存のルーチンを組み合わせただけです)。

AppleScript名:日付テキストを年単位で集計
— Created 2018-06-28 by Takaaki Naganoya
— 2018 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

property NSArray : a reference to current application’s NSArray
property NSString : a reference to current application’s NSString
property NSLocale : a reference to current application’s NSLocale
property NSDictionary : a reference to current application’s NSDictionary
property NSCountedSet : a reference to current application’s NSCountedSet
property NSMutableArray : a reference to current application’s NSMutableArray
property NSSortDescriptor : a reference to current application’s NSSortDescriptor
property NSDateFormatter : a reference to current application’s NSDateFormatter

set aList to {"2006-06-27 02:38:52", "2008-03-09 19:08:05", "2008-03-09 19:29:29"}
set aRes to totalDateStrByYear(aList, "yyyy-MM-dd HH:mm:ss") of me
–> {{aCount:1, aKey:2006}, {aCount:2, aKey:2008}}

–日付テキストを年単位で集計
on totalDateStrByYear(aList, strFormat)
  set theCountedSet to NSCountedSet’s |set|()
  
set newArray to NSMutableArray’s new()
  
  
repeat with i in aList
    set postDate to dateFromStringWithDateFormat(i, strFormat) of me –日付テキストをDate Objectに変換
    
set yearStr to (year of postDate) –「年」の数字
    (
newArray’s addObject:yearStr)
  end repeat
  
  
set resArray to countItemsByItsAppearance(newArray) of me
  
set bList to sortRecListByLabel(resArray, "aKey", true) of me –昇順ソート
  
return bList
end totalDateStrByYear

–日付文字列からdate objectを作成する
on dateFromStringWithDateFormat(dateString, dateFormat)
  set dStr to NSString’s stringWithString:dateString
  
set dateFormatStr to NSString’s stringWithString:dateFormat
  
  
set aDateFormatter to NSDateFormatter’s alloc()’s init()
  
aDateFormatter’s setDateFormat:dateFormatStr
  
aDateFormatter’s setLocale:(NSLocale’s alloc()’s initWithLocaleIdentifier:"en_US_POSIX")
  
  
set aDestDate to (aDateFormatter’s dateFromString:dStr)
  
  
return aDestDate as list of string or string
end dateFromStringWithDateFormat

–登場頻度でリストを集計する
on countItemsByItsAppearance(aList)
  set aSet to NSCountedSet’s alloc()’s initWithArray:aList
  
set bArray to NSMutableArray’s array()
  
set theEnumerator to aSet’s objectEnumerator()
  
  
repeat
    set aValue to theEnumerator’s nextObject()
    
if aValue is missing value then exit repeat
    
bArray’s addObject:(NSDictionary’s dictionaryWithObjects:{aValue, (aSet’s countForObject:aValue)} forKeys:{"aKey", "aCount"})
  end repeat
  
  
return bArray
end countItemsByItsAppearance

–リストに入れたレコードを、指定の属性ラベルの値でソート
on sortRecListByLabel(aRecList as list, aLabelStr as string, ascendF as boolean)
  set aArray to NSArray’s arrayWithArray:aRecList
  
  
set sortDesc to NSSortDescriptor’s alloc()’s initWithKey:aLabelStr ascending:ascendF
  
set sortDescArray to NSArray’s arrayWithObjects:sortDesc
  
set sortedArray to aArray’s sortedArrayUsingDescriptors:sortDescArray
  
  
set bList to (sortedArray) as list of string or string
  
return bList
end sortRecListByLabel

★Click Here to Open This Script 

(Visited 41 times, 1 visits today)
Posted in Calendar list | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

指定の画像からEXIFの撮影日付(DateTimeOriginal)を取得 v2

Posted on 5月 31, 2018 by Takaaki Naganoya

指定の画像からEXIF情報を取得し、撮影日付(DateTimeOriginal)を取得するAppleScriptです。

Image Eventsで取得するよりも、BridgePlusで取得するほうが高速だったので差し替えてみました。

AppleScript名:指定の画像からEXIFの撮影日付(DateTimeOriginal)を取得 v2
— Created 2014-12-14 by Takaaki Naganoya
— 2014 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use BPlus : script "BridgePlus" –https://www.macosxautomation.com/applescript/apps/BridgePlus.html

property NSString : a reference to current application’s NSString
property NSLocale : a reference to current application’s NSLocale
property SMSForder : a reference to current application’s SMSForder
property NSDateFormatter : a reference to current application’s NSDateFormatter

set aTargFile to choose file of type {"public.image"}
set exifRes to readExifDateTimeOriginal(aTargFile) of me

–指定ファイルからのExifデータを取得し撮影日付を取得する
on readExifDateTimeOriginal(aTargFileAlias)
  set theMetadata to readMetadataFrom(aTargFileAlias) of me
  
set keysList to theMetadata’s allKeys()
  
  
if "{Exif}" is not in (keysList as list) then return false
  
  
set exifDate to theMetadata’s valueForKeyPath:"{Exif}.DateTimeOriginal"
  
if exifDate = missing value then return false
  
  
set fullDate to dateFromStringWithDateFormat(exifDate, "yyyy:MM:dd HH:mm:ss") of me
  
  
return fullDate
end readExifDateTimeOriginal

–指定ファイルからのメタデータ読み込み
on readMetadataFrom(imageFile)
  load framework
  
set {theRecord, theError} to SMSForder’s metadataFromImage:imageFile |error|:(reference)
  
if theRecord = missing value then — there was a problem, so extract the error description
    error (theError’s localizedDescription() as text) — number (theError’s code())
  else
    return theRecord
  end if
end readMetadataFrom

–日付文字列を形式指定しつつdate objectに変換
on dateFromStringWithDateFormat(dateString, dateFormat)
  set dStr to NSString’s stringWithString:dateString
  
set dateFormatStr to NSString’s stringWithString:dateFormat
  
  
set aDateFormatter to NSDateFormatter’s alloc()’s init()
  
aDateFormatter’s setDateFormat:dateFormatStr
  
aDateFormatter’s setLocale:(NSLocale’s alloc()’s initWithLocaleIdentifier:"en_US_POSIX")
  
  
set aDestDate to (aDateFormatter’s dateFromString:dStr)
  
  
return aDestDate as list of string or string
end dateFromStringWithDateFormat

★Click Here to Open This Script 

(Visited 147 times, 1 visits today)
Posted in Calendar exif file Image | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

Geofenceを付けつつReminder項目を追加

Posted on 5月 5, 2018 by Takaaki Naganoya

Reminders.app(リマインダー)に新規リマインド項目を作成し、Geofenceを設定するAppleScriptです。

Reminders.appのAppleScript用語辞書にはGeofence作成機能は用意されていないため、Cocoaの機能を利用して追加しました。

Geofenceは、指定の緯度・経度のポイントから半径xxxメートルの円の中に入る場合に発生するアラーム(Enter Alarm)、脱出する場合に発生するアラーム(Leave Alarm)の2種類を設定できます。

Mac上のReminders.app上で登録したこのリマインド項目がiCloud経由でiPhoneにシンクロされ、iPhoneを持って当該期間中に指定場所に行って半径200メートルの円の中から出るとアラームが表示されることになります。

AppleScript名:Geofenceを付けつつReminder項目を追加
— Created 2014-12-08 by Shane Stanley
— Modified 2015-09-24 by Takaaki Naganoya –Geofence Alarm
— Modified 2015-09-24 by Shane Stanley –Fix the way to Create the geofence alarm
— Modified 2015-09-24 by Takaaki Naganoya –change and test for El Capitan’s Enum bridging
–Reference:
–http://stackoverflow.com/questions/26903847/add-location-to-ekevent-ios-calendar
–http://timhibbard.com/blog/2013/01/03/how-to-create-remove-and-manage-geofence-reminders-in-ios-programmatically-with-xcode/
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"
use framework "EventKit"

property EKAlarm : a reference to current application’s EKAlarm
property CLLocation : a reference to current application’s CLLocation
property EKEventStore : a reference to current application’s EKEventStore
property EKStructuredLocation : a reference to current application’s EKStructuredLocation
property EKEntityMaskReminder : a reference to current application’s EKEntityMaskReminder
property EKAlarmProximityEnter : a reference to current application’s EKAlarmProximityEnter
property EKAlarmProximityLeave : a reference to current application’s EKAlarmProximityLeave

–Start Date
set dSt to "2018/06/01 00:00:00"
set dateO1 to date dSt

–End Date
set dSt2 to "2018/08/01 00:00:00"
set dateO2 to date dSt2

tell application "Reminders"
  if not (exists list "test") then
    make new list with properties {name:"test"}
  end if
  
  
tell list "test"
    set aReminder to (make new reminder with properties {name:"Test1", body:"New Reminder", due date:dateO2, remind me date:dateO1, priority:9}) –priority 1:高、5:中、9:低、0:なし
    
set anID to id of aReminder
    
–> "x-apple-reminder://XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  end tell
end tell

set theID to text 20 thru -1 of anID
my setLocationToLeaveForReminderID(35.745769, 139.675565, "Target Place", theID, 200)

–指定場所に到着した時に発動するGeofence Alarmを指定のリマインダーに登録する。Geofence半径指定つき(単位:メートル)
on setLocationToEnterForReminderID(aLatitude, aLongitude, aTitle, theID, aRangeByMeter)
  — Get event store
  
set eventStore to EKEventStore’s alloc()’s initWithAccessToEntityTypes:(EKEntityMaskReminder)
  
  
— Get the reminder
  
set theReminder to eventStore’s calendarItemWithIdentifier:theID
  
  
–Create the geofence alarm
  
set enterAlarm to EKAlarm’s alarmWithRelativeOffset:0
  
enterAlarm’s setProximity:(EKAlarmProximityEnter)
  
set structLoc to EKStructuredLocation’s locationWithTitle:aTitle
  
set aLoc to CLLocation’s alloc()’s initWithLatitude:aLatitude longitude:aLongitude
  
structLoc’s setGeoLocation:aLoc
  
  
— Set radius by meters
  
structLoc’s setRadius:aRangeByMeter
  
enterAlarm’s setStructuredLocation:structLoc
  
  
theReminder’s addAlarm:enterAlarm
  
set aRes to eventStore’s saveReminder:theReminder commit:true |error|:(missing value)
  
  
return aRes as boolean
end setLocationToEnterForReminderID

–指定場所を出発した時に発動するGeofence Alarmを指定のリマインダーに登録する。Geofence半径指定つき(単位:メートル)
on setLocationToLeaveForReminderID(aLatitude, aLongitude, aTitle, theID, aRangeByMeter)
  — Get event store; 1 means reminders
  
set eventStore to EKEventStore’s alloc()’s initWithAccessToEntityTypes:(EKEntityMaskReminder)
  
  
— Get the reminder
  
set theReminder to eventStore’s calendarItemWithIdentifier:theID
  
  
–Create the geofence alarm
  
set leaveAlarm to EKAlarm’s alarmWithRelativeOffset:0
  
leaveAlarm’s setProximity:(EKAlarmProximityLeave)
  
set structLoc to EKStructuredLocation’s locationWithTitle:aTitle
  
set aLoc to CLLocation’s alloc()’s initWithLatitude:aLatitude longitude:aLongitude
  
structLoc’s setGeoLocation:aLoc
  
  
— Set radius by meters
  
structLoc’s setRadius:aRangeByMeter
  
leaveAlarm’s setStructuredLocation:structLoc
  
  
theReminder’s addAlarm:leaveAlarm
  
set aRes to eventStore’s saveReminder:theReminder commit:true |error|:(missing value)
  
  
return aRes as boolean
end setLocationToLeaveForReminderID

★Click Here to Open This Script 

(Visited 38 times, 1 visits today)
Posted in Calendar geolocation | Tagged 10.11savvy 10.12savvy 10.13savvy Reminders | Leave a comment

旧暦計算を行う

Posted on 5月 4, 2018 by Takaaki Naganoya

指定の年・月・日から旧暦の日付および六曜を計算するAppleScriptです。

旧暦は太陰暦で、月の満ち欠けを基準とした暦(こよみ)です。旧暦計算は各種関数が必要になるため、AppleScriptだけで計算させると骨が折れますが、これまでにも他の言語のプログラムを呼び出すかたちで計算ライブラリを利用してきました。

本Scriptでは、Objective-Cで書かれたプログラム(バンドル内にplistでデータを持つタイプ)をCocoa Framework化してAppleScriptから呼び出せるようにしたものです。

–> kyurekiKit.framework (To ~/Library/Frameworks)

きょうび、旧暦計算が必要な用途なんてカレンダー製作とか手帳製作あたりで、クライアント企業もだいたい決まっています。業界にその名もとどろく、事前に仕様を出さないのに仕様後出しじゃんけんをしまくって難癖をつけてくる悪名高い極悪非道クライアント様が。だいたいは、事前に旧暦計算データも支給されるので、自前で旧暦計算する必要性に遭遇したことはありません。

AppleScript名:旧暦計算を行う
— Created 2018-05-04 by Takaaki Naganoya
— 2018 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "KyurekiKit" –https://github.com/kyasusoft/Rokuyo
–2000年から2032年までのデータをFrameworkに内蔵

set curDat to current date
set curYear to year of curDat
set curMonth to month of curDat as number
set curDate to day of curDat

set r to current application’s KYRokuyo’s alloc()’s init()
set rokuyoText to (r’s sinrekiToRokuyoWithYear:curYear |month|:curMonth |day|:curDate) as string

set kyuMonth to (r’s kyuMonth) as integer
set kyuDay to (r’s kyuDay) as integer

return {kyuMonth, kyuDay, rokuyoText}
–>  {​​​​​3, ​​​​​19, ​​​​​"先負"​​​}

★Click Here to Open This Script 

(Visited 62 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

自然言語で指定した日時以降に作成されたファイルをSpotlight検索

Posted on 5月 3, 2018 by Takaaki Naganoya
AppleScript名:自然言語で指定した日時以降に作成されたファイルをSpotlight検索
— Created 2017-09-21 by Takaaki Naganoya
— Modified 2017-09-22 by Shane Stanley
— 2017 Piyomaru Software
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"
use mdLib : script "Metadata Lib" version "2.0.0"

property NSString : a reference to current application’s NSString
property NSDataDetector : a reference to current application’s NSDataDetector
property NSTextCheckingTypeDate : a reference to current application’s NSTextCheckingTypeDate

set aDate to getDatesIn("先週の月曜日") of me –"last Monday" in Japanese
log aDate

set thePath to POSIX path of (path to desktop)

set theFiles to mdLib’s searchFolders:{thePath} searchString:("kMDItemFSCreationDate >= %@") searchArgs:{aDate}
–> returns POSIX path list

on getDatesIn(aString)
  set anNSString to NSString’s stringWithString:aString
  
set theDetector to NSDataDetector’s dataDetectorWithTypes:(NSTextCheckingTypeDate) |error|:(missing value)
  
set theMatch to theDetector’s firstMatchInString:anNSString options:0 range:{0, anNSString’s |length|()}
  
if theMatch = missing value then error "No date found with String:" & aString
  
set theDate to theMatch’s |date|()
  
return theDate as date
end getDatesIn

★Click Here to Open This Script 

(Visited 34 times, 1 visits today)
Posted in Calendar file Spotlight | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

当日が1年の何週目かを求める

Posted on 4月 8, 2018 by Takaaki Naganoya
AppleScript名:当日が1年の何週目かを求める.scptd
—
–  Created by: Takaaki Naganoya
–  Created on: 2018/04/08
—
–  Copyright © 2018 Piyomaru Software, All Rights Reserved
—

use AppleScript version "2.4" — Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

set a1Unit to (current application’s NSWeekOfYearCalendarUnit)
set a2Unit to (current application’s NSDayCalendarUnit)
set a3Unit to (current application’s NSMonthCalendarUnit)
set a4Unit to (current application’s NSYearCalendarUnit)

set aCalendar to current application’s NSCalendar’s currentCalendar()
set aComponent to aCalendar’s components:(a1Unit + a2Unit + a3Unit + a4Unit) fromDate:(current application’s NSDate’s |date|())
set aWN to aComponent’s weekOfYear()
–> 15

★Click Here to Open This Script 

(Visited 27 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

現時点における年齢を計算する

Posted on 4月 8, 2018 by Takaaki Naganoya
AppleScript名:現時点における年齢を計算する
— Created 2015-09-10 by Takaaki Naganoya
— 2015 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

–http://stackoverflow.com/questions/4463893/
–how-to-calculate-the-age-based-on-nsdate

set aBirthday to "2009-04-24 12:00:00" –誕生日

set aFormatter to current application’s NSDateFormatter’s alloc()’s init()
aFormatter’s setDateFormat:"yyyy-MM-dd HH:mm:ss"
aFormatter’s setTimeZone:(current application’s NSTimeZone’s timeZoneForSecondsFromGMT:0)
set aBirthdayDate to aFormatter’s dateFromString:aBirthday

set currentDate to current application’s NSDate’s |date|()
set ageComponents to current application’s NSCalendar’s currentCalendar()’s components:(current application’s NSCalendarUnitYear) fromDate:aBirthdayDate toDate:currentDate options:0
set myAge to ageComponents’s |year|()
–>  8

★Click Here to Open This Script 

(Visited 28 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

指定日における年齢を計算する

Posted on 4月 8, 2018 by Takaaki Naganoya
AppleScript名:指定日における年齢を計算する
— Created 2015-09-10 by Takaaki Naganoya
— 2015 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

–http://stackoverflow.com/questions/4463893/
–how-to-calculate-the-age-based-on-nsdate

set aBirthday to "2009-04-24 12:00:00" –誕生日

set aFormatter to current application’s NSDateFormatter’s alloc()’s init()
aFormatter’s setDateFormat:"yyyy-MM-dd HH:mm:ss"
aFormatter’s setTimeZone:(current application’s NSTimeZone’s timeZoneForSecondsFromGMT:0)
set aBirthdayDate to aFormatter’s dateFromString:aBirthday

set currentDate to getDateInternational(2018, 4, 1, 9, 59, 35, "JST") of me
set ageComponents to current application’s NSCalendar’s currentCalendar()’s components:(current application’s NSCalendarUnitYear) fromDate:aBirthdayDate toDate:currentDate options:0
set myAge to ageComponents’s |year|()
–>  8

–Make a GMT Date Object with parameters from a given time zone.
on getDateInternational(aYear, aMonth, aDay, anHour, aMinute, aSecond, timeZoneAbbreviation)
  set theNSCalendar to current application’s NSCalendar’s currentCalendar()
  
theNSCalendar’s setTimeZone:(current application’s NSTimeZone’s timeZoneWithAbbreviation:(timeZoneAbbreviation))
  
set theDate to theNSCalendar’s dateWithEra:1 |year|:aYear |month|:aMonth |day|:aDay hour:anHour minute:aMinute |second|:aSecond nanosecond:0
  
return theDate
end getDateInternational

★Click Here to Open This Script 

(Visited 28 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

パラメータを指定してdateオブジェクトを作成

Posted on 3月 30, 2018 by Takaaki Naganoya
AppleScript名:パラメータを指定してdateオブジェクトを作成
— Created 2017-09-22 by Takaaki Naganoya
— 2017 Piyomaru Software
use AppleScript version "2.5"
use scripting additions
use framework "Foundation"

set a to getDateInternational(2012, 2, 28) of me
–> date "2012年2月28日火曜日 0:00:00"

set b to getDateInternationalYMDhms(2012, 2, 28, 1, 2, 3) of me
–> date "2012年2月28日火曜日 1:02:03"

–現在のカレンダーで指定年月のdate objectを返す(年、月、日、時、分、秒)
on getDateInternationalYMDhms(aYear, aMonth, aDay, anHour, aMinute, aSecond)
  set theNSCalendar to current application’s NSCalendar’s currentCalendar()
  
set theDate to theNSCalendar’s dateWithEra:1 |year|:aYear |month|:aMonth |day|:aDay hour:anHour minute:aMinute |second|:aSecond nanosecond:0
  
return theDate as date
end getDateInternationalYMDhms

–現在のカレンダーで指定年月のdate objectを返す(年、月、日)
on getDateInternational(aYear, aMonth, aDay)
  set theNSCalendar to current application’s NSCalendar’s currentCalendar()
  
set theDate to theNSCalendar’s dateWithEra:1 |year|:aYear |month|:aMonth |day|:aDay hour:0 minute:0 |second|:0 nanosecond:0
  
return theDate as date
end getDateInternational

★Click Here to Open This Script 

(Visited 62 times, 1 visits today)
Posted in Calendar Text | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

MMMM dd yyyyの文字列をdateに変換

Posted on 3月 30, 2018 by Takaaki Naganoya

基礎的なScriptです。文字列で形式を指定した日付文字列を認識してAppleScriptのdateオブジェクトに変換するAppleScriptです。

「as list of string or string」の行は「as anything」が解釈されて(macOS 10.13まで)このようになるわけですが、macOS 10.14からは「as anything」(スクリプトエディタ)、「as any」(Script Debugger)と解釈されます。

本プログラムであれば、「as date」と書いておくと問題がないでしょう。

AppleScript名:MMMM dd yyyyの文字列をdateに変換.scptd
—
–  Created by: Takaaki Naganoya
–  Created on: 2018/03/23
—
–  Copyright © 2018 Piyomaru Software, All Rights Reserved
—

use AppleScript version "2.4" — Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

set tmpDate to "2014-09-14 15:45:00"
set tmpD1 to dateFromStringWithDateFormat(tmpDate, "yyyy-MM-dd HH:mm:ss") of me
–> date "2014年9月14日日曜日 15:45:00"

set tmpDate to "August 19, 2018 15:45:00"
set tmpD2 to dateFromStringWithDateFormat(tmpDate, "MMMM dd, yyyy HH:mm:ss") of me
–> date "2018年8月19日日曜日 15:45:00"

return {tmpD1, tmpD2}

on dateFromStringWithDateFormat(dateString, dateFormat)
  set dStr to current application’s NSString’s stringWithString:dateString
  
set dateFormatStr to current application’s NSString’s stringWithString:dateFormat
  
  
set aDateFormatter to current application’s NSDateFormatter’s alloc()’s init()
  
aDateFormatter’s setDateFormat:dateFormatStr
  
aDateFormatter’s setLocale:(current application’s NSLocale’s alloc()’s initWithLocaleIdentifier:"en_US_POSIX")
  
  
set aDestDate to (aDateFormatter’s dateFromString:dStr)
  
  
return aDestDate as list of string or string
end dateFromStringWithDateFormat

★Click Here to Open This Script 

(Visited 207 times, 1 visits today)
Posted in Calendar Text | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

Twitter APIの日付フォーマットをAppleScriptのdateに変換する

Posted on 3月 30, 2018 by Takaaki Naganoya

Twitter APIの日付フォーマットの文字列をAppleScriptのdateオブジェクトに変換するAppleScriptです。

TwitterのREST APIから返ってくる日付フォーマットの文字列を変換しようとしてハマったのでメモしておきました。

AppleScript名:Twitter APIの日付フォーマットをAppleScriptのdateに変換する.scptd
—
–  Created by: Takaaki Naganoya
–  Created on: 2018/03/30
—
–  Copyright © 2018 Piyomaru Software, All Rights Reserved
—
use AppleScript version "2.5" — El Capitan (10.11) or later
use framework "Foundation"
use scripting additions

property NSString : a reference to current application’s NSString
property NSLocale : a reference to current application’s NSLocale
property NSDateFormatter : a reference to current application’s NSDateFormatter

set a to "Fri Mar 30 11:03:57 +0000 2018"

set aDF to NSDateFormatter’s alloc()’s init()
aDF’s setDateFormat:"EEE MMM dd HH:mm:ss Z yyyy"
aDF’s setLocale:(NSLocale’s alloc()’s initWithLocaleIdentifier:"en_US_POSIX")
set aResDate to aDF’s dateFromString:a
set aDateO to aResDate as date
–> date "2018年3月30日金曜日 20:03:57"

★Click Here to Open This Script 

(Visited 23 times, 1 visits today)
Posted in Calendar Text | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

日の出、日没時刻を計算するv2

Posted on 2月 24, 2018 by Takaaki Naganoya

EDSunriseSetを用いて、指定の位置における日の出、日没時間を計算するAppleScriptです。

–> EDSunriseSet.framework(~/Library/Frameworks)

AppleScript名:日の出、日没時刻を計算するv2
— Created 2017-06-19 by Takaaki Naganoya
— 2017 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "EDSunriseSet" –https://github.com/erndev/EDSunriseSet

set cityRecList to {{kCityName:"Tokyo", kCityLatitude:(35.6894875), kCityLongitude:(139.6917064), kCityTimeZone:"Asia/Tokyo"}}

set dList to {}

repeat with i in cityRecList
  set the end of dList to getSunriseSunset(i) of me
end repeat
return dList
–>  {​​​​​{​​​​​​​sunrise:date "2017年6月21日水曜日 4:25:37", ​​​​​​​sunset:date "2017年6月21日水曜日 19:00:21", ​​​​​​​civilTwilightStart:date "2017年6月21日水曜日 3:55:35", ​​​​​​​civilTwilightEnd:date "2017年6月21日水曜日 19:30:23", ​​​​​​​nauticalTwilightStart:date "2017年6月21日水曜日 3:18:15", ​​​​​​​nauticalTwilightEnd:date "2017年6月21日水曜日 20:07:44", ​​​​​​​astronomicalTwilightStart:date "2017年6月21日水曜日 2:36:45", ​​​​​​​astronomicalTwilightEnd:date "2017年6月21日水曜日 20:49:13", ​​​​​​​cityname:"Tokyo"​​​​​}​​​}

on getSunriseSunset(cityRec)
  set curLocale to current application’s NSLocale’s currentLocale()
  
set curDate to current application’s NSDate’s |date|()
  
  
set aTZ to current application’s NSTimeZone’s alloc()’s initWithName:(kCityName of cityRec)
  
set aSunrizeSunset to current application’s EDSunriseSet’s alloc()’s initWithDate:curDate timezone:aTZ latitude:(kCityLatitude of cityRec) longitude:(kCityLongitude of cityRec)
  
  
–日の出、日没  
  
set aSunRiseDate to (aSunrizeSunset’s sunrise) as date
  
set aSunSetDate to (aSunrizeSunset’s sunset) as date
  
  
–https://en.wikipedia.org/wiki/Twilight
  
–https://ja.wikipedia.org/wiki/薄明
  
  
–市民薄明(常用薄明、第三薄明)
  
set aCivilTwilightStart to (aSunrizeSunset’s civilTwilightStart) as date
  
set aCivilTwilightEnd to (aSunrizeSunset’s civilTwilightEnd) as date
  
  
–航海薄明(第二薄明)
  
set aNauticalTwilightStart to (aSunrizeSunset’s nauticalTwilightStart) as date
  
set aNauticalTwilightEnd to (aSunrizeSunset’s nauticalTwilightEnd) as date
  
  
–天文薄明(第一薄明)
  
set anAstronomicalTwilightStart to (aSunrizeSunset’s astronomicalTwilightStart) as date
  
set anAstronomicalTwilightEnd to (aSunrizeSunset’s astronomicalTwilightEnd) as date
  
  
return {sunrise:aSunRiseDate, sunset:aSunSetDate, civilTwilightStart:aCivilTwilightStart, civilTwilightEnd:aCivilTwilightEnd, nauticalTwilightStart:aNauticalTwilightStart, nauticalTwilightEnd:aNauticalTwilightEnd, astronomicalTwilightStart:anAstronomicalTwilightStart, astronomicalTwilightEnd:anAstronomicalTwilightEnd, cityname:kCityName of cityRec}
end getSunriseSunset

★Click Here to Open This Script 

(Visited 56 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

2つの日付の期間を日本語表記でていねいに返す

Posted on 2月 24, 2018 by Takaaki Naganoya
AppleScript名:2つの日付の期間を日本語表記でていねいに返す
— Created 2016-01-17 by Takaaki Naganoya
— 2016 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

–Date Difference
set sDate to "2016/1/15" –Japanese Date format "YYYY/MM/DD"
set eDate to "2016/1/20" –Japanese Date format "YYYY/MM/DD"
set aDiffStr to retDateDiffStr(sDate, eDate, "/", "/", "", "〜") of me
–> "2016/1/15〜20"

–Month Difference
set sDate to "2016/1/15" –Japanese Date format "YYYY/MM/DD"
set eDate to "2016/2/20" –Japanese Date format "YYYY/MM/DD"
set bDiffStr to retDateDiffStr(sDate, eDate, "年", "月", "日", "〜") of me
–> "2016年1月15日〜2月20日"

–Year Difference
set sDate to "2015/12/15" –Japanese Date format "YYYY/MM/DD"
set eDate to "2016/1/20" –Japanese Date format "YYYY/MM/DD"
set bDiffStr to retDateDiffStr(sDate, eDate, "年", "月", "日", "〜") of me
–> "2015年12月15日〜2016年1月20日"

–2つの日付の期間を日本語表記でていねいに返す
on retDateDiffStr(sDate, eDate, ySeparator, mSeparator, dSeparator, diffSeparator)
  
  
set sDateO to date sDate
  
set eDateO to date eDate
  
  
set diffY to (year of eDateO) – (year of sDateO)
  
set diffM to (month of eDateO) – (month of sDateO)
  
set diffD to (day of eDateO) – (day of sDateO)
  
  
set sYstr to (year of sDateO) as string
  
set sMstr to (month of sDateO as number) as string
  
set sDstr to (day of sDateO) as string
  
  
set eYstr to (year of eDateO) as string
  
set eMstr to (month of eDateO as number) as string
  
set eDstr to (day of eDateO) as string
  
  
if diffY > 0 then
    –Year Difference
    
set outStr to sYstr & ySeparator & sMstr & mSeparator & sDstr & dSeparator & diffSeparator & eYstr & ySeparator & eMstr & mSeparator & eDstr & dSeparator
  else if diffM > 0 then
    –Month Difference
    
set outStr to sYstr & ySeparator & sMstr & mSeparator & sDstr & dSeparator & diffSeparator & eMstr & mSeparator & eDstr & dSeparator
  else if diffD > 0 then
    –Date Difference
    
set outStr to sYstr & ySeparator & sMstr & mSeparator & sDstr & diffSeparator & eDstr & dSeparator
  end if
  
  
return outStr
  
end retDateDiffStr

★Click Here to Open This Script 

(Visited 27 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

getMlenInternational_ASOC

Posted on 2月 24, 2018 by Takaaki Naganoya

年と月を数値で指定した対象月の日数を計算するAppleScriptです。国際化対応バージョンです。

AppleScriptで日付(date)関連の処理を行うと、どうしても言語依存してしまいがちです。

つまり、日本語環境で作ったAppleScriptをその他の言語環境に持って行ったときに、あるいは逆に英語圏で作られたAppleScriptでまっさきに書き換える必要が出てくるのが、日付関連処理です(その次ぐらいにApple純正アプリケーションの「過剰ローカライズ」によりAppleScriptのオブジェクト名までローカライズされてしまうので、その点を書き換えるとか)。

日本語環境以外で通じる処理を書くというのは、けっこう練習が必要です。ただ、国際化対応の処理をいったん書いておけば、二度目からはその処理を使い回すだけです。

そんな、言語環境非依存で真っ先に必要になってくる、指定月の日数計算を書いたものです。少なくとも、Mac App Storeに出すアプリケーションを書くのであれば、こうした他の言語環境でも動作するルーチンを整備しておく必要があります。

AppleScript名:getMlenInternational_ASOC
— Created 2015-02-02 by Shane Stanley
— Modified 2015-02-02 by Takaaki Naganoya
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set mList to {}
repeat with m from 1 to 12
  set the end of mList to getMlenInternational(2012, m) of me –2012 is a Leap Year–2012年はうるう年
end repeat
mList
–>  {​​​​​31, ​​​​​29, ​​​​​31, ​​​​​30, ​​​​​31, ​​​​​30, ​​​​​31, ​​​​​31, ​​​​​30, ​​​​​31, ​​​​​30, ​​​​​31​​​}

–現在のカレンダーで指定年月の日数を返す
on getMlenInternational(aYear, aMonth)
  –From Shane’s getMlenInternational(ASOC) v1
  
set theNSCalendar to current application’s NSCalendar’s currentCalendar() — do *not* use initWithCalendarIdentifier:
  
set theDate to theNSCalendar’s dateWithEra:1 |year|:aYear |month|:aMonth |day|:1 hour:0 minute:0 |second|:0 nanosecond:0
  
set theResult to theNSCalendar’s rangeOfUnit:(current application’s NSDayCalendarUnit) inUnit:(current application’s NSMonthCalendarUnit) forDate:theDate
  
–>  {location:1, length:31}
  
return |length| of theResult
end getMlenInternational

★Click Here to Open This Script 

(Visited 36 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

数値の秒を文字フォーマットして返す

Posted on 2月 24, 2018 by Takaaki Naganoya
AppleScript名:数値の秒を文字フォーマットして返す
— Created 2016-02-09 by Takaaki Naganoya
— 2016 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set aStr to formatTimeNum(61) of me
–> "01分 01秒"

set bStr to formatTimeNum(3700) of me
–> "01時間 01分 40秒"

set cStr to formatTimeNum(9100) of me
–> "02時間 31分 40秒"

set dStr to formatTimeNum(720001) of me
–>"200時間 00分 01秒"

set eStr to formatTimeNum(7200001) of me
–>"2000時間 00分 01秒"

–数値の秒を文字フォーマットして返す
on formatTimeNum(a)
  set hourStr to "時間 "
  
set minuteStr to "分 "
  
set secStr to "秒"
  
  
set aRec to separateSec(a) of me
  
set aStr to ""
  
set anHour to hourNum of aRec
  
set aMinute to minuteNum of aRec
  
set aSec to secondNum of aRec
  
  
if anHour > 0 then
    set aStr to aStr & retZeroPaddingText(anHour, 2) of me & hourStr
    
set aStr to aStr & retZeroPaddingText(aMinute, 2) of me & minuteStr
  else if aMinute > 0 then
    set aStr to aStr & retZeroPaddingText(aMinute, 2) of me & minuteStr
  end if
  
set aStr to aStr & retZeroPaddingText(aSec, 2) of me & secStr
  
  
return aStr
end formatTimeNum

—数値の秒を時、分、秒に分解する
on separateSec(a)
  set anHour to a div 3600
  
set b to a – (anHour * 3600)
  
set aMinute to b div 60
  
set c to b – (aMinute * 60)
  
return {hourNum:anHour, minuteNum:aMinute, secondNum:c}
end separateSec

–ゼロパディング
on retZeroPaddingText(aNum as integer, aDigitNum as integer)
  if aNum > (((10 ^ aDigitNum) as integer) – 1) then
    return aNum as string –指定桁数を数値データがオーバーしたら数値を文字化してそのまま返す
  end if
  
set aFormatter to current application’s NSNumberFormatter’s alloc()’s init()
  
aFormatter’s setUsesGroupingSeparator:false
  
aFormatter’s setAllowsFloats:false
  
aFormatter’s setMaximumIntegerDigits:aDigitNum
  
aFormatter’s setMinimumIntegerDigits:aDigitNum
  
aFormatter’s setPaddingCharacter:"0"
  
set aStr to aFormatter’s stringFromNumber:(current application’s NSNumber’s numberWithFloat:aNum)
  
return aStr as string
end retZeroPaddingText

★Click Here to Open This Script 

(Visited 15 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

午前午後のローカライズ名称を返す

Posted on 2月 24, 2018 by Takaaki Naganoya
AppleScript名:午前午後のローカライズ名称を返す
— Created 2017-12-19 01:14:42 +0900 by Takaaki Naganoya
— 2017 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set bList to getLocalizedAMSymbol("ja_JP") of me
–>  "午前"

set bList to getLocalizedPMSymbol("ja_JP") of me
–>  "午後"

–ローカライズされた午前の名称を返す
on getLocalizedAMSymbol(aLoc)
  set df to current application’s NSDateFormatter’s alloc()’s init()
  
df’s setLocale:(current application’s NSLocale’s localeWithLocaleIdentifier:aLoc)
  
set dayNames to df’s AMSymbol()
  
return dayNames as string
end getLocalizedAMSymbol

–ローカライズされた午後の名称を返す
on getLocalizedPMSymbol(aLoc)
  set df to current application’s NSDateFormatter’s alloc()’s init()
  
df’s setLocale:(current application’s NSLocale’s localeWithLocaleIdentifier:aLoc)
  
set dayNames to df’s PMSymbol()
  
return dayNames as string
end getLocalizedPMSymbol

★Click Here to Open This Script 

(Visited 17 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

元号変換v31

Posted on 2月 24, 2018 by Takaaki Naganoya
AppleScript名:元号変換v31
set a to "2010/7/21"
set a to parseDate(a) of me
set {aGengoStr, aGengoNum} to retJapaneseGengo(a) of me
–> {"平成", 22}

on retJapaneseGengo(aDate)
  
  
set aYear to year of aDate
  
set aMonth to month of aDate as number
  
set aDay to day of aDate
  
  
set aStr to retZeroPaddingText(aYear, 4) of me & retZeroPaddingText(aMonth, 2) of me & retZeroPaddingText(aDay, 2) of me
  
  
set aGengo to ""
  
if aStr ≥ "19890108" then
    set aGengo to "平成"
    
set aGengoNum to aYear – 1989 + 1
  else if aStr ≥ "19261225" then
    set aGengo to "昭和"
    
set aGengoNum to aYear – 1926 + 1
  else if aStr ≥ "19120730" then
    set aGengo to "大正"
    
set aGengoNum to aYear – 1912 + 1
  else if aStr ≥ "18680125" then
    set aGengo to "明治"
    
set aGengoNum to aYear – 1868 + 1
  end if
  
  
return {aGengo, aGengoNum}
  
end retJapaneseGengo

–数値にゼロパディングしたテキストを返す
on retZeroPaddingText(aNum, aLen)
  set tText to ("0000000000" & aNum as text)
  
set tCount to length of tText
  
set resText to text (tCount – aLen + 1) thru tCount of tText
  
return resText
end retZeroPaddingText

on parseDate(inStr)
  set aClass to class of inStr
  
if aClass = string then
    try
      set aDate to date inStr
    on error
      return false
    end try
  else if aClass = date then
    set aDate to inStr
    
  end if
  
  
return aDate
  
end parseDate

★Click Here to Open This Script 

(Visited 25 times, 1 visits today)
Posted in Calendar | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

現在のLocaleのIdentifier文字を取得する

Posted on 2月 22, 2018 by Takaaki Naganoya
AppleScript名:現在のLocaleのIdentifier文字を取得する.scpt
use AppleScript version "2.7"
use scripting additions
use framework "Foundation"

set aLoc to (current application’s NSLocale’s currentLocale()’s identifier()) as anything
log aLoc
–> "ja_JP"

set aLoc to (current application’s NSLocale’s systemLocale()’s identifier()) as anything
log aLoc
–>  (__NSCFLocale) <__NSCFLocale: 0x6180000f5480>

set isoCountry to (current application’s NSLocale’s ISOCountryCodes()) as anything
log isoCountry
–>  (NSArray) {​​​​​"AD", ​​​​​"AE", ​​​​​"AF", ​​​​​"AG", ​​​​​"AI", ​​​​​"AL", ​​​​​"AM", ​​​​​"AO", ​​​​​"AQ", ​​​​​"AR", ​​​​​"AS", ​​​​​"AT", ​​​​​"AU", ​​​​​"AW", ​​​​​"AX", ​​​​​"AZ", ​​​​​"BA", ​​​​​"BB", ​​​​​"BD", ​​​​​"BE", ​​​​​"BF", ​​​​​"BG", ​​​​​"BH", ​​​​​"BI", ​​​​​"BJ", ​​​​​"BL", ​​​​​"BM", ​​​​​"BN", ​​​​​"BO", ​​​​​"BQ", ​​​​​"BR", ​​​​​"BS", ​​​​​"BT", ​​​​​"BV", ​​​​​"BW", ​​​​​"BY", ​​​​​"BZ", ​​​​​"CA", ​​​​​"CC", ​​​​​"CD", ​​​​​"CF", ​​​​​"CG", ​​​​​"CH", ​​​​​"CI", ​​​​​"CK", ​​​​​"CL", ​​​​​"CM", ​​​​​"CN", ​​​​​"CO", ​​​​​"CR", ​​​​​"CU", ​​​​​"CV", ​​​​​"CW", ​​​​​"CX", ​​​​​"CY", ​​​​​"CZ", ​​​​​"DE", ​​​​​"DJ", ​​​​​"DK", ​​​​​"DM", ​​​​​"DO", ​​​​​"DZ", ​​​​​"EC", ​​​​​"EE", ​​​​​"EG", ​​​​​"EH", ​​​​​"ER", ​​​​​"ES", ​​​​​"ET", ​​​​​"FI", ​​​​​"FJ", ​​​​​"FK", ​​​​​"FM", ​​​​​"FO", ​​​​​"FR", ​​​​​"GA", ​​​​​"GB", ​​​​​"GD", ​​​​​"GE", ​​​​​"GF", ​​​​​"GG", ​​​​​"GH", ​​​​​"GI", ​​​​​"GL", ​​​​​"GM", ​​​​​"GN", ​​​​​"GP", ​​​​​"GQ", ​​​​​"GR", ​​​​​"GS", ​​​​​"GT", ​​​​​"GU", ​​​​​"GW", ​​​​​"GY", ​​​​​"HK", ​​​​​"HM", ​​​​​"HN", ​​​​​"HR", ​​​​​"HT", ​​​​​"HU", ​​​​​"ID", ​​​​​"IE", ​​​​​"IL", ​​​​​"IM", ​​​​​"IN", ​​​​​"IO", ​​​​​"IQ", ​​​​​"IR", ​​​​​"IS", ​​​​​"IT", ​​​​​"JE", ​​​​​"JM", ​​​​​"JO", ​​​​​"JP", ​​​​​"KE", ​​​​​"KG", ​​​​​"KH", ​​​​​"KI", ​​​​​"KM", ​​​​​"KN", ​​​​​"KP", ​​​​​"KR", ​​​​​"KW", ​​​​​"KY", ​​​​​"KZ", ​​​​​"LA", ​​​​​"LB", ​​​​​"LC", ​​​​​"LI", ​​​​​"LK", ​​​​​"LR", ​​​​​"LS", ​​​​​"LT", ​​​​​"LU", ​​​​​"LV", ​​​​​"LY", ​​​​​"MA", ​​​​​"MC", ​​​​​"MD", ​​​​​"ME", ​​​​​"MF", ​​​​​"MG", ​​​​​"MH", ​​​​​"MK", ​​​​​"ML", ​​​​​"MM", ​​​​​"MN", ​​​​​"MO", ​​​​​"MP", ​​​​​"MQ", ​​​​​"MR", ​​​​​"MS", ​​​​​"MT", ​​​​​"MU", ​​​​​"MV", ​​​​​"MW", ​​​​​"MX", ​​​​​"MY", ​​​​​"MZ", ​​​​​"NA", ​​​​​"NC", ​​​​​"NE", ​​​​​"NF", ​​​​​"NG", ​​​​​"NI", ​​​​​"NL", ​​​​​"NO", ​​​​​"NP", ​​​​​"NR", ​​​​​"NU", ​​​​​"NZ", ​​​​​"OM", ​​​​​"PA", ​​​​​"PE", ​​​​​"PF", ​​​​​"PG", ​​​​​"PH", ​​​​​"PK", ​​​​​"PL", ​​​​​"PM", ​​​​​"PN", ​​​​​"PR", ​​​​​"PS", ​​​​​"PT", ​​​​​"PW", ​​​​​"PY", ​​​​​"QA", ​​​​​"RE", ​​​​​"RO", ​​​​​"RS", ​​​​​"RU", ​​​​​"RW", ​​​​​"SA", ​​​​​"SB", ​​​​​"SC", ​​​​​"SD", ​​​​​"SE", ​​​​​"SG", ​​​​​"SH", ​​​​​"SI", ​​​​​"SJ", ​​​​​"SK", ​​​​​"SL", ​​​​​"SM", ​​​​​"SN", ​​​​​"SO", ​​​​​"SR", ​​​​​"SS", ​​​​​"ST", ​​​​​"SV", ​​​​​"SX", ​​​​​"SY", ​​​​​"SZ", ​​​​​"TC", ​​​​​"TD", ​​​​​"TF", ​​​​​"TG", ​​​​​"TH", ​​​​​"TJ", ​​​​​"TK", ​​​​​"TL", ​​​​​"TM", ​​​​​"TN", ​​​​​"TO", ​​​​​"TR", ​​​​​"TT", ​​​​​"TV", ​​​​​"TW", ​​​​​"TZ", ​​​​​"UA", ​​​​​"UG", ​​​​​"UM", ​​​​​"US", ​​​​​"UY", ​​​​​"UZ", ​​​​​"VA", ​​​​​"VC", ​​​​​"VE", ​​​​​"VG", ​​​​​"VI", ​​​​​"VN", ​​​​​"VU", ​​​​​"WF", ​​​​​"WS", ​​​​​"YE", ​​​​​"YT", ​​​​​"ZA", ​​​​​"ZM", ​​​​​"ZW"​​​}

set isoCurrency to (current application’s NSLocale’s ISOCurrencyCodes()) as anything
log isoCurrency
–>   {​​​​​"ADP", ​​​​​"AED", ​​​​​"AFA", ​​​​​"AFN", ​​​​​"ALK", ​​​​​"ALL", ​​​​​"AMD", ​​​​​"ANG", ​​​​​"AOA", ​​​​​"AOK", ​​​​​"AON", ​​​​​"AOR", ​​​​​"ARA", ​​​​​"ARL", ​​​​​"ARM", ​​​​​"ARP", ​​​​​"ARS", ​​​​​"ATS", ​​​​​"AUD", ​​​​​"AWG", ​​​​​"AZM", ​​​​​"AZN", ​​​​​"BAD", ​​​​​"BAM", ​​​​​"BAN", ​​​​​"BBD", ​​​​​"BDT", ​​​​​"BEC", ​​​​​"BEF", ​​​​​"BEL", ​​​​​"BGL", ​​​​​"BGM", ​​​​​"BGN", ​​​​​"BGO", ​​​​​"BHD", ​​​​​"BIF", ​​​​​"BMD", ​​​​​"BND", ​​​​​"BOB", ​​​​​"BOL", ​​​​​"BOP", ​​​​​"BOV", ​​​​​"BRB", ​​​​​"BRC", ​​​​​"BRE", ​​​​​"BRL", ​​​​​"BRN", ​​​​​"BRR", ​​​​​"BRZ", ​​​​​"BSD", ​​​​​"BTN", ​​​​​"BUK", ​​​​​"BWP", ​​​​​"BYB", ​​​​​"BYR", ​​​​​"BZD", ​​​​​"CAD", ​​​​​"CDF", ​​​​​"CHE", ​​​​​"CHF", ​​​​​"CHW", ​​​​​"CLE", ​​​​​"CLF", ​​​​​"CLP", ​​​​​"CNX", ​​​​​"CNY", ​​​​​"COP", ​​​​​"COU", ​​​​​"CRC", ​​​​​"CSD", ​​​​​"CSK", ​​​​​"CUC", ​​​​​"CUP", ​​​​​"CVE", ​​​​​"CYP", ​​​​​"CZK", ​​​​​"DDM", ​​​​​"DEM", ​​​​​"DJF", ​​​​​"DKK", ​​​​​"DOP", ​​​​​"DZD", ​​​​​"ECS", ​​​​​"ECV", ​​​​​"EEK", ​​​​​"EGP", ​​​​​"EQE", ​​​​​"ERN", ​​​​​"ESA", ​​​​​"ESB", ​​​​​"ESP", ​​​​​"ETB", ​​​​​"EUR", ​​​​​"FIM", ​​​​​"FJD", ​​​​​"FKP", ​​​​​"FRF", ​​​​​"GBP", ​​​​​"GEK", ​​​​​"GEL", ​​​​​"GHC", ​​​​​"GHS", ​​​​​"GIP", ​​​​​"GMD", ​​​​​"GNF", ​​​​​"GNS", ​​​​​"GQE", ​​​​​"GRD", ​​​​​"GTQ", ​​​​​"GWE", ​​​​​"GWP", ​​​​​"GYD", ​​​​​"HKD", ​​​​​"HNL", ​​​​​"HRD", ​​​​​"HRK", ​​​​​"HTG", ​​​​​"HUF", ​​​​​"IDR", ​​​​​"IEP", ​​​​​"ILP", ​​​​​"ILR", ​​​​​"ILS", ​​​​​"INR", ​​​​​"IQD", ​​​​​"IRR", ​​​​​"ISJ", ​​​​​"ISK", ​​​​​"ITL", ​​​​​"JMD", ​​​​​"JOD", ​​​​​"JPY", ​​​​​"KES", ​​​​​"KGS", ​​​​​"KHR", ​​​​​"KMF", ​​​​​"KPW", ​​​​​"KRH", ​​​​​"KRO", ​​​​​"KRW", ​​​​​"KWD", ​​​​​"KYD", ​​​​​"KZT", ​​​​​"LAK", ​​​​​"LBP", ​​​​​"LKR", ​​​​​"LRD", ​​​​​"LSL", ​​​​​"LSM", ​​​​​"LTL", ​​​​​"LTT", ​​​​​"LUC", ​​​​​"LUF", ​​​​​"LUL", ​​​​​"LVL", ​​​​​"LVR", ​​​​​"LYD", ​​​​​"MAD", ​​​​​"MAF", ​​​​​"MCF", ​​​​​"MDC", ​​​​​"MDL", ​​​​​"MGA", ​​​​​"MGF", ​​​​​"MKD", ​​​​​"MKN", ​​​​​"MLF", ​​​​​"MMK", ​​​​​"MNT", ​​​​​"MOP", ​​​​​"MRO", ​​​​​"MTL", ​​​​​"MTP", ​​​​​"MUR", ​​​​​"MVP", ​​​​​"MVR", ​​​​​"MWK", ​​​​​"MXN", ​​​​​"MXP", ​​​​​"MXV", ​​​​​"MYR", ​​​​​"MZE", ​​​​​"MZM", ​​​​​"MZN", ​​​​​"NAD", ​​​​​"NGN", ​​​​​"NIC", ​​​​​"NIO", ​​​​​"NLG", ​​​​​"NOK", ​​​​​"NPR", ​​​​​"NZD", ​​​​​"OMR", ​​​​​"PAB", ​​​​​"PEI", ​​​​​"PEN", ​​​​​"PES", ​​​​​"PGK", ​​​​​"PHP", ​​​​​"PKR", ​​​​​"PLN", ​​​​​"PLZ", ​​​​​"PTE", ​​​​​"PYG", ​​​​​"QAR", ​​​​​"RHD", ​​​​​"ROL", ​​​​​"RON", ​​​​​"RSD", ​​​​​"RUB", ​​​​​"RUR", ​​​​​"RWF", ​​​​​"SAR", ​​​​​"SBD", ​​​​​"SCR", ​​​​​"SDD", ​​​​​"SDG", ​​​​​"SDP", ​​​​​"SEK", ​​​​​"SGD", ​​​​​"SHP", ​​​​​"SIT", ​​​​​"SKK", ​​​​​"SLL", ​​​​​"SOS", ​​​​​"SRD", ​​​​​"SRG", ​​​​​"SSP", ​​​​​"STD", ​​​​​"SUR", ​​​​​"SVC", ​​​​​"SYP", ​​​​​"SZL", ​​​​​"THB", ​​​​​"TJR", ​​​​​"TJS", ​​​​​"TMM", ​​​​​"TMT", ​​​​​"TND", ​​​​​"TOP", ​​​​​"TPE", ​​​​​"TRL", ​​​​​"TRY", ​​​​​"TTD", ​​​​​"TWD", ​​​​​"TZS", ​​​​​"UAH", ​​​​​"UAK", ​​​​​"UGS", ​​​​​"UGX", ​​​​​"USD", ​​​​​"USN", ​​​​​"USS", ​​​​​"UYI", ​​​​​"UYP", ​​​​​"UYU", ​​​​​"UZS", ​​​​​"VEB", ​​​​​"VEF", ​​​​​"VND", ​​​​​"VNN", ​​​​​"VUV", ​​​​​"WST", ​​​​​"XAF", ​​​​​"XAG", ​​​​​"XAU", ​​​​​"XBA", ​​​​​"XBB", ​​​​​"XBC", ​​​​​"XBD", ​​​​​"XCD", ​​​​​"XDR", ​​​​​"XEU", ​​​​​"XFO", ​​​​​"XFU", ​​​​​"XOF", ​​​​​"XPD", ​​​​​"XPF", ​​​​​"XPT", ​​​​​"XRE", ​​​​​"XSU", ​​​​​"XTS", ​​​​​"XUA", ​​​​​"XXX", ​​​​​"YDD", ​​​​​"YER", ​​​​​"YUD", ​​​​​"YUM", ​​​​​"YUN", ​​​​​"YUR", ​​​​​"ZAL", ​​​​​"ZAR", ​​​​​"ZMK", ​​​​​"ZMW", ​​​​​"ZRN", ​​​​​"ZRZ", ​​​​​"ZWL", ​​​​​"ZWR", ​​​​​"ZWD"​​​}

set aveLoc to (current application’s NSLocale’s availableLocaleIdentifiers()) as anything
log aveLoc
–>  {​​​​​"eu", ​​​​​"hr_BA", ​​​​​"en_CM", ​​​​​"rw_RW", ​​​​​"en_SZ", ​​​​​"tk_Latn", ​​​​​"uz_Arab", ​​​​​"he_IL", ​​​​​"ar", ​​​​​"en_PN", ​​​​​"as", ​​​​​"en_NF", ​​​​​"rwk_TZ", ​​​​​"zh_Hant_TW", ​​​​​"gsw_LI", ​​​​​"th_TH", ​​​​​"ta_IN", ​​​​​"es_EA", ​​​​​"fr_GF", ​​​​​"ar_001", ​​​​​"en_RW", ​​​​​"tr_TR", ​​​​​"de_CH", ​​​​​"ee_TG", ​​​​​"en_NG", ​​​​​"fr_TG", ​​​​​"az", ​​​​​"fr_SC", ​​​​​"es_HN", ​​​​​"en_AG", ​​​​​"ru_KZ", ​​​​​"gsw", ​​​​​"dyo", ​​​​​"so_ET", ​​​​​"zh_Hant_MO", ​​​​​"de_BE", ​​​​​"km_KH", ​​​​​"my_MM", ​​​​​"mgh_MZ", ​​​​​"ee_GH", ​​​​​"es_EC", ​​​​​"kw_GB", ​​​​​"rm_CH", ​​​​​"en_ME", ​​​​​"nyn", ​​​​​"mk_MK", ​​​​​"bs_Cyrl_BA", ​​​​​"ar_MR", ​​​​​"en_BM", ​​​​​"ms_Arab", ​​​​​"en_AI", ​​​​​"gl_ES", ​​​​​"en_PR", ​​​​​"ha_Latn_GH", ​​​​​"ne_IN", ​​​​​"or_IN", ​​​​​"khq_ML", ​​​​​"en_MG", ​​​​​"pt_TL", ​​​​​"en_LC", ​​​​​"ta_SG", ​​​​​"jmc_TZ", ​​​​​"om_ET", ​​​​​"lv_LV", ​​​​​"es_US", ​​​​​"en_PT", ​​​​​"vai_Latn_LR", ​​​​​"to_TO", ​​​​​"en_NL", ​​​​​"cgg_UG", ​​​​​"ta", ​​​​​"en_MH", ​​​​​"iu_Cans_CA", ​​​​​"zu_ZA", ​​​​​"shi_Latn_MA", ​​​​​"brx_IN", ​​​​​"ar_KM", ​​​​​"en_AL", ​​​​​"te", ​​​​​"chr_US", ​​​​​"yo_BJ", ​​​​​"fr_VU", ​​​​​"pa", ​​​​​"tg", ​​​​​"ks_Arab", ​​​​​"kea", ​​​​​"te_IN", ​​​​​"th", ​​​​​"fr_RE", ​​​​​"ur_IN", ​​​​​"yo_NG", ​​​​​"ti", ​​​​​"guz_KE", ​​​​​"tk", ​​​​​"kl_GL", ​​​​​"ksf_CM", ​​​​​"mua_CM", ​​​​​"lag_TZ", ​​​​​"fr_TN", ​​​​​"es_PA", ​​​​​"pl_PL", ​​​​​"to", ​​​​​"hi_IN", ​​​​​"dje_NE", ​​​​​"es_GQ", ​​​​​"kok_IN", ​​​​​"pl", ​​​​​"tr", ​​​​​"bem", ​​​​​"ha", ​​​​​"ckb", ​​​​​"lg", ​​​​​"fr_GN", ​​​​​"en_PW", ​​​​​"en_NO", ​​​​​"nyn_UG", ​​​​​"sr_Latn_RS", ​​​​​"pa_Guru", ​​​​​"he", ​​​​​"swc_CD", ​​​​​"ug_Arab", ​​​​​"lu_CD", ​​​​​"mgo_CM", ​​​​​"sn_ZW", ​​​​​"en_BS", ​​​​​"ps_AF", ​​​​​"da", ​​​​​"ms_Latn_SG", ​​​​​"ps", ​​​​​"ln", ​​​​​"pt", ​​​​​"iu_Cans", ​​​​​"hi", ​​​​​"lo", ​​​​​"ebu", ​​​​​"de", ​​​​​"gu_IN", ​​​​​"seh", ​​​​​"en_CX", ​​​​​"en_ZM", ​​​​​"tzm_Latn_MA", ​​​​​"fr_HT", ​​​​​"fr_GP", ​​​​​"lt", ​​​​​"lu", ​​​​​"ln_CD", ​​​​​"vai_Latn", ​​​​​"el_GR", ​​​​​"lv", ​​​​​"en_KE", ​​​​​"sbp", ​​​​​"hr", ​​​​​"en_CY", ​​​​​"es_GT", ​​​​​"twq_NE", ​​​​​"zh_Hant_HK", ​​​​​"kln_KE", ​​​​​"fr_GQ", ​​​​​"chr", ​​​​​"hu", ​​​​​"es_UY", ​​​​​"fr_CA", ​​​​​"en_NR", ​​​​​"mer", ​​​​​"shi", ​​​​​"es_PE", ​​​​​"fr_SN", ​​​​​"bez", ​​​​​"sw_TZ", ​​​​​"kkj", ​​​​​"hy", ​​​​​"kk_Cyrl_KZ", ​​​​​"en_CZ", ​​​​​"teo_KE", ​​​​​"teo", ​​​​​"dz_BT", ​​​​​"ar_JO", ​​​​​"mer_KE", ​​​​​"khq", ​​​​​"ln_CF", ​​​​​"nn_NO", ​​​​​"en_MO", ​​​​​"ar_TD", ​​​​​"dz", ​​​​​"ses", ​​​​​"en_BW", ​​​​​"en_AS", ​​​​​"ar_IL", ​​​​​"ms_Latn_BN", ​​​​​"bo_CN", ​​​​​"nnh", ​​​​​"teo_UG", ​​​​​"hy_AM", ​​​​​"ln_CG", ​​​​​"sr_Latn_BA", ​​​​​"en_MP", ​​​​​"ksb_TZ", ​​​​​"ar_SA", ​​​​​"ar_LY", ​​​​​"en_AT", ​​​​​"so_KE", ​​​​​"fr_CD", ​​​​​"af_NA", ​​​​​"en_NU", ​​​​​"es_PH", ​​​​​"en_KI", ​​​​​"en_JE", ​​​​​"lkt", ​​​​​"en_AU", ​​​​​"fa_IR", ​​​​​"uz_Latn_UZ", ​​​​​"ky_Cyrl", ​​​​​"zh_Hans_CN", ​​​​​"ewo_CM", ​​​​​"fr_PF", ​​​​​"ca_IT", ​​​​​"en_BZ", ​​​​​"ar_KW", ​​​​​"pt_GW", ​​​​​"fr_FR", ​​​​​"am_ET", ​​​​​"en_VC", ​​​​​"fr_DJ", ​​​​​"fr_CF", ​​​​​"es_SV", ​​​​​"en_MS", ​​​​​"pt_ST", ​​​​​"ar_SD", ​​​​​"luy_KE", ​​​​​"swc", ​​​​​"de_LI", ​​​​​"fr_CG", ​​​​​"zh_Hans_SG", ​​​​​"en_MT", ​​​​​"ewo", ​​​​​"af_ZA", ​​​​​"om_KE", ​​​​​"nl_SR", ​​​​​"es_ES", ​​​​​"es_DO", ​​​​​"ar_IQ", ​​​​​"fr_CH", ​​​​​"nnh_CM", ​​​​​"es_419", ​​​​​"en_MU", ​​​​​"en_US_POSIX", ​​​​​"yav_CM", ​​​​​"luo_KE", ​​​​​"dua_CM", ​​​​​"et_EE", ​​​​​"en_IE", ​​​​​"ak_GH", ​​​​​"rwk", ​​​​​"es_CL", ​​​​​"kea_CV", ​​​​​"fr_CI", ​​​​​"fr_BE", ​​​​​"en_NZ", ​​​​​"ky_Cyrl_KG", ​​​​​"en_LR", ​​​​​"en_KN", ​​​​​"nb_SJ", ​​​​​"sg", ​​​​​"sr_Cyrl_RS", ​​​​​"ru_RU", ​​​​​"en_ZW", ​​​​​"sv_AX", ​​​​​"si", ​​​​​"ga_IE", ​​​​​"en_VG", ​​​​​"sk", ​​​​​"agq_CM", ​​​​​"fr_BF", ​​​​​"naq_NA", ​​​​​"sl", ​​​​​"en_MW", ​​​​​"mr_IN", ​​​​​"az_Latn", ​​​​​"en_LS", ​​​​​"de_AT", ​​​​​"ka", ​​​​​"sn", ​​​​​"sr_Latn_ME", ​​​​​"fr_NC", ​​​​​"so", ​​​​​"is_IS", ​​​​​"twq", ​​​​​"ig_NG", ​​​​​"sq", ​​​​​"fo_FO", ​​​​​"sr", ​​​​​"tzm", ​​​​​"ga", ​​​​​"om", ​​​​​"en_LT", ​​​​​"bas_CM", ​​​​​"ki", ​​​​​"nl_BE", ​​​​​"ar_QA", ​​​​​"sv", ​​​​​"kk", ​​​​​"sw", ​​​​​"es_CO", ​​​​​"az_Latn_AZ", ​​​​​"rn_BI", ​​​​​"or", ​​​​​"kl", ​​​​​"ca", ​​​​​"en_VI", ​​​​​"km", ​​​​​"kn", ​​​​​"en_LU", ​​​​​"fr_SY", ​​​​​"ar_TN", ​​​​​"en_JM", ​​​​​"fr_PM", ​​​​​"ko", ​​​​​"fr_NE", ​​​​​"fr_MA", ​​​​​"gl", ​​​​​"ru_MD", ​​​​​"saq_KE", ​​​​​"ks", ​​​​​"fr_CM", ​​​​​"gv_IM", ​​​​​"fr_BI", ​​​​​"en_LV", ​​​​​"ks_Arab_IN", ​​​​​"es_NI", ​​​​​"en_GB", ​​​​​"kw", ​​​​​"nl_SX", ​​​​​"dav_KE", ​​​​​"tr_CY", ​​​​​"ky", ​​​​​"en_UG", ​​​​​"tzm_Latn", ​​​​​"en_TC", ​​​​​"nus_SD", ​​​​​"ar_EG", ​​​​​"fr_BJ", ​​​​​"gu", ​​​​​"es_PR", ​​​​​"fr_RW", ​​​​​"sr_Cyrl_BA", ​​​​​"gv", ​​​​​"fr_MC", ​​​​​"cs", ​​​​​"bez_TZ", ​​​​​"es_CR", ​​​​​"asa_TZ", ​​​​​"ar_EH", ​​​​​"ms_Arab_BN", ​​​​​"mn_Cyrl", ​​​​​"sbp_TZ", ​​​​​"ha_Latn_NE", ​​​​​"lt_LT", ​​​​​"mfe", ​​​​​"en_GD", ​​​​​"cy", ​​​​​"ca_FR", ​​​​​"es_BO", ​​​​​"fr_BL", ​​​​​"bn_IN", ​​​​​"uz_Cyrl_UZ", ​​​​​"az_Cyrl", ​​​​​"en_IM", ​​​​​"sw_KE", ​​​​​"en_SB", ​​​​​"ur_PK", ​​​​​"pa_Arab", ​​​​​"haw_US", ​​​​​"ar_SO", ​​​​​"en_IN", ​​​​​"ha_Latn", ​​​​​"fil", ​​​​​"fr_MF", ​​​​​"en_WS", ​​​​​"es_CU", ​​​​​"ja_JP", ​​​​​"en_SC", ​​​​​"en_IO", ​​​​​"pt_PT", ​​​​​"en_HK", ​​​​​"en_GG", ​​​​​"fr_MG", ​​​​​"de_LU", ​​​​​"ms_Latn_MY", ​​​​​"tg_Cyrl", ​​​​​"en_SD", ​​​​​"shi_Tfng", ​​​​​"ln_AO", ​​​​​"ug_Arab_CN", ​​​​​"as_IN", ​​​​​"en_GH", ​​​​​"ro_RO", ​​​​​"jgo_CM", ​​​​​"dua", ​​​​​"en_UM", ​​​​​"en_SE", ​​​​​"kn_IN", ​​​​​"en_KY", ​​​​​"vun_TZ", ​​​​​"kln", ​​​​​"en_GI", ​​​​​"ca_ES", ​​​​​"rof", ​​​​​"pt_CV", ​​​​​"kok", ​​​​​"pt_BR", ​​​​​"ar_DJ", ​​​​​"zh", ​​​​​"fi_FI", ​​​​​"tg_Cyrl_TJ", ​​​​​"es_PY", ​​​​​"ar_SS", ​​​​​"mua", ​​​​​"sr_Cyrl_ME", ​​​​​"vai_Vaii_LR", ​​​​​"en_001", ​​​​​"xog_UG", ​​​​​"en_TK", ​​​​​"si_LK", ​​​​​"en_SG", ​​​​​"nl_NL", ​​​​​"vi", ​​​​​"sv_SE", ​​​​​"pt_AO", ​​​​​"fr_DZ", ​​​​​"ca_AD", ​​​​​"xog", ​​​​​"en_IS", ​​​​​"nb", ​​​​​"seh_MZ", ​​​​​"es_AR", ​​​​​"sk_SK", ​​​​​"en_SH", ​​​​​"ti_ER", ​​​​​"nd", ​​​​​"az_Cyrl_AZ", ​​​​​"zu", ​​​​​"ne", ​​​​​"nd_ZW", ​​​​​"el_CY", ​​​​​"en_IT", ​​​​​"nl_BQ", ​​​​​"da_GL", ​​​​​"ja", ​​​​​"rm", ​​​​​"fr_ML", ​​​​​"rn", ​​​​​"en_VU", ​​​​​"rof_TZ", ​​​​​"ro", ​​​​​"ebu_KE", ​​​​​"ru_KG", ​​​​​"en_SI", ​​​​​"sg_CF", ​​​​​"mfe_MU", ​​​​​"nl", ​​​​​"brx", ​​​​​"bs_Latn", ​​​​​"fa", ​​​​​"zgh_MA", ​​​​​"en_GM", ​​​​​"shi_Latn", ​​​​​"en_FI", ​​​​​"nn", ​​​​​"en_EE", ​​​​​"ru", ​​​​​"kam_KE", ​​​​​"vai_Vaii", ​​​​​"ar_ER", ​​​​​"ti_ET", ​​​​​"rw", ​​​​​"ff", ​​​​​"luo", ​​​​​"fa_AF", ​​​​​"ha_Latn_NG", ​​​​​"nl_CW", ​​​​​"en_HR", ​​​​​"en_FJ", ​​​​​"fi", ​​​​​"pt_MO", ​​​​​"be", ​​​​​"en_US", ​​​​​"en_TO", ​​​​​"en_SK", ​​​​​"bg", ​​​​​"ru_BY", ​​​​​"it_IT", ​​​​​"ml_IN", ​​​​​"gsw_CH", ​​​​​"fo", ​​​​​"sv_FI", ​​​​​"en_FK", ​​​​​"nus", ​​​​​"ta_LK", ​​​​​"vun", ​​​​​"sr_Latn", ​​​​​"fr", ​​​​​"en_SL", ​​​​​"bm", ​​​​​"ar_BH", ​​​​​"guz", ​​​​​"bn", ​​​​​"bo", ​​​​​"ar_SY", ​​​​​"lo_LA", ​​​​​"ne_NP", ​​​​​"uz_Latn", ​​​​​"be_BY", ​​​​​"es_IC", ​​​​​"sr_Latn_XK", ​​​​​"ar_MA", ​​​​​"pa_Guru_IN", ​​​​​"br", ​​​​​"luy", ​​​​​"kde_TZ", ​​​​​"bs", ​​​​​"hu_HU", ​​​​​"ar_AE", ​​​​​"en_HU", ​​​​​"zh_Hans", ​​​​​"en_FM", ​​​​​"sq_AL", ​​​​​"ko_KP", ​​​​​"en_150", ​​​​​"en_DE", ​​​​​"fr_MQ", ​​​​​"en_CA", ​​​​​"en_TR", ​​​​​"ro_MD", ​​​​​"es_VE", ​​​​​"fr_WF", ​​​​​"mt_MT", ​​​​​"kab", ​​​​​"nmg_CM", ​​​​​"ru_UA", ​​​​​"fr_MR", ​​​​​"tk_Latn_TM", ​​​​​"zh_Hans_MO", ​​​​​"mn_Cyrl_MN", ​​​​​"bs_Cyrl", ​​​​​"sw_UG", ​​​​​"ko_KR", ​​​​​"en_DG", ​​​​​"bo_IN", ​​​​​"en_CC", ​​​​​"shi_Tfng_MA", ​​​​​"lag", ​​​​​"it_SM", ​​​​​"en_TT", ​​​​​"ms_Arab_MY", ​​​​​"sq_MK", ​​​​​"ms_Latn", ​​​​​"bem_ZM", ​​​​​"kde", ​​​​​"ar_OM", ​​​​​"cgg", ​​​​​"bas", ​​​​​"kam", ​​​​​"zh_Hant", ​​​​​"es_MX", ​​​​​"en_GU", ​​​​​"fr_MU", ​​​​​"fr_KM", ​​​​​"ar_LB", ​​​​​"en_BA", ​​​​​"en_TV", ​​​​​"sr_Cyrl", ​​​​​"dje", ​​​​​"kab_DZ", ​​​​​"fil_PH", ​​​​​"vai", ​​​​​"hr_HR", ​​​​​"bs_Latn_BA", ​​​​​"nl_AW", ​​​​​"dav", ​​​​​"so_SO", ​​​​​"ar_PS", ​​​​​"en_FR", ​​​​​"uz_Cyrl", ​​​​​"ff_SN", ​​​​​"en_BB", ​​​​​"ki_KE", ​​​​​"naq", ​​​​​"en_SS", ​​​​​"mg_MG", ​​​​​"mas_KE", ​​​​​"en_RO", ​​​​​"en_PG", ​​​​​"mgh", ​​​​​"dyo_SN", ​​​​​"mas", ​​​​​"agq", ​​​​​"bn_BD", ​​​​​"haw", ​​​​​"nb_NO", ​​​​​"da_DK", ​​​​​"en_DK", ​​​​​"saq", ​​​​​"ug", ​​​​​"cy_GB", ​​​​​"fr_YT", ​​​​​"jmc", ​​​​​"ses_ML", ​​​​​"en_PH", ​​​​​"de_DE", ​​​​​"ar_YE", ​​​​​"bm_ML", ​​​​​"yo", ​​​​​"lkt_US", ​​​​​"uz_Arab_AF", ​​​​​"jgo", ​​​​​"uk", ​​​​​"sl_SI", ​​​​​"en_CH", ​​​​​"asa", ​​​​​"lg_UG", ​​​​​"mgo", ​​​​​"id_ID", ​​​​​"en_NA", ​​​​​"en_GY", ​​​​​"zgh", ​​​​​"pt_MZ", ​​​​​"fr_LU", ​​​​​"kk_Cyrl", ​​​​​"mas_TZ", ​​​​​"ur", ​​​​​"en_DM", ​​​​​"ta_MY", ​​​​​"en_BE", ​​​​​"mg", ​​​​​"fr_GA", ​​​​​"ka_GE", ​​​​​"nmg", ​​​​​"en_TZ", ​​​​​"eu_ES", ​​​​​"ar_DZ", ​​​​​"id", ​​​​​"so_DJ", ​​​​​"yav", ​​​​​"mk", ​​​​​"pa_Arab_PK", ​​​​​"ml", ​​​​​"en_ER", ​​​​​"ig", ​​​​​"mn", ​​​​​"ksb", ​​​​​"uz", ​​​​​"vi_VN", ​​​​​"ii", ​​​​​"en_PK", ​​​​​"ee", ​​​​​"mr", ​​​​​"ms", ​​​​​"en_ES", ​​​​​"sq_XK", ​​​​​"it_CH", ​​​​​"mt", ​​​​​"en_CK", ​​​​​"br_FR", ​​​​​"sr_Cyrl_XK", ​​​​​"ksf", ​​​​​"en_SX", ​​​​​"bg_BG", ​​​​​"en_PL", ​​​​​"af", ​​​​​"el", ​​​​​"cs_CZ", ​​​​​"fr_TD", ​​​​​"zh_Hans_HK", ​​​​​"is", ​​​​​"my", ​​​​​"en", ​​​​​"it", ​​​​​"ii_CN", ​​​​​"eo", ​​​​​"iu", ​​​​​"en_ZA", ​​​​​"en_AD", ​​​​​"ak", ​​​​​"en_RU", ​​​​​"kkj_CM", ​​​​​"am", ​​​​​"es", ​​​​​"et", ​​​​​"uk_UA"​​​}

set isoLang to (current application’s NSLocale’s ISOLanguageCodes()) as anything
log isoLang
–>  {​​​​​"aa", ​​​​​"ab", ​​​​​"ace", ​​​​​"ach", ​​​​​"ada", ​​​​​"ady", ​​​​​"ae", ​​​​​"af", ​​​​​"afa", ​​​​​"afh", ​​​​​"agq", ​​​​​"ain", ​​​​​"ak", ​​​​​"akk", ​​​​​"ale", ​​​​​"alg", ​​​​​"alt", ​​​​​"am", ​​​​​"an", ​​​​​"ang", ​​​​​"anp", ​​​​​"apa", ​​​​​"ar", ​​​​​"arc", ​​​​​"arn", ​​​​​"arp", ​​​​​"art", ​​​​​"arw", ​​​​​"as", ​​​​​"asa", ​​​​​"ast", ​​​​​"ath", ​​​​​"aus", ​​​​​"av", ​​​​​"awa", ​​​​​"ay", ​​​​​"az", ​​​​​"ba", ​​​​​"bad", ​​​​​"bai", ​​​​​"bal", ​​​​​"ban", ​​​​​"bas", ​​​​​"bat", ​​​​​"bax", ​​​​​"bbj", ​​​​​"be", ​​​​​"bej", ​​​​​"bem", ​​​​​"ber", ​​​​​"bez", ​​​​​"bfd", ​​​​​"bg", ​​​​​"bh", ​​​​​"bho", ​​​​​"bi", ​​​​​"bik", ​​​​​"bin", ​​​​​"bkm", ​​​​​"bla", ​​​​​"bm", ​​​​​"bn", ​​​​​"bnt", ​​​​​"bo", ​​​​​"br", ​​​​​"bra", ​​​​​"brx", ​​​​​"bs", ​​​​​"bss", ​​​​​"btk", ​​​​​"bua", ​​​​​"bug", ​​​​​"bum", ​​​​​"byn", ​​​​​"byv", ​​​​​"ca", ​​​​​"cad", ​​​​​"cai", ​​​​​"car", ​​​​​"cau", ​​​​​"cay", ​​​​​"cch", ​​​​​"ce", ​​​​​"ceb", ​​​​​"cel", ​​​​​"cgg", ​​​​​"ch", ​​​​​"chb", ​​​​​"chg", ​​​​​"chk", ​​​​​"chm", ​​​​​"chn", ​​​​​"cho", ​​​​​"chp", ​​​​​"chr", ​​​​​"chy", ​​​​​"ckb", ​​​​​"cmc", ​​​​​"co", ​​​​​"cop", ​​​​​"cpe", ​​​​​"cpf", ​​​​​"cpp", ​​​​​"cr", ​​​​​"crh", ​​​​​"crp", ​​​​​"cs", ​​​​​"csb", ​​​​​"cu", ​​​​​"cus", ​​​​​"cv", ​​​​​"cy", ​​​​​"da", ​​​​​"dak", ​​​​​"dar", ​​​​​"dav", ​​​​​"day", ​​​​​"de", ​​​​​"del", ​​​​​"den", ​​​​​"dgr", ​​​​​"din", ​​​​​"dje", ​​​​​"doi", ​​​​​"dra", ​​​​​"dsb", ​​​​​"dua", ​​​​​"dum", ​​​​​"dv", ​​​​​"dyo", ​​​​​"dyu", ​​​​​"dz", ​​​​​"dzg", ​​​​​"ebu", ​​​​​"ee", ​​​​​"efi", ​​​​​"egy", ​​​​​"eka", ​​​​​"el", ​​​​​"elx", ​​​​​"en", ​​​​​"enm", ​​​​​"eo", ​​​​​"es", ​​​​​"et", ​​​​​"eu", ​​​​​"ewo", ​​​​​"fa", ​​​​​"fan", ​​​​​"fat", ​​​​​"ff", ​​​​​"fi", ​​​​​"fil", ​​​​​"fiu", ​​​​​"fj", ​​​​​"fo", ​​​​​"fon", ​​​​​"fr", ​​​​​"frm", ​​​​​"fro", ​​​​​"frr", ​​​​​"frs", ​​​​​"fur", ​​​​​"fy", ​​​​​"ga", ​​​​​"gaa", ​​​​​"gay", ​​​​​"gba", ​​​​​"gd", ​​​​​"gem", ​​​​​"gez", ​​​​​"gil", ​​​​​"gl", ​​​​​"gmh", ​​​​​"gn", ​​​​​"goh", ​​​​​"gon", ​​​​​"gor", ​​​​​"got", ​​​​​"grb", ​​​​​"grc", ​​​​​"gsw", ​​​​​"gu", ​​​​​"guz", ​​​​​"gv", ​​​​​"gwi", ​​​​​"ha", ​​​​​"hai", ​​​​​"haw", ​​​​​"he", ​​​​​"hi", ​​​​​"hil", ​​​​​"him", ​​​​​"hit", ​​​​​"hmn", ​​​​​"ho", ​​​​​"hr", ​​​​​"hsb", ​​​​​"ht", ​​​​​"hu", ​​​​​"hup", ​​​​​"hy", ​​​​​"hz", ​​​​​"ia", ​​​​​"iba", ​​​​​"ibb", ​​​​​"id", ​​​​​"ie", ​​​​​"ig", ​​​​​"ii", ​​​​​"ijo", ​​​​​"ik", ​​​​​"ilo", ​​​​​"inc", ​​​​​"ine", ​​​​​"inh", ​​​​​"io", ​​​​​"ira", ​​​​​"iro", ​​​​​"is", ​​​​​"it", ​​​​​"iu", ​​​​​"ja", ​​​​​"jbo", ​​​​​"jgo", ​​​​​"jmc", ​​​​​"jpr", ​​​​​"jrb", ​​​​​"jv", ​​​​​"ka", ​​​​​"kaa", ​​​​​"kab", ​​​​​"kac", ​​​​​"kaj", ​​​​​"kam", ​​​​​"kar", ​​​​​"kaw", ​​​​​"kbd", ​​​​​"kbl", ​​​​​"kcg", ​​​​​"kde", ​​​​​"kea", ​​​​​"kfo", ​​​​​"kg", ​​​​​"kha", ​​​​​"khi", ​​​​​"kho", ​​​​​"khq", ​​​​​"ki", ​​​​​"kj", ​​​​​"kk", ​​​​​"kkj", ​​​​​"kl", ​​​​​"kln", ​​​​​"km", ​​​​​"kmb", ​​​​​"kn", ​​​​​"ko", ​​​​​"kok", ​​​​​"kos", ​​​​​"kpe", ​​​​​"kr", ​​​​​"krc", ​​​​​"krl", ​​​​​"kro", ​​​​​"kru", ​​​​​"ks", ​​​​​"ksb", ​​​​​"ksf", ​​​​​"ksh", ​​​​​"ku", ​​​​​"kum", ​​​​​"kut", ​​​​​"kv", ​​​​​"kw", ​​​​​"ky", ​​​​​"la", ​​​​​"lad", ​​​​​"lag", ​​​​​"lah", ​​​​​"lam", ​​​​​"lb", ​​​​​"lez", ​​​​​"lg", ​​​​​"li", ​​​​​"lkt", ​​​​​"ln", ​​​​​"lo", ​​​​​"lol", ​​​​​"loz", ​​​​​"lt", ​​​​​"lu", ​​​​​"lua", ​​​​​"lui", ​​​​​"lun", ​​​​​"luo", ​​​​​"lus", ​​​​​"luy", ​​​​​"lv", ​​​​​"mad", ​​​​​"maf", ​​​​​"mag", ​​​​​"mai", ​​​​​"mak", ​​​​​"man", ​​​​​"map", ​​​​​"mas", ​​​​​"mde", ​​​​​"mdf", ​​​​​"mdr", ​​​​​"men", ​​​​​"mer", ​​​​​"mfe", ​​​​​"mg", ​​​​​"mga", ​​​​​"mgh", ​​​​​"mgo", ​​​​​"mh", ​​​​​"mi", ​​​​​"mic", ​​​​​"min", ​​​​​"mis", ​​​​​"mk", ​​​​​"mkh", ​​​​​"ml", ​​​​​"mn", ​​​​​"mnc", ​​​​​"mni", ​​​​​"mno", ​​​​​"mo", ​​​​​"moh", ​​​​​"mos", ​​​​​"mr", ​​​​​"ms", ​​​​​"mt", ​​​​​"mua", ​​​​​"mul", ​​​​​"mun", ​​​​​"mus", ​​​​​"mwl", ​​​​​"mwr", ​​​​​"my", ​​​​​"mye", ​​​​​"myn", ​​​​​"myv", ​​​​​"na", ​​​​​"nah", ​​​​​"nai", ​​​​​"nap", ​​​​​"naq", ​​​​​"nb", ​​​​​"nd", ​​​​​"nds", ​​​​​"ne", ​​​​​"new", ​​​​​"ng", ​​​​​"nia", ​​​​​"nic", ​​​​​"niu", ​​​​​"nl", ​​​​​"nmg", ​​​​​"nn", ​​​​​"nnh", ​​​​​"no", ​​​​​"nog", ​​​​​"non", ​​​​​"nqo", ​​​​​"nr", ​​​​​"nso", ​​​​​"nub", ​​​​​"nus", ​​​​​"nv", ​​​​​"nwc", ​​​​​"ny", ​​​​​"nym", ​​​​​"nyn", ​​​​​"nyo", ​​​​​"nzi", ​​​​​"oc", ​​​​​"oj", ​​​​​"om", ​​​​​"or", ​​​​​"os", ​​​​​"osa", ​​​​​"ota", ​​​​​"oto", ​​​​​"pa", ​​​​​"paa", ​​​​​"pag", ​​​​​"pal", ​​​​​"pam", ​​​​​"pap", ​​​​​"pau", ​​​​​"peo", ​​​​​"phi", ​​​​​"phn", ​​​​​"pi", ​​​​​"pl", ​​​​​"pon", ​​​​​"pra", ​​​​​"pro", ​​​​​"ps", ​​​​​"pt", ​​​​​"qu", ​​​​​"raj", ​​​​​"rap", ​​​​​"rar", ​​​​​"rm", ​​​​​"rn", ​​​​​"ro", ​​​​​"roa", ​​​​​"rof", ​​​​​"rom", ​​​​​"ru", ​​​​​"rup", ​​​​​"rw", ​​​​​"rwk", ​​​​​"sa", ​​​​​"sad", ​​​​​"sah", ​​​​​"sai", ​​​​​"sal", ​​​​​"sam", ​​​​​"saq", ​​​​​"sas", ​​​​​"sat", ​​​​​"sba", ​​​​​"sbp", ​​​​​"sc", ​​​​​"scn", ​​​​​"sco", ​​​​​"sd", ​​​​​"se", ​​​​​"see", ​​​​​"seh", ​​​​​"sel", ​​​​​"sem", ​​​​​"ses", ​​​​​"sg", ​​​​​"sga", ​​​​​"sgn", ​​​​​"shi", ​​​​​"shn", ​​​​​"shu", ​​​​​"si", ​​​​​"sid", ​​​​​"sio", ​​​​​"sit", ​​​​​"sk", ​​​​​"sl", ​​​​​"sla", ​​​​​"sm", ​​​​​"sma", ​​​​​"smi", ​​​​​"smj", ​​​​​"smn", ​​​​​"sms", ​​​​​"sn", ​​​​​"snk", ​​​​​"so", ​​​​​"sog", ​​​​​"son", ​​​​​"sq", ​​​​​"sr", ​​​​​"srn", ​​​​​"srr", ​​​​​"ss", ​​​​​"ssa", ​​​​​"ssy", ​​​​​"st", ​​​​​"su", ​​​​​"suk", ​​​​​"sus", ​​​​​"sux", ​​​​​"sv", ​​​​​"sw", ​​​​​"swb", ​​​​​"swc", ​​​​​"syc", ​​​​​"syr", ​​​​​"ta", ​​​​​"tai", ​​​​​"te", ​​​​​"tem", ​​​​​"teo", ​​​​​"ter", ​​​​​"tet", ​​​​​"tg", ​​​​​"th", ​​​​​"ti", ​​​​​"tig", ​​​​​"tiv", ​​​​​"tk", ​​​​​"tkl", ​​​​​"tl", ​​​​​"tlh", ​​​​​"tli", ​​​​​"tmh", ​​​​​"tn", ​​​​​"to", ​​​​​"tog", ​​​​​"tpi", ​​​​​"tr", ​​​​​"trv", ​​​​​"ts", ​​​​​"tsi", ​​​​​"tt", ​​​​​"tum", ​​​​​"tup", ​​​​​"tut", ​​​​​"tvl", ​​​​​"tw", ​​​​​"twq", ​​​​​"ty", ​​​​​"tyv", ​​​​​"tzm", ​​​​​"udm", ​​​​​"ug", ​​​​​"uga", ​​​​​"uk", ​​​​​"umb", ​​​​​"und", ​​​​​"ur", ​​​​​"uz", ​​​​​"vai", ​​​​​"ve", ​​​​​"vi", ​​​​​"vo", ​​​​​"vot", ​​​​​"vun", ​​​​​"wa", ​​​​​"wae", ​​​​​"wak", ​​​​​"wal", ​​​​​"war", ​​​​​"was", ​​​​​"wen", ​​​​​"wo", ​​​​​"xal", ​​​​​"xh", ​​​​​"xog", ​​​​​"yao", ​​​​​"yap", ​​​​​"yav", ​​​​​"ybb", ​​​​​"yi", ​​​​​"yo", ​​​​​"ypk", ​​​​​"yue", ​​​​​"za", ​​​​​"zap", ​​​​​"zbl", ​​​​​"zen", ​​​​​"zgh", ​​​​​"zh", ​​​​​"znd", ​​​​​"zu", ​​​​​"zun", ​​​​​"zxx", ​​​​​"zza"​​​}

set commonCurrency to (current application’s NSLocale’s commonISOCurrencyCodes()) as anything
log commonCurrency
–>  (NSArray) {​​​​​"AED", ​​​​​"AFN", ​​​​​"ALL", ​​​​​"AMD", ​​​​​"ANG", ​​​​​"AOA", ​​​​​"ARS", ​​​​​"AUD", ​​​​​"AWG", ​​​​​"AZN", ​​​​​"BAM", ​​​​​"BBD", ​​​​​"BDT", ​​​​​"BGN", ​​​​​"BHD", ​​​​​"BIF", ​​​​​"BMD", ​​​​​"BND", ​​​​​"BOB", ​​​​​"BRL", ​​​​​"BSD", ​​​​​"BTN", ​​​​​"BWP", ​​​​​"BYR", ​​​​​"BZD", ​​​​​"CAD", ​​​​​"CDF", ​​​​​"CHF", ​​​​​"CLP", ​​​​​"CNY", ​​​​​"COP", ​​​​​"CRC", ​​​​​"CUC", ​​​​​"CUP", ​​​​​"CVE", ​​​​​"CZK", ​​​​​"DJF", ​​​​​"DKK", ​​​​​"DOP", ​​​​​"DZD", ​​​​​"EGP", ​​​​​"ERN", ​​​​​"ETB", ​​​​​"EUR", ​​​​​"FJD", ​​​​​"FKP", ​​​​​"GBP", ​​​​​"GEL", ​​​​​"GHS", ​​​​​"GIP", ​​​​​"GMD", ​​​​​"GNF", ​​​​​"GTQ", ​​​​​"GWP", ​​​​​"GYD", ​​​​​"HKD", ​​​​​"HNL", ​​​​​"HRK", ​​​​​"HTG", ​​​​​"HUF", ​​​​​"IDR", ​​​​​"ILS", ​​​​​"INR", ​​​​​"IQD", ​​​​​"IRR", ​​​​​"ISK", ​​​​​"JMD", ​​​​​"JOD", ​​​​​"JPY", ​​​​​"KES", ​​​​​"KGS", ​​​​​"KHR", ​​​​​"KMF", ​​​​​"KPW", ​​​​​"KRW", ​​​​​"KWD", ​​​​​"KYD", ​​​​​"KZT", ​​​​​"LAK", ​​​​​"LBP", ​​​​​"LKR", ​​​​​"LRD", ​​​​​"LSL", ​​​​​"LTL", ​​​​​"LVL", ​​​​​"LYD", ​​​​​"MAD", ​​​​​"MDL", ​​​​​"MGA", ​​​​​"MKD", ​​​​​"MMK", ​​​​​"MNT", ​​​​​"MOP", ​​​​​"MRO", ​​​​​"MUR", ​​​​​"MVR", ​​​​​"MWK", ​​​​​"MXN", ​​​​​"MYR", ​​​​​"MZE", ​​​​​"MZN", ​​​​​"NAD", ​​​​​"NGN", ​​​​​"NIO", ​​​​​"NOK", ​​​​​"NPR", ​​​​​"NZD", ​​​​​"OMR", ​​​​​"PAB", ​​​​​"PEN", ​​​​​"PGK", ​​​​​"PHP", ​​​​​"PKR", ​​​​​"PLN", ​​​​​"PYG", ​​​​​"QAR", ​​​​​"RON", ​​​​​"RSD", ​​​​​"RUB", ​​​​​"RWF", ​​​​​"SAR", ​​​​​"SBD", ​​​​​"SCR", ​​​​​"SDG", ​​​​​"SEK", ​​​​​"SGD", ​​​​​"SHP", ​​​​​"SKK", ​​​​​"SLL", ​​​​​"SOS", ​​​​​"SRD", ​​​​​"SSP", ​​​​​"STD", ​​​​​"SVC", ​​​​​"SYP", ​​​​​"SZL", ​​​​​"THB", ​​​​​"TJS", ​​​​​"TMT", ​​​​​"TND", ​​​​​"TOP", ​​​​​"TRY", ​​​​​"TTD", ​​​​​"TWD", ​​​​​"TZS", ​​​​​"UAH", ​​​​​"UGX", ​​​​​"USD", ​​​​​"UYU", ​​​​​"UZS", ​​​​​"VEF", ​​​​​"VND", ​​​​​"VUV", ​​​​​"WST", ​​​​​"XAF", ​​​​​"XCD", ​​​​​"XOF", ​​​​​"XPF", ​​​​​"YER", ​​​​​"ZAR", ​​​​​"ZMW"​​​}

set aLoc to (current application’s NSLocale’s localeIdentifierFromWindowsLocaleCode:1041) as anything
log aLoc
–>  "ja_JP"
— https://msdn.microsoft.com/ja-jp/library/Cc392381.aspx

set aLocID to (current application’s NSLocale’s windowsLocaleCodeFromLocaleIdentifier:"ja_JP") as anything
log aLocID
–>  1041

set prefLang to (current application’s NSLocale’s preferredLanguages()) as anything
log prefLang
–>   {​​​​​"ja", ​​​​​"en-US", ​​​​​"en-GB", ​​​​​"fr", ​​​​​"en"​​​}

set aLangDIrect1 to (current application’s NSLocale’s characterDirectionForLanguage:"ja") as anything –日本語
log aLangDIrect1
–>  1 –NSLocaleLanguageDirectionLeftToRight
set aLangDIrect2 to (current application’s NSLocale’s characterDirectionForLanguage:"ar") as anything –アラビア語
log aLangDIrect2
–>  2 –NSLocaleLanguageDirectionRightToLeft

set aLangLineDIrect1 to (current application’s NSLocale’s lineDirectionForLanguage:"ja") as anything –日本語
log aLangLineDIrect1
–>  3 –NSLocaleLanguageDirectionTopToBottom
set aLangLineDIrect2 to (current application’s NSLocale’s lineDirectionForLanguage:"ar") as anything –アラビア語
log aLangLineDIrect2
–>  3 –NSLocaleLanguageDirectionTopToBottom

★Click Here to Open This Script 

(Visited 16 times, 1 visits today)
Posted in Calendar System Text | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

すべてのLocaleから各種情報を取得

Posted on 2月 22, 2018 by Takaaki Naganoya
AppleScript名:すべてのLocaleから各種情報を取得
— Created 2015-10-03 by Takaaki Naganoya
— 2015 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set allLocaleIdentifiers to (current application’s NSLocale’s availableLocaleIdentifiers()) as list

set cList to {}
repeat with i in allLocaleIdentifiers
  set j to contents of i
  
  
set tmpLoc to (current application’s NSLocale’s alloc()’s initWithLocaleIdentifier:j)
  
set aLangCode to (tmpLoc’s objectForKey:(current application’s NSLocaleLanguageCode)) as text
  
set aCountryCode to (tmpLoc’s objectForKey:(current application’s NSLocaleCountryCode)) as text
  
set aCCYSymbol to (tmpLoc’s objectForKey:(current application’s NSLocaleCurrencySymbol)) as text
  
set aLocID to (tmpLoc’s objectForKey:(current application’s NSLocaleIdentifier)) as text
  
–set aCountryName to (tmpLoc’s displayNameForKey:(current application’s NSLocaleCountryCode))
  
set locIDDisplayName to (tmpLoc’s displayNameForKey:(current application’s NSLocaleIdentifier) value:aLocID) as text
  
  
set the end of cList to {aLocID, aLangCode, aCountryCode, aCCYSymbol, locIDDisplayName}
end repeat

cList

–>  {​​​​​{​​​​​​​"eu", ​​​​​​​"eu", ​​​​​​​"missing value", ​​​​​​​"¤", ​​​​​​​"euskara"​​​​​},…. ​​​​​ ​​​​​{​​​​​​​"ja_JP", ​​​​​​​"ja", ​​​​​​​"JP", ​​​​​​​"¥", ​​​​​​​"日本語 (日本)"​​​​​}, ​​​​​….. ​​​​​{​​​​​​​"ja", ​​​​​​​"ja", ​​​​​​​"missing value", ​​​​​​​"¤", ​​​​​​​"日本語"​​​​​}, ​​​​​……….​​​, ​​​​​{​​​​​​​"en_US", ​​​​​​​"en", ​​​​​​​"US", ​​​​​​​"$", ​​​​​​​"English (United States)"​​​​​}, ​​​​​{​​​​​​​"en_US_POSIX", ​​​​​​​"en", ​​​​​​​"US", ​​​​​​​"$", ​​​​​​​"English (United States, Computer)"​​​​​}, ​​​​​ ​​​​​ ​​​​​{​​​​​​​"zh-Hans", ​​​​​​​"zh", ​​​​​​​"missing value", ​​​​​​​"¤", ​​​​​​​"中文(简体)"​​​​​},….. ​​​​​{​​​​​​​"zh-Hant", ​​​​​​​"zh", ​​​​​​​"missing value", ​​​​​​​"¤", ​​​​​​​"中文(繁體)"​​​​​}, ​​​​​….{​​​​​​​"zh-Hans_HK", ​​​​​​​"zh", ​​​​​​​"HK", ​​​​​​​"HK$", ​​​​​​​"中文(简体、中国香港特别行政区)"​​​​​},​​​}

★Click Here to Open This Script 

(Visited 21 times, 1 visits today)
Posted in Calendar System Text | Tagged 10.11savvy 10.12savvy 10.13savvy | Leave a comment

Post navigation

  • Older posts
  • Newer posts

電子書籍(PDF)をオンラインストアで販売中!

Google Search

Popular posts

  • AppleScriptによるWebブラウザ自動操縦ガイド
  • macOS 13, Ventura(継続更新)
  • ドラッグ&ドロップ機能の未来?
  • Intel MacとApple Silicon Macの速度差〜画像処理
  • macOS 12.x上のAppleScriptのトラブルまとめ
  • マウスの右クリックメニューをカスタマイズするService Station
  • macOS 12.3 beta 5、ASの障害が解消される(?)
  • PFiddlesoft UI Browserが製品終了に
  • CotEditorで選択範囲の行頭にある数字をリナンバーする v1
  • SF Symbolsを名称で指定してPNG画像化
  • 不可視プロセスで表示したNSAlertを最前面に表示
  • 与えられた自然言語テキストから言語を推測して、指定の性別で、TTSキャラクタを自動選択して読み上げ
  • 新刊発売:AppleScriptによるWebブラウザ自動操縦ガイド
  • macOS 12.3 beta4、まだ直らないASまわりの障害
  • Safariで表示中のYouTubeムービーのサムネイル画像を取得
  • Pixelmator Pro v2.4.1で新機能追加+AppleScriptコマンド追加
  • macOS 12のスクリプトエディタで、Context Menu機能にバグ
  • macOS 12.3上でFinder上で選択中のファイルをそのままオープンできない件
  • SafariでブックマークされたURL一覧を取得
  • 人類史上初、魔導書の観点から書かれたAppleScript入門書「7つの宝珠」シリーズ開始?!

Tags

10.11savvy (1102) 10.12savvy (1243) 10.13savvy (1391) 10.14savvy (586) 10.15savvy (434) 11.0savvy (274) 12.0savvy (166) 13.0savvy (21) CotEditor (60) Finder (47) iTunes (19) Keynote (97) NSAlert (60) NSArray (51) NSBezierPath (18) NSBitmapImageRep (21) NSBundle (20) NSButton (34) NSColor (51) NSDictionary (27) NSFileManager (23) NSFont (18) NSImage (42) NSJSONSerialization (21) NSMutableArray (62) NSMutableDictionary (21) NSPredicate (36) NSRunningApplication (56) NSScreen (30) NSScrollView (22) NSString (118) NSURL (97) NSURLRequest (23) NSUTF8StringEncoding (30) NSUUID (18) NSView (33) NSWorkspace (20) Numbers (55) Pages (35) Safari (40) Script Editor (20) WKUserContentController (21) WKUserScript (20) WKWebView (22) WKWebViewConfiguration (22)

カテゴリー

  • 2D Bin Packing
  • AirDrop
  • AirPlay
  • Animation
  • AppleScript Application on Xcode
  • beta
  • Bluetooth
  • Books
  • boolean
  • bounds
  • Bug
  • Calendar
  • call by reference
  • Clipboard
  • Code Sign
  • Color
  • Custom Class
  • dialog
  • drive
  • exif
  • file
  • File path
  • filter
  • folder
  • Font
  • Font
  • GAME
  • geolocation
  • GUI
  • GUI Scripting
  • Hex
  • History
  • How To
  • iCloud
  • Icon
  • Image
  • Input Method
  • Internet
  • iOS App
  • JavaScript
  • JSON
  • JXA
  • Keychain
  • Keychain
  • Language
  • Library
  • list
  • Locale
  • Machine Learning
  • Map
  • Markdown
  • Menu
  • Metadata
  • MIDI
  • MIME
  • Natural Language Processing
  • Network
  • news
  • Noification
  • Notarization
  • Number
  • Object control
  • OCR
  • OSA
  • PDF
  • Peripheral
  • PRODUCTS
  • QR Code
  • Raw AppleEvent Code
  • Record
  • recursive call
  • regexp
  • Release
  • Remote Control
  • Require Control-Command-R to run
  • REST API
  • Review
  • RTF
  • Sandbox
  • Screen Saver
  • Script Libraries
  • sdef
  • search
  • Security
  • selection
  • shell script
  • Shortcuts Workflow
  • Sort
  • Sound
  • Spellchecker
  • Spotlight
  • SVG
  • System
  • Tag
  • Telephony
  • Text
  • Text to Speech
  • timezone
  • Tools
  • Update
  • URL
  • UTI
  • Web Contents Control
  • WiFi
  • XML
  • XML-RPC
  • イベント(Event)
  • 未分類

アーカイブ

  • 2023年1月
  • 2022年12月
  • 2022年11月
  • 2022年10月
  • 2022年9月
  • 2022年8月
  • 2022年7月
  • 2022年6月
  • 2022年5月
  • 2022年4月
  • 2022年3月
  • 2022年2月
  • 2022年1月
  • 2021年12月
  • 2021年11月
  • 2021年10月
  • 2021年9月
  • 2021年8月
  • 2021年7月
  • 2021年6月
  • 2021年5月
  • 2021年4月
  • 2021年3月
  • 2021年2月
  • 2021年1月
  • 2020年12月
  • 2020年11月
  • 2020年10月
  • 2020年9月
  • 2020年8月
  • 2020年7月
  • 2020年6月
  • 2020年5月
  • 2020年4月
  • 2020年3月
  • 2020年2月
  • 2020年1月
  • 2019年12月
  • 2019年11月
  • 2019年10月
  • 2019年9月
  • 2019年8月
  • 2019年7月
  • 2019年6月
  • 2019年5月
  • 2019年4月
  • 2019年3月
  • 2019年2月
  • 2019年1月
  • 2018年12月
  • 2018年11月
  • 2018年10月
  • 2018年9月
  • 2018年8月
  • 2018年7月
  • 2018年6月
  • 2018年5月
  • 2018年4月
  • 2018年3月
  • 2018年2月

https://piyomarusoft.booth.pm/items/301502

メタ情報

  • 登録
  • ログイン
  • 投稿フィード
  • コメントフィード
  • WordPress.org

Forum Posts

  • 人気のトピック
  • 返信がないトピック

メタ情報

  • 登録
  • ログイン
  • 投稿フィード
  • コメントフィード
  • WordPress.org
Proudly powered by WordPress
Theme: Flint by Star Verte LLC