https://www.autohotkey.com/boards/viewtopic.php?f=76&t=66595
While figuring that out, I found another problem I needed to get over, I needed to be able to target a specific document within the active Word windows, after a lot after a lot of research and tests, I finally found a solution that is somehow similar to how you target specific Sheets in Excel, which is like this:
Code: Select all
sheet5_cellA5_value := oExcel.Application.Sheets("Sheet5").Range("A5").Value ; Target sheet is "Sheet5"
Code: Select all
oWord := ComObjActive("Word.Application") ; Object for Word
oWord.Documents("Document2.docx").ActiveWindow.Selection.TypeText("HI") ; Target document "Document2" and execute the command"TypeText" with the text "Hi"
Couple of notes:
- The document have to be saved in the computer, I test it without saving it and then it didn't worked, when I save it (anywhere on the PC), it worked
- The document must be opened in a window. If the document isn't opened in a window you won't be able to do any action
- It doesn't matter if the target document is minimized
I hope this is useful to you, thanks!