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 |
More from my site
(Visited 75 times, 1 visits today)