I'm unable to reproduce the errors you encountered. For testing, I typically use the following procedure.
#^w:: MsgBox % OCR("Untitled - Notepad")to the script and run it.
2) Open a new notepad window.
3) Type some things in the notepad window and press #^w.
The text in notepad should be equal to what the MsgBox displays.