【QR】アドレス帳登録用のQRコードを作る(Google Chart利用)
こんな感じのQRコードを作成します。
(*
chart.googleapis.com.scpt
アドレス帳登録用のQRコードを生成します。
たぶんiOS専用
20190706 初回作成
APIの仕様は
https://developers.google.com/chart/infographics/docs/qr_codes
*)
----設定項目
set theNa to "林檎" as text ---姓
set theNb to "太郎" as text ---名
set theOrg to "アップルコンピュータ" as text ---会社名
set theMailWork to "work@hoge.com" as text ---メール会社
set theMailHome to "home@hoge.com" as text ---メール自宅
set theTelWork to "0123-456-7890" as text ---電話会社
set theTelCell to "000-000-00000" as text --- 電話携帯
set theTelInt to "1234" as text ---内線
----設定ここまで
--姓名表示をを整形 半角スペース区切り
set theFN to (theNa & " " & theNb) as text
----Vカードデータを整形 改行コードはMac
set theChl to "BEGIN:VCARD\rVERSION:3.0\rN:" & theNa & ";" & theNb & ";;;\rFN:" & theFN & "\rORG:" & theOrg & ";\rEMAIL;type=INTERNET;type=WORK;type=pref:" & theMailWork & "\rEMAIL;type=INTERNET;type=HOME:" & theMailHome & "\rTEL;type=WORK;type=pref:" & theTelWork & "\rTEL;type=CELL:" & theTelCell & "\ritem1.TEL:" & theTelInt & "\ritem1.X-ABLabel:内線\rEND:VCARD" as text
----URLエンコード
set theChl to my encodeURL(theChl)
--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
-----サファリで開く
tell application "Safari"
activate
make new document with properties {name:"QR-CODE by Google API"}
tell window 1
open location theOpenUrl
end tell
end tell
---URLエンコードのサブルーチン
on encodeURL(str)
set scpt to "php -r 'echo urlencode(\"" & str & "\");'"
return do shell script scpt
end encodeURL
| 固定リンク
「Barcode2D」カテゴリの記事
- [LINE]QRコード各種(2023.08.29)
- 【QR】イベント・カレンダー登録用のQRコードを作る(Google Chart利用)(2022.01.06)
- 【QR】アドレス帳登録用のQRコードを作る(Google Chart利用)(2021.12.06)
- [Wifi]Wifiアクセスポイント用のmobileconfigを作成する(2021.11.02)
- [AppleScripts]WIFIバーコードを作成(データマトリックス)(2021.08.29)



[RSS]