on run tell application "GPSy 3.20r2 (Fat)" activate copy ヌclass pLatネ to GPSLat copy ヌclass pLonネ to GPSLon copy ヌclass pSpdネ to GPSVel copy ヌclass pTrkネ to GPSHead copy ヌclass pUTCネ to GPSSec end tell --時刻 set AMPM to {"午前", "午後"} set GPSDate to (date "Monday, February 6, 2040 6:28:16 AM") + GPSSec + 32400 --"2040 2 6 6:28:16"は"1904 1 1 0:0:0"から2^32=4294967296秒後 --32400秒=9時間 --日本時間 set GPSTime to time of GPSDate set TimeStr to item ((GPSTime div 43200) + 1) of AMPM & "。" & (GPSTime div 3600) mod 12 & "時" & (GPSTime div 60) mod 60 & "分" --& GPSTime mod 60 & "秒" --display dialog TimeStr as string default answer ((current date) - GPSDate) as string buttons "OK" default button 1 with icon note if GPSVel < 2 then --緯度経度 set WGSLat to GPSLat * 3600 set WGSLon to GPSLon * 3600 set DLat to 1.06958758E-4 * WGSLat - 1.74669288E-5 * WGSLon - 16.5671618 set DLon to 4.60470542E-5 * WGSLat + 8.30490355E-5 * WGSLon - 36.1476919 set GPSLat to S2DMS(WGSLat + DLat) set GPSLon to S2DMS(WGSLon + DLon) set PosStr to "北緯、" & item 1 of GPSLat & "度、" & item 2 of GPSLat & "分、" & item 3 of GPSLat & "秒。 東経、" & item 1 of GPSLon & "度、" & item 2 of GPSLon & "分、" & item 3 of GPSLon & "秒" --display dialog PosStr as string buttons "OK" default button 1 with icon note set theStr to "ただ今の時刻は、" & TimeStr & "。現在位置は、" & PosStr & "です。" else --方位 set DirWords to {"北", "北北東", "北東", "東北東", "東", "東南東", "南東", "南南東", "南", "南南西", "南西", "西南西", "西", "西北西", "北西", "北北西"} set DirStr to item ((round (GPSHead * 16 / 360)) mod 16 + 1) of DirWords --display dialog DirStr & ":" & GPSHead & "°" as string buttons "OK" default button 1 with icon note --速度 set VelStr to "時速、" & (round (GPSVel)) & "キロ" if GPSVel < 80 then set CauStr to "" else if GPSVel < 120 then set CauStr to "ちょっと、スピードが速いです。" else if GPSVel < 160 then set volume 7 set CauStr to "スピード出し過ぎです。" else set volume 7 set CauStr to "まもなく地獄の一丁目です。" end if set theStr to "ただ今の時刻は、" & TimeStr & "。" & DirStr & "へ、" & VelStr & "で進行中。" & CauStr end if tell application "GPSy 3.20r2 (Fat)" to ヌevent aevtSPEAネ theStr given ヌclass VOICネ:"ひろし" end run on S2DMS(s) set sf to round (s * 10) set s to (sf div 10) mod 60 set m to (sf div 600) mod 60 set d to sf div 36000 set sf to sf mod 10 set s to s & "." & sf as string return {d, m, s} end S2DMS