Thanks, erictheturtle, for your works.
The first one, of course, Ws4Ahk.
The second one, your work on my question. Your aswer is very instructive.
I made, too, some trys.
After a certain number of trys, the syntax
Code:
GetObject([pathname] [, class])
is effectively not supported by Ws4Ahk, but this one
Code:
GetObject([pathname])
yes (I made many trys...).
My results :
With the syntax :
Code:
myDoc := "D:\Try.doc"
ppWord := WS_Eval(pWord, "GetObject(%s)", myDoc)
or
ppWord := WS_Eval(pWord, "GetObject(%s)", VBStr(myDoc))
I had no success.
With the syntax :
Code:
myDoc := "D:\Try.doc"
ppWord := WS_Eval(pWord, "GetObject(" . VBStr(myDoc) . ")")
, if Word is launched and it has the file loaded in it, success...
But, surprise, if Word is launched but empty or when Word is not launched at all, the result is ... success !!! If Word is empty, the file isn't loaded in it...
So GetObject seems to try to launch the file in Word but seems to not do it... Strange...
If I try with a doc file with macros in it, I have the window to choose to activate them or not. When I go to Word to see if the file is loaded, I don't see anything... Is it loaded in invisibly mode ? I don't know... I can make any choice (activate the macros or not, cancel), the file is not displayed in Word if it is launched... But the same window (choice to activate macros or not) appears even if there isn't any Word instance launched...
With the syntax
Code:
myDoc := "D:\Try.doc"
sCreateObjCode =
(
GetObject("%myDoc%")
)
ppWord := WS_Eval(pWord, sCreateObjCode)
the results are the same.
So for me the solution is probably to verify with AHK commands if there is a Word window which exists with the file name I want to use, and after to use one of these syntaxes to act on the file if it is already loaded in Word.
Thanks again, erictheturtle, for your beautifull work and your nice help.