AppleScript名:現在のLocaleのIdentifier文字を取得する |
use AppleScript version "2.4" use scripting additions use framework "Foundation" set aLoc to current application’s NSLocale’s currentLocale()’s identifier() –> (NSString) "ja_JP" set aLoc to current application’s NSLocale’s systemLocale() –> (__NSCFLocale) <__NSCFLocale: 0x6180000f5480> set isoCountry to current application’s NSLocale’s ISOCountryCodes() –> (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() –> (NSArray) {"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() –> (NSArray) {"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() –> (NSArray) {"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() –> (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 –> (NSString) "ja_JP" — https://msdn.microsoft.com/ja-jp/library/Cc392381.aspx set aLocID to current application’s NSLocale’s windowsLocaleCodeFromLocaleIdentifier:"ja_JP" –> 1041 set prefLang to current application’s NSLocale’s preferredLanguages() –> (NSArray) {"ja", "en-US", "en-GB", "fr", "en"} set aLangDIrect1 to current application’s NSLocale’s characterDirectionForLanguage:"ja" –日本語 –> 1 –NSLocaleLanguageDirectionLeftToRight set aLangDIrect2 to current application’s NSLocale’s characterDirectionForLanguage:"ar" –アラビア語 –> 2 –NSLocaleLanguageDirectionRightToLeft set aLangLineDIrect1 to current application’s NSLocale’s lineDirectionForLanguage:"ja" –日本語 –> 3 –NSLocaleLanguageDirectionTopToBottom set aLangLineDIrect2 to current application’s NSLocale’s lineDirectionForLanguage:"ar" –アラビア語 –> 3 –NSLocaleLanguageDirectionTopToBottom |
タグ: 10.12savvy
すべてのLocaleから各種情報を取得
AppleScript名:すべてのLocaleから各種情報を取得 |
— Created 2015-10-03 00:17:01 +0900 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$", "中文(简体、中国香港特别行政区)"},} |
Current Localeから各種情報を取得する
AppleScript名:Current Localeから各種情報を取得する |
— Created 2016-10-12 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set curLocale to current application’s NSLocale’s currentLocale() set aDS1 to curLocale’s objectForKey:(current application’s NSLocaleDecimalSeparator) –> (NSString) "." set aDS2 to curLocale’s objectForKey:(current application’s NSLocaleGroupingSeparator) –> (NSString) "," set aDS3 to curLocale’s objectForKey:(current application’s NSLocaleCurrencySymbol) –> (NSString) "¥" set aDS4 to curLocale’s objectForKey:(current application’s NSLocaleCurrencyCode) –> (NSString) "JPY" set aDS5 to curLocale’s objectForKey:(current application’s NSLocaleCollatorIdentifier) –> (NSString) "ja-JP" set aDS6 to curLocale’s objectForKey:(current application’s NSLocaleQuotationBeginDelimiterKey) –> (NSString) "「" set aDS7 to curLocale’s objectForKey:(current application’s NSLocaleQuotationEndDelimiterKey) –> (NSString) "」" set aDS8 to curLocale’s objectForKey:(current application’s NSLocaleAlternateQuotationBeginDelimiterKey) –> (NSString) "『" set aDS9 to curLocale’s objectForKey:(current application’s NSLocaleAlternateQuotationEndDelimiterKey) –> (NSString) "』" set aDS10 to curLocale’s objectForKey:(current application’s NSLocaleIdentifier) –> (NSString) "ja_JP" set aDS11 to curLocale’s objectForKey:(current application’s NSLocaleLanguageCode) –> (NSString) "ja" set aDS12 to curLocale’s objectForKey:(current application’s NSLocaleCountryCode) –> (NSString) "JP" set aDS13 to curLocale’s objectForKey:(current application’s NSLocaleScriptCode) –> missing value set aDS14 to curLocale’s objectForKey:(current application’s NSLocaleVariantCode) –> missing value set aDS15 to curLocale’s objectForKey:(current application’s NSLocaleExemplarCharacterSet) –> (__NSCFCharacterSet) <__NSCFCharacterSet: 0x60800124d890> set aDS16 to curLocale’s objectForKey:(current application’s NSLocaleCalendar) –> (_NSCopyOnWriteCalendarWrapper) <_NSCopyOnWriteCalendarWrapper: 0x610000232ca0> set aDS17 to curLocale’s objectForKey:(current application’s NSLocaleCollationIdentifier) –> missing value set aDS18 to curLocale’s objectForKey:(current application’s NSLocaleUsesMetricSystem) –> (NSNumber) 1 set aDS19 to curLocale’s objectForKey:(current application’s NSLocaleMeasurementSystem) –> (NSString) "Metric" |
asoc_現在のLocateのカレンダーの最初の曜日を取得する v2
AppleScript名:asoc_現在のLocateのカレンダーの最初の曜日を取得する v2 |
use AppleScript version "2.4" use scripting additions use framework "Foundation" use bPlus : script "BridgePlus" –https://www.macosxautomation.com/applescript/apps/BridgePlus.htmkl set aCalendar to current application’s NSCalendar’s currentCalendar() set aFirstDay to (aCalendar’s firstWeekday) set c to (current application’s SMSForder’s fordIn:aFirstDay) as integer –> 1 (Sunday Start Calendar) –フランス、香港は月曜日がカレンダーの先頭に来るため結果が異なる –> 2 (Monday Start Calendar) |
asoc_現在のLocaleのカレンダーのTime Zoneを取得する
AppleScript名:asoc_現在のLocaleのカレンダーのTime Zoneを取得する |
use AppleScript version "2.4" use scripting additions use framework "Foundation" set aCalendar to current application’s NSCalendar’s currentCalendar() set aTimeZone to (aCalendar’s timeZone) set tzName to aTimeZone’s |name|() as string –> "Asia/Tokyo" set tDiff to (aTimeZone’s secondsFromGMT()) / 3600 –> 9.0 set aDesc to aTimeZone’s |description|() as string –> "Asia/Tokyo (JST) offset 32400" |
asoc_OSが使用しているtimezoneを取得する
AppleScript名:asoc_OSが使用しているtimezoneを取得する |
use AppleScript version "2.4" use scripting additions use framework "Foundation" set aTZ to current application’s NSTimeZone set sysZone to aTZ’s systemTimeZone() set tzName to sysZone’s |name|() as string –> "Asia/Tokyo" |
asoc_現在のLocaleのTimezoneを取得する
AppleScript名:asoc_現在のLocaleのTimezoneを取得する |
use AppleScript version "2.4" use scripting additions use framework "Foundation" set aTZ to current application’s NSTimeZone set thisZone to aTZ’s localTimeZone() set tzName to thisZone’s |name|() as string –> "Asia/Tokyo" |
TimeZone名を現在のlocaleの言語で返す
AppleScript名:TimeZone名を現在のlocaleの言語で返す |
— Created 2018-01-17 16:57:25 +0900 by Takaaki Naganoya — 2018 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aTZ to current application’s NSTimeZone’s localTimeZone() set tzName to aTZ’s localizedName:(current application’s NSTimeZoneNameStyleStandard) locale:(current application’s NSLocale’s currentLocale()) return tzName as string –> "日本標準時" |
ASOCでスペルチェック
AppleScript名:ASOCでスペルチェック |
— Created 2015-12-09 14:52:51 +0900 by Takaaki Naganoya — 2015 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set aStr to current application’s NSString’s stringWithString:"This is a pen." set aChecker to current application’s NSSpellChecker’s sharedSpellChecker() –’s setLanguage:"en_US") –’s checkSpellingOfString:aStr startingAt:0 aChecker’s setLanguage:"English" aChecker’s checkSpellingOfString:aStr startingAt:0 |
システムスペルチェック辞書への学習と削除
AppleScript名:システムスペルチェック辞書への学習と削除 |
— Created 2017-01-22 by Shane Stanley use AppleScript version "2.4" use framework "Foundation" use framework "AppKit" use scripting additions –http://piyocast.com/as/archives/4635 –スペルチェック辞書への学習 set theWord to "piyomaru" set theChecker to current application’s NSSpellChecker’s sharedSpellChecker() theChecker’s learnWord:theWord set knewIt to theChecker’s hasLearnedWord:theWord –> true –スペルチェック辞書からの削除 theChecker’s unlearnWord:theWord set knowsItNow to theChecker’s hasLearnedWord:theWord return {knewIt, knowsItNow} –> {true, false} |
ロシア語(ru)のシステムスペルチェック辞書を指定して学習
AppleScript名:ロシア語(ru)のシステムスペルチェック辞書を指定して学習 |
— Created 2017-05-12 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use framework "Foundation" use framework "AppKit" use scripting additions –http://piyocast.com/as/archives/4635 set theChecker to current application’s NSSpellChecker’s sharedSpellChecker() set langList to (theChecker’s availableLanguages()) as list –> {"en", "en_GB", "en_CA", "en_IN", "en_SG", "en_AU", "en_JP", "fr", "da", "de", "es", "it", "nl", "nb", "pl", "pt_BR", "pt_PT", "fi", "sv", "tr", "ru", "ko"} set curCheckerLang to (theChecker’s |language|()) as string –> "en_GB" set aWord to "Su-35" theChecker’s setLanguage:"ru" theChecker’s learnWord:aWord set knewIt to theChecker’s hasLearnedWord:aWord –> true set curCheckerLang to (theChecker’s |language|()) as string –> "ru" |
テキストをTTSで読み上げて所要時間を算出 v2.1(CotEditor版)
指定のテキストをTTS(Text To Speech)音声で読み上げ、読み上げ所要時間を計算するAppleScriptです。
実時間をかけて読み上げるのではなく、ファイルに対して音声レンダリングしたデータを書き込む動作をsayコマンドで行うため、読み上げ実時間よりも短い時間で動作を完了します。
読み上げ速度を遅いパターンと速いパターンで個別に音声レンダリングして所要時間のシミュレーションを行ったり、Keynoteのプレゼン資料のすべてのテキスト要素を読み上げ所要時間のシミュレーションを行なって、資料の枚数が多すぎるとか少なすぎるといった判断を行なっています(与えられた時間よりも多い資料を発表することはできないので)。
とくに、プレゼン発表に不慣れな人は発表資料のページを多くしがち&1ページあたりの文字数を多くしがちなので、sayコマンドによる読み上げシミュレーションで「この発表時間に対して要素が多すぎるのでは?」といった話をします。
AppleScript名:テキストをTTSで読み上げて所要時間を算出 v2.1(CotEditor版) |
— Created 2018-01-10 by Takaaki Naganoya — 2018 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AVFoundation" use framework "AppKit" –http://piyocast.com/as/archives/5113 property |NSURL| : a reference to current application’s |NSURL| property NSDate : a reference to current application’s NSDate property NSUUID : a reference to current application’s NSUUID property NSFileManager : a reference to current application’s NSFileManager property AVAudioPlayer : a reference to current application’s AVAudioPlayer property NSDateFormatter : a reference to current application’s NSDateFormatter property NSSpeechSynthesizer : a reference to current application’s NSSpeechSynthesizer set str3 to getEditorText() of me if str3 = false then return set aVoice to "Kyoko" –Check existence of TTS Voice name set vList to retAvailableTTSnames() of me if aVoice is not in vList then error "Wrong TTS Voice Name" set d1 to readTextByTTSVoiceAndReturnDuration(str3, aVoice, 180) of me –aSpeedRate is "Words per minute. 180 to 220" set d2 to readTextByTTSVoiceAndReturnDuration(str3, aVoice, 220) of me set outStr to (formatHMS(d1) of me & "/180 words per minute") & return & (formatHMS(d2) of me & "/220 words per minute") & return tell application "CotEditor" activate write to console outStr end tell on readTextByTTSVoiceAndReturnDuration(aStr as string, aVoice as string, aSpeedRate as integer) set aUUID to NSUUID’s UUID()’s UUIDString() as string –set aPath to (((path to temporary items from user domain) as string) & aUUID & ".aif") set aPath to (((path to desktop) as string) & aUUID & ".aif") set aPOSIX to POSIX path of aPath tell current application say aStr using aVoice saving to (aPOSIX) speaking rate aSpeedRate without waiting until completion end tell repeat 100000 times set aExt to NSFileManager’s defaultManager()’s fileExistsAtPath:aPOSIX if aExt as boolean = true then exit repeat delay "0.001" as real end repeat if aExt = false then error "No Sound file" set aDur to getDuration(aPath as alias) of me try do shell script "rm -f " & quoted form of POSIX path of aPath end try return aDur as real end readTextByTTSVoiceAndReturnDuration on getDuration(aFile) set aURL to |NSURL|’s fileURLWithPath:(POSIX path of aFile) repeat 1000 times set aAudioPlayer to AVAudioPlayer’s alloc()’s initWithContentsOfURL:aURL |error|:(missing value) set aRes to aAudioPlayer’s prepareToPlay() if aRes as boolean = true then exit repeat delay 0.5 end repeat if aRes = false then error "TTS sound output failed" set channelCount to aAudioPlayer’s numberOfChannels() set aDuration to aAudioPlayer’s duration() return aDuration as real end getDuration on retAvailableTTSnames() set outList to {} set aList to NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aInfo to (NSSpeechSynthesizer’s attributesForVoice:j) set aInfoRec to aInfo as record set aName to VoiceName of aInfoRec set the end of outList to aName end repeat return outList end retAvailableTTSnames on formatHMS(aTime) set aDate to NSDate’s dateWithTimeIntervalSince1970:aTime set aFormatter to NSDateFormatter’s alloc()’s init() —This formatter text is localized in Japanese. if aTime < hours then aFormatter’s setDateFormat:"mm分ss秒" else if aTime < days then aFormatter’s setDateFormat:"HH時間mm分ss秒" else aFormatter’s setDateFormat:"DD日HH時間mm分ss秒" end if set timeStr to (aFormatter’s stringFromDate:aDate) as string return timeStr end formatHMS on getEditorText() tell application "CotEditor" if (count every document) = 0 then return false tell front document return contents end tell end tell end getEditorText |
システムにインストールされているTTS VoiceのID一覧を取得する
AppleScript名:システムにインストールされているTTS VoiceのID一覧を取得する |
— Created 2017-03-28 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set vList to current application’s NSSpeechSynthesizer’s availableVoices() as list –> {"com.apple.speech.synthesis.voice.Alex", "com.apple.speech.synthesis.voice.alice", "com.apple.speech.synthesis.voice.allison.premium", "com.apple.speech.synthesis.voice.alva", "com.apple.speech.synthesis.voice.amelie", "com.apple.speech.synthesis.voice.anna.premium", "com.apple.speech.synthesis.voice.audrey.premium", "com.apple.speech.synthesis.voice.ava.premium", "com.apple.speech.synthesis.voice.carmit", "com.apple.speech.synthesis.voice.damayanti", "com.apple.speech.synthesis.voice.daniel.premium", "com.apple.speech.synthesis.voice.diego", "com.apple.speech.synthesis.voice.ellen",……} |
OSにインストールされているTTS Voiceのうち指定言語をサポートするものを返す
AppleScript名:OSにインストールされているTTS Voiceのうち指定言語をサポートするものを返す |
— Created 2017-03-28 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set aLoc to (current application’s NSLocale’s currentLocale()’s identifier()) as string –> "ja_JP" set vList to getTTSVoiceNameWithLanguage(aLoc) of me –> {"Kyoko", "Otoya"} set vIDs to getTTSVoiceIDWithLanguage(aLoc) of me –> {"com.apple.speech.synthesis.voice.kyoko.premium", "com.apple.speech.synthesis.voice.otoya.premium"} set anID to getTTSVoiceIDWithName("Kyoko") of me –> {"com.apple.speech.synthesis.voice.kyoko.premium"} set anAge to getTTSVoiceAgeWithName("Otoya") of me –> 35 on getTTSVoiceNameWithLanguage(voiceLang) set outArray to current application’s NSMutableArray’s arrayWithObject:{} –Make Installed Voice List set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDIc to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDIc) end repeat set aPredicate to current application’s NSPredicate’s predicateWithFormat_("VoiceLocaleIdentifier == %@", voiceLang) set filteredArray to outArray’s filteredArrayUsingPredicate:aPredicate set aResList to (filteredArray’s valueForKey:"VoiceName") as list return aResList end getTTSVoiceNameWithLanguage on getTTSVoiceIDWithLanguage(voiceLang) set outArray to current application’s NSMutableArray’s arrayWithObject:{} set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDIc to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDIc) end repeat set aPredicate to current application’s NSPredicate’s predicateWithFormat_("VoiceLocaleIdentifier == %@", voiceLang) set filteredArray to outArray’s filteredArrayUsingPredicate:aPredicate set aResList to (filteredArray’s valueForKey:"VoiceIdentifier") as list return aResList end getTTSVoiceIDWithLanguage on getTTSVoiceIDWithName(voiceName) set outArray to current application’s NSMutableArray’s arrayWithObject:{} set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDIc to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDIc) end repeat set aPredicate to current application’s NSPredicate’s predicateWithFormat_("VoiceName == %@", voiceName) set filteredArray to outArray’s filteredArrayUsingPredicate:aPredicate set aResList to (filteredArray’s valueForKey:"VoiceIdentifier") as list return aResList end getTTSVoiceIDWithName on getTTSVoiceAgeWithName(voiceName) set outArray to current application’s NSMutableArray’s arrayWithObject:{} set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDIc to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDIc) end repeat set aPredicate to current application’s NSPredicate’s predicateWithFormat_("VoiceName == %@", voiceName) set filteredArray to outArray’s filteredArrayUsingPredicate:aPredicate set aResList to (filteredArray’s valueForKey:"VoiceAge") as list set anItem to first item of aResList if anItem = missing value then return 0 return anItem as integer end getTTSVoiceAgeWithName |
TTS Voiceを言語と性別で抽出
AppleScript名:TTS Voiceを言語と性別で抽出 |
— Created 2017-03-28 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set aLoc to (current application’s NSLocale’s currentLocale()’s identifier()) as string –> "ja_JP" set vList to getTTSVoiceNameWithLanguageAndGender(aLoc, "Male") of me –> {"Otoya"} set vList to getTTSVoiceNameWithLanguageAndGender(aLoc, "Female") of me –> {"Kyoko"} set vList to getTTSVoiceNameWithLanguageAndGender("en_US", "Male") of me –> {"Alex", "Bruce", "Fred", "Junior", "Ralph", "Tom"} on getTTSVoiceNameWithLanguageAndGender(voiceLang, aGen) if aGen = "Male" then set aGender to "VoiceGenderMale" else if aGen = "Female" then set aGender to "VoiceGenderFemale" end if set outArray to current application’s NSMutableArray’s new() set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDIc to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDIc) end repeat set aPredicate to current application’s NSPredicate’s predicateWithFormat_("VoiceLocaleIdentifier == %@ && VoiceGender== %@", voiceLang, aGender) set filteredArray to outArray’s filteredArrayUsingPredicate:aPredicate set aResList to (filteredArray’s valueForKey:"VoiceName") as list return aResList end getTTSVoiceNameWithLanguageAndGender |
すべてのTTS VoiceからLocale情報を抽出し、指定LocaleのTTS Voice名を取得
AppleScript名:すべてのTTS VoiceからLocale情報を抽出し、指定LocaleのTTS Voice名を取得 |
— Created 2015-08-25 by Takaaki Naganoya — Modified 2015-08-26 by Shane Stanley, Takaaki Naganoya — 2015 Piyomaru Software use AppleScript version "2.5" use scripting additions use framework "Foundation" use framework "AppKit" –すべてのTTS VoiceからIdentifier情報を抽出してユニーク化 set v1Res to getLocaleICodeFromTTSVoices() set vRes to choose from list v1Res with prompt "Select Locale" set v2Res to getTTSVoiceNameWithLanguage(first item of vRes) of me on getLocaleICodeFromTTSVoices() set aResList to getAttributeFromTTSVoices("VoiceLocaleIdentifier") of me return aResList as list end getLocaleICodeFromTTSVoices on getAttributeFromTTSVoices(anAttribute) set outArray to current application’s NSMutableArray’s new() set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDict to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDict) end repeat set aResArray to (outArray’s valueForKey:anAttribute) set aSet to current application’s NSMutableSet’s setWithArray:aResArray set aResList to aSet’s allObjects() return aResList as list end getAttributeFromTTSVoices on getTTSVoiceNameWithLanguage(voiceLang) set outArray to current application’s NSMutableArray’s new() set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDIc to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDIc) end repeat set aPredicate to current application’s NSPredicate’s predicateWithFormat_("VoiceLocaleIdentifier == %@", voiceLang) set filteredArray to outArray’s filteredArrayUsingPredicate:aPredicate set aResList to (filteredArray’s valueForKey:"VoiceName") as list return aResList end getTTSVoiceNameWithLanguage |
すべてのTTS VoiceからLanguage情報を抽出してユニーク化
AppleScript名:すべてのTTS VoiceからLanguage情報を抽出してユニーク化 |
— Created 2015-08-25 by Takaaki Naganoya — Modified 2015-08-26 by Shane Stanley, Takaaki Naganoya — 2015 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set v1Res to getLocaleICodeFromTTSVoices() –> {"fr_FR", "zh_TW", "it_IT", "en_ZA", "es_AR", "ko_KR", "ro_RO", "en_IN", "fr_CA", "hi_IN", "da_DK", "en-scotland", "pt_BR", "zh_CN", "sv_SE", "es_ES", "ar_SA", "hu_HU", "en_GB", "ja_JP", "fi_FI", "zh_HK", "tr_TR", "nb_NO", "pl_PL", "id_ID", "cs_CZ", "el_GR", "he_IL", "ru_RU", "de_DE", "en_AU", "nl_BE", "pt_PT", "th_TH", "sk_SK", "en_US", "en_IE", "nl_NL", "es_MX"} set v2Res to getLanguageCodeFromTTSVoices() –> {"nl-NL", "id", "fr-FR", "it-IT", "es-419", "ko-KR", "ro-RO", "fr-CA", "hi-IN", "da-DK", "pt-BR", "sv-SE", "es-ES", "hu-HU", "en-GB", "ja-JP", "fi-FI", "tr-TR", "ar", "nb-NO", "pl-PL", "cs-CZ", "el-GR", "he-IL", "ru-RU", "zh-Hans", "de-DE", "en-AU", "zh-Hant", "nl-BE", "pt-PT", "th-TH", "sk-SK", "en-US", "en-IE"} on getLanguageCodeFromTTSVoices() set aResList to getAttributeFromTTSVoices("VoiceLanguage") of me return aResList as list end getLanguageCodeFromTTSVoices on getLocaleICodeFromTTSVoices() set aResList to getAttributeFromTTSVoices("VoiceLocaleIdentifier") of me return aResList as list end getLocaleICodeFromTTSVoices on getAttributeFromTTSVoices(anAttribute) set outArray to current application’s NSMutableArray’s new() set aList to current application’s NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aDict to (current application’s NSSpeechSynthesizer’s attributesForVoice:j) (outArray’s addObject:aDict) end repeat set aResArray to (outArray’s valueForKey:anAttribute) set aSet to current application’s NSMutableSet’s setWithArray:aResArray set aResList to aSet’s allObjects() return aResList as list end getAttributeFromTTSVoices |
TTS Voice名一覧を取得
AppleScript名:TTS Voice名一覧を取得 |
use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" property NSSpeechSynthesizer : a reference to current application’s NSSpeechSynthesizer set vList to retAvailableTTSnames() of me –> {"Agnes", "Albert", "Alex", "Alice", "Allison", "Alva", "Amelie", "Anna", "Audrey", "Ava", "Bad News", "Bahh", "Bells", "Boing", "Bruce", "Bubbles", "Carmit", "Cellos", "Damayanti", "Daniel", "Deranged", "Diego", "Ellen", "Emily", "Fiona", "Fred", "Good News", "Hysterical", "Ioana", "Jill", "Joana", "Jorge", "Juan", "Junior", "Kanya", "Karen", "Kate", "Kathy", "Kyoko", "Laura", "Lee", "Lekha", "Luca", "Luciana", "Maged", "Mariska", "Mei-Jia", "Melina", "Milena", "Moira", "Monica", "Nora", "Otoya", "Paulina", "Pipe Organ", "Princess", "Ralph", "Samantha", "Sara", "Satu", "Serena", "Sin-ji", "Tessa", "Thomas", "Ting-Ting", "Tom", "Trinoids", "Veena", "Vicki", "Victoria", "Whisper", "Xander", "Yelda", "Yuna", "Yuri", "Zarvox", "Zosia", "Zuzana"} on retAvailableTTSnames() set outList to {} set aList to NSSpeechSynthesizer’s availableVoices() set bList to aList as list repeat with i in bList set j to contents of i set aInfo to (NSSpeechSynthesizer’s attributesForVoice:j) set aInfoRec to aInfo as record set aName to VoiceName of aInfoRec set the end of outList to aName end repeat return outList end retAvailableTTSnames |
InputManagerのじっけん
–> InputManager.framework (To ~/Library/Frameworks)
AppleScript名:InputManagerのじっけん |
— Created 2017-01-22 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "InputManager" set cList to current application’s CSInputSource’s all() –> (NSArray) {(CSInputSource) <CSInputSource: 0x60000000d310>, (CSInputSource) <CSInputSource: 0x60000000f580>, (CSInputSource) <CSInputSource: 0x60000000bd30>, (CSInputSource) <CSInputSource: 0x600000216d20>, (CSInputSource) <CSInputSource: 0x6000002168d0>, (CSInputSource) <CSInputSource: 0x600000216c50>, (CSInputSource) <CSInputSource: 0x600000012620>, (CSInputSource) <CSInputSource: 0x60000000b010>, (CSInputSource) <CSInputSource: 0x600000217010>} set dList to (cList’s valueForKey:"localizedName") as list –> {"ひらがな", "英字", "カタカナ", "日本語", "かなパレット", "com.apple.PressAndHold", "絵文字と記号", "キーボードビューア", "EmojiFunctionRowIM_Extension"} set c1 to (current application’s CSInputSource’s currentKeyboard()’s localizedName()) as string –> "ひらがな" –> "英字" set c2 to (current application’s CSInputSource’s currentKeyboardLayout()’s localizedName()) as string –> "U.S." set err1 to (current application’s CSInputSource’s forLanguage:"ja")’s |select|() log err1 set err2 to (current application’s CSInputSource’s forLanguage:"en_US")’s |select|() log err2 |
IMのメニュー表示名を取得する
AppleScript名:IMのメニュー表示名を取得する |
— Created 2017-01-22 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "InputManager" –https://github.com/jensnockert/input-manager set cList to (current application’s CSInputSource’s all()’s valueForKey:"localizedName") as list –> {"ひらがな", "英字", "カタカナ", "日本語", "かなパレット", "com.apple.PressAndHold", "絵文字と記号", "キーボードビューア", "EmojiFunctionRowIM_Extension"} |