Sample code for 30+ languages & platforms
AutoIt Requires Chilkat v11.7.0+

QR Codes for Email, Phone, SMS and Location

See more QR Code Examples

Demonstrates QR codes that start an action on a phone. A QR code only holds text, and what happens on scanning depends on the form of that text: mailto: starts an email, tel: dials a number, SMSTO: starts a text message, and geo: opens a map at a latitude and longitude. A web address opens in the browser.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  This example requires the Chilkat API to have been previously unlocked.
;  See Global Unlock Sample for sample code.

$oFmt = ObjCreate("Chilkat.Formats")
$oJson = ObjCreate("Chilkat.JsonObject")
$oJsonOut = ObjCreate("Chilkat.JsonObject")
$oJson.UpdateInt("render.moduleSize",6)
$oJson.UpdateBool("output.overwrite",True)
$oJson.UpdateString("output.return","none")

;  An email, with the address and optionally a subject.  Spaces in the subject are written %20.
$oJson.UpdateString("payload.text","mailto:support@example.com?subject=Order%2012345")
$oJson.UpdateString("output.path","qa_output/qr_email.png")
$bSuccess = $oFmt.QrCode("generate",$oJson,$oJsonOut)
If ($bSuccess = False) Then
    ConsoleWrite($oFmt.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("email: version " & $oJsonOut.IntOf("symbols[0].selectedEncoding.version") & ", " & $oJsonOut.StringOf("outputs[0].path") & @CRLF)

;  image

;  A phone number to dial, in international form.
$oJson.UpdateString("payload.text","tel:+15555550100")
$oJson.UpdateString("output.path","qa_output/qr_phone.png")
$bSuccess = $oFmt.QrCode("generate",$oJson,$oJsonOut)
If ($bSuccess = False) Then
    ConsoleWrite($oFmt.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("phone: version " & $oJsonOut.IntOf("symbols[0].selectedEncoding.version") & ", " & $oJsonOut.StringOf("outputs[0].path") & @CRLF)

;  image

;  A text message: the number, then the message.
$oJson.UpdateString("payload.text","SMSTO:+15555550100:Please call me back")
$oJson.UpdateString("output.path","qa_output/qr_sms.png")
$bSuccess = $oFmt.QrCode("generate",$oJson,$oJsonOut)
If ($bSuccess = False) Then
    ConsoleWrite($oFmt.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("sms: version " & $oJsonOut.IntOf("symbols[0].selectedEncoding.version") & ", " & $oJsonOut.StringOf("outputs[0].path") & @CRLF)

;  image

;  A location: latitude, then longitude, in degrees.
$oJson.UpdateString("payload.text","geo:41.8781,-87.6298")
$oJson.UpdateString("output.path","qa_output/qr_location.png")
$bSuccess = $oFmt.QrCode("generate",$oJson,$oJsonOut)
If ($bSuccess = False) Then
    ConsoleWrite($oFmt.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("location: version " & $oJsonOut.IntOf("symbols[0].selectedEncoding.version") & ", " & $oJsonOut.StringOf("outputs[0].path") & @CRLF)

;  image

;  Sample output:

;  email: version 4, qa_output/qr_email.png
;  phone: version 2, qa_output/qr_phone.png
;  sms: version 3, qa_output/qr_sms.png
;  location: version 2, qa_output/qr_location.png