here's a way to provide a little debugging help, not the most elegant way, but form an opinion about it on your own.
1) define a hotkey at the beginning of your script:
HotKey, !a, debug
2) code the "gosub"-label for that hotkey
3) After each line of your script (or after each line or block you regard as important!) code the following:
StringReplace, data, data, `r, , ReplaceAll ; this is a sample line of your script
myLine = StringReplace, data, data, `r, , ReplaceAll ; store the current line of your script
myLineNumber = 221 ; store the line number of "StringReplace, ..."
This inserting job could be done by a special script. I had one, but can't find it now, but that's not that miracle. It blows your script up to its triple size. These debugging lines should be removed (when everythins's fine) by another script.
Now start your script and when you hit Alt-A , the last values of myLine and myLineNumber will be shown.
Hope I could help,