Using A 2D Barcode Scanner

Using A 2D Barcode Scanner

Using a 2D barcode scanner to scan QR codes on intake labels would typically just "type" the admin page URL for that specific booking. Some scanners allow manual programming, but if not, there is a way around it. We can use AutoHotKey scripts to "listen" for a URL and then launch it in a new process, which will open the page in a new browser tab using your default browser.

Step 1: Download AutoHotKey 2.0 at https://www.autohotkey.com/download/ahk-v2.exe

Step 2: Install AutoHotKey 2.0 and launch the application

Step 3: Click "New Script" and create a new AHK script.

Step 4: Edit the newly created AHK script using Notepad and paste the following code inside:

#Requires AutoHotkey v2.0
#SingleInstance Force

; This script bypasses the 40-character hotstring limit.
; It watches every keystroke for the "trigger" sequence.

ih := InputHook("V") ; "V" means visible (it won't block the scanner from typing)
ih.OnChar := CheckURL
ih.Start()

CheckURL(ih, char) {
    static buffer := ""
    static target := "https://mydomain.com/public/admin/bookings/"
    
    buffer .= char
    
    ; Keep the buffer size manageable (only store the last 50 chars)
    if (StrLen(buffer) > 50)
        buffer := SubStr(buffer, -50)
    
    ; Check if the end of our buffer matches our target URL
    if (SubStr(buffer, -StrLen(target)) = target) {
        ; We found the trigger! Now we wait for the ID and the "Enter" key
        buffer := "" ; Reset buffer
        CaptureID()
    }
}

CaptureID() {
    ; This part waits for the scanner to finish typing the ID (e.g., "30/edit")
    ; and stops when it hits the "Enter" key (the scan suffix).
    idHook := InputHook("L20 T2", "{Enter}")
    idHook.Start()
    idHook.Wait()
    
    fullURL := "https://mydomain.com/public/admin/bookings/" . idHook.Input
    
    ; Optional: Visual feedback
    ToolTip("Opening Booking: " . idHook.Input)
    SetTimer () => ToolTip(), -3000
    
    Run(fullURL)
}

Step 5: Be sure to edit the following inside the code with your own URL:

static target := "https://mydomain.com/public/admin/bookings/"
fullURL := "https://mydomain.com/public/admin/bookings/" . idHook.Input

Step 6: Save and close the AHK file

Step 7: Launch the AHK script by double clicking it