; กด F8 เพื่อเริ่มการทำงาน
F8:: {
    try {
        ; เชื่อมต่อกับ Excel ที่เปิดค้างไว้
        xl := ComObjectActive("Excel.Application")
    } catch {
        MsgBox "กรุณาเปิดไฟล์ Excel ก่อนเริ่มใช้งานเด้อครับ", "บ่พ้อไฟล์"
        return
    }

    row := 2 ; เริ่มที่แถว 2

    Loop {
        TestCode    := xl.Range("A" . row).Text
        TestName    := xl.Range("B" . row).Text
        HISCode     := xl.Range("C" . row).Text
        CheckupCode := xl.Range("D" . row).Text

        if (TestCode = "") {
            MsgBox "กรอกข้อมูลเสร็จเรียบร้อยแล้วครับอ้าย!", "สำเร็จ"
            break
        }

        ; --- กรอกข้อมูลใน i-LINK ---
        SendText TestCode
        Send "{Tab}"
        Sleep 200

        SendText TestName
        Send "{Tab}"
        Sleep 200

        SendText HISCode
        Send "{Tab}"
        Sleep 200

        SendText CheckupCode
        Sleep 200

        ; กดปุ่ม SAVE หรือ F2 แล้ว Enter
        Send "{F2}"
        Sleep 100
        Send "{Enter}"
        Sleep 500

        row++
    }
}

; กด Esc เพื่อหยุดสคริปต์ทันที
Esc::ExitApp()

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: