AutoIt Requires Chilkat v11.7.0+
AutoIt
Generate a QR Code with the Barcode Method
See more QR Code Examples
Demonstrates the Barcode method, which is the general form of QrCode: the request names the symbology, and everything else is the same. QrCode is Barcode with the symbology already set to qr, and identical requests to the two methods give identical results. A program that will produce more than one kind of barcode can use Barcode for all of them.Chilkat AutoIt Downloads
Local $bSuccess = False
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.UpdateString("symbology","qr")
$oJson.UpdateString("payload.text","https://www.chilkatsoft.com/")
$oJson.UpdateString("output.path","qa_output/qr_from_barcode.png")
$oJson.UpdateBool("output.overwrite",True)
$oJson.UpdateString("output.return","none")
$oFmt = ObjCreate("Chilkat.Formats")
$oJsonOut = ObjCreate("Chilkat.JsonObject")
$bSuccess = $oFmt.Barcode("generate",$oJson,$oJsonOut)
If ($bSuccess = False) Then
ConsoleWrite($oFmt.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("symbology: " & $oJsonOut.StringOf("symbols[0].symbology") & @CRLF)
ConsoleWrite("QR version: " & $oJsonOut.IntOf("symbols[0].selectedEncoding.version") & @CRLF)
ConsoleWrite("image: " & $oJsonOut.IntOf("outputs[0].width") & " x " & $oJsonOut.IntOf("outputs[0].height") & " pixels" & @CRLF)
; The image written to qa_output/qr_from_barcode.png:
;
; Barcode requires the symbology. QrCode does not.
$oJson2 = ObjCreate("Chilkat.JsonObject")
$oJson2.UpdateString("payload.text","https://www.chilkatsoft.com/")
$bSuccess = $oFmt.Barcode("generate",$oJson2,$oJsonOut)
If ($bSuccess = False) Then
ConsoleWrite("without a symbology: " & $oJsonOut.StringOf("errors[0].code") & " at " & $oJsonOut.StringOf("errors[0].path") & @CRLF)
EndIf
; Sample output:
; symbology: qr
; QR version: 3
; image: 148 x 148 pixels
; without a symbology: missingOption at /symbology