myDebt := 9000 index := RegExMatch("You owe me $42", "\$(\d+)", dollars) if(index > 0) { ; indices are usually 1-based in AHK myDebt += dollars1 MsgBox, Current debt: %myDebt% }
Result:
Current debt: 9042