Thank You!
- Downloaded both files from DropBox.
- Found a test script, which I modified.
Code: Select all
#SingleInstance, Force
SetBatchLines, -1
#Include %A_ScriptDir%/BARCODER.ahk
#Include %A_ScriptDir%/GDIP_All.ahk
START:
inputbox, Test,, Type in a message and a corresponding QR-CODE image will be generated and saved in the scripts directory.
MATRIX_TO_PRINT := GENERATE_QR_CODE(test)
if (MATRIX_TO_PRINT = 1)
{
Goto START
}
; Start gdi+
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
pBitmap := Gdip_CreateBitmap(MATRIX_TO_PRINT.1.MaxIndex(), MATRIX_TO_PRINT.MaxIndex())
G := Gdip_GraphicsFromImage(pBitmap)
Gdip_SetSmoothingMode(pBitmap, 3)
pBrush := Gdip_BrushCreateSolid(0xFFFFFFFF)
Gdip_FillRectangle(G, pBrush, 0, 0, MATRIX_TO_PRINT.1.MaxIndex(), MATRIX_TO_PRINT.MaxIndex())
Gdip_DeleteBrush(pBrush)
Loop % MATRIX_TO_PRINT.MaxIndex()
{
CURRENT_ROW := A_Index-1
CURRENT_ROW_DATA := MATRIX_TO_PRINT[A_Index]
Loop % CURRENT_ROW_DATA.MaxIndex()
If (CURRENT_ROW_DATA[A_Index] = 1)
Gdip_SetPixel(pBitmap, A_Index-1, CURRENT_ROW, 0xFF000000)
}
CURRENT_ROW := "", CURRENT_COLUMN := ""
StringReplace, FILE_NAME_TO_USE, test, `" ; We can't use all the characters that byte mode can encode in the name of the file. So we are replacing them here (if they exist).
FILE_PATH_AND_NAME := A_ScriptDir . "\" . SubStr(RegExReplace(FILE_NAME_TO_USE, "/w+"), 1, 20) . ".png" ; Same as above.
Gdip_SaveBitmapToFile(pBitmap, FILE_PATH_AND_NAME)
Gdip_DisposeImage(pBitmap)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)
msgbox, 0, Success, QR-CODE image succesfully created!
Goto START
Return
I received the following message
(The question of what text to convert to QR code never came up)
Error: Call to nonexistent function.
Specifically: GENERATE_QR_CODE(test)
Line#
2707: VarSetCapacity(String, char_count * 2)
2708: char_count := DllCall("MultiByteToWideChar", "uint", Encoding, "uint", 0, "uint", Address, "int", Length, "uint", &String, "int", char_count * 2)
2709: String := StrGetB(&String, char_count, 1200)
2710: }
2712: Return,String
2713: }
008: InputBox,Test,,Type in a message and a corresponding QR-CODE image will be generated and saved in the scripts directory.
---> 010: MATRIX_TO_PRINT := GENERATE_QR_CODE(test)
012: if (MATRIX_TO_PRINT = 1)
013: {
014: Goto,START
015: }
018: if !pToken := Gdip_Startup()
019: {
020: MsgBox,48,gdiplus error!,Gdiplus failed to start. Please ensure you have gdiplus on your system
The program will exit.
(Your QR code works to scan.)