[current date] NARROW NO-BREAK SPACEの置換
解説はこちら
【スクリプトエディタで開く】 |
NARROW NO-BREAK SPACEの置換.scpt.scpt | ソース |
|---|
| 001 | #!/usr/bin/env osascript |
| 002 | #coding: utf-8 |
| 003 | ----+----1----+----2----+----3----+----4----+----5----+----6----+----7-- |
| 004 | (* |
| 005 |
|
| 006 | 1:アプリケーションのメニューが『英語』で |
| 007 | 2:時刻表示が午前午後の12時間表記の場合 |
| 008 |
|
| 009 | "Monday, May 18, 2026 at 10:38:29 PM" |
| 010 | この戻り値で |
| 011 | PMの前ののスペースが『NARROW NO-BREAK SPACE』になっている |
| 012 |
|
| 013 | SPACE |
| 014 | U+0020 |
| 015 | character id 32 |
| 016 |
|
| 017 | NARROW NO-BREAK SPACE |
| 018 | U+202F |
| 019 | character id 8239 |
| 020 |
|
| 021 |
|
| 022 | com.cocolog-nifty.quicktimer.icefloe *) |
| 023 | ----+----1----+----2----+----3----+----4----+----5----+----6----+----7-- |
| 024 | use AppleScript version "2.8" |
| 025 | use scripting additions |
| 026 |
|
| 027 | #日付の『NARROW NO-BREAK SPACE』をスペースに置換する |
| 028 | set strDate to (current date) as text |
| 029 |
|
| 030 | #NARROW NO-BREAK SPACE U+202F |
| 031 | set strNarrowNoBreakSpace to (character id 8239) as string |
| 032 | #SPACE U+0020 |
| 033 | set strSpace to (character id 32) as string |
| 034 | #区切り文字でリストにして |
| 035 | set strDelim to AppleScript's text item delimiters |
| 036 | set AppleScript's text item delimiters to strNarrowNoBreakSpace |
| 037 | set listDate to every text item of strDate |
| 038 | #スペースで置換 |
| 039 | set AppleScript's text item delimiters to strSpace |
| 040 | set strDate to listDate as text |
| 041 | set AppleScript's text item delimiters to strDelim |
| 042 |
|
| 043 | return strDate |
| AppleScriptで生成しました |
|---|