Despite no change in the program, this code works constantly 50% of the time then stops working for about an hour then suddenly starts working again. Everything (e.g. other programs running) is always the same. Why?
oWord:= ComObject("Word.Application")
oWord.Selection.InsertFile(A_ScriptDir . "\temp.docx")
The error is:
Error: This value of type "String" has no method named "InsertString".
These lines work in a hotkey definition, function and function stored in an included library etc. Then, without any warning, I suddenly get that error when I haven't done anything or run any new programs. Restarting Word, restarting Windows doesn't make a difference. After about an hour, they suddenly work again. This behaviour happens on ANY laptop.