« 【QR】イベント・カレンダー登録用のQRコードを作る(Google Chart利用) | トップページ | girl next door »

【QR】マップ用のQRコードを作る(Google Chart利用)

マップ用のリンクは
ブラウザ閲覧用→これは正解が見つからなかった
GoogleMap用

 

5737

 

AppleMap用 の振り分け

 

225737

 

GoogleMap用
https://www.google.com/maps/@Latitude,Longitude,range
→この方式を選択
↓この方法でも良かったかな…
https://www.google.com/maps/search/?api=1&query=Latitude,Longitude

 

 

AppleMap用は
GEO:Latitude,Longitude ←これはiOS専用かね?

 

そして汎用として
http://maps.apple.com/?q=Latitude,Longitude

iOS以外のデバイスでアクセスするとGoogleMapに転送されるので両刀使いでお勧め

 


 

(*

Geo2Qr4Chrome.scpt
Chromeで開いているページのQRを作成します。
たぶんiOS専用 

20190715 初回作成

APIの仕様は
https://developers.google.com/chart/infographics/docs/qr_codes


*)

tell application "Google Chrome"
activate
tell window 1
tell active tab
set theURL to URL as text
end tell
end tell
end tell

tell application "Finder"
activate
set objAns to ¬
display alert ¬
"どちら用のQRコードを作成しますか?" message ¬
"iOSAppleMapQRコードを作成する OR 一般的なQRコードを作成する" default button 1 ¬
buttons {"AppleMap", "GoogleMap", "汎用"}
end tell


set AppleScript's text item delimiters to {"/"}
set listUrl to every text item of theURL as list
set numCntUrl to (count of listUrl) as number
set numSepUrl to 1 as number
set AppleScript's text item delimiters to {""}
log numCntUrl

repeat numCntUrl times
set theSepUrl to (item numSepUrl of listUrl) as text
try
set theUrlParts to (the character 1 of theSepUrl)
on error
set theUrlParts to " "
end try


if theUrlParts is "@" then
set theGooglemapParts to theSepUrl
set theSepUrl to doReplace(theSepUrl, "@", "")
set AppleScript's text item delimiters to {","}
set listSepUrl to every text item of theSepUrl as list
set theLatitude to (item 1 of listSepUrl) as text
set theLongitude to (item 2 of listSepUrl) as text
set AppleScript's text item delimiters to {""}
end if
set numSepUrl to numSepUrl + 1 as number
end repeat


if (button returned of objAns) is "AppleMap" then
set theChl to ("GEO:" & theLatitude & "," & theLongitude & "") as text
log theChl
else if (button returned of objAns) is "GoogleMap" then
set theChl to ("https://www.google.com/maps/" & theGooglemapParts & "") as text
else
set theChl to ("http://maps.apple.com/?q=" & theLatitude & "," & theLongitude & "") as text
end if


--API各項目
--BASE URL
set theApiUrl to "https://chart.googleapis.com/chart?" as text

set theCht to "qr" as text

set theChs to "540x540" as text

set theChoe to "UTF-8" as text

---L M Q R
set theChld to "Q" as text

--URLを整形
set theOpenUrl to ("" & theApiUrl & "&cht=" & theCht & "&chs=" & theChs & "&choe=" & theChoe & "&chld=" & theChld & "&chl=" & theChl & "") as text


-----Chromeで開く
tell application "Google Chrome"
activate
tell window 1
set active tab index to 1
make new tab
tell active tab
set URL to theOpenUrl
end tell
end tell
end tell







to doReplace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end doReplace

 

 

ダウンロード - geo2qr4chrome.scpt.zip

 

|

« 【QR】イベント・カレンダー登録用のQRコードを作る(Google Chart利用) | トップページ | girl next door »

Barcode2D」カテゴリの記事