AutoHotkey Community

It is currently May 25th, 2012, 9:05 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: November 13th, 2007, 3:29 pm 
Offline

Joined: October 22nd, 2007, 3:44 pm
Posts: 11
Hello, I am trying to automate the insertion of several values I parsed from a webpage using COM (probably the most reliable way to get this working on several machines, at least I hope so).

I tried the following:

Code:
word := COM_ActiveXObject("Word.Application")
COM_Invoke(word, "visible=", "true")
COM_Invoke(word, "Open", "c:\test.dot")


The "visible" part works. The Open Method doesn't get called, I suspect it is because the visible method is not part of the Word.Application Object, but a sub-object called documents. The vbscript equivalent I would be calling here is:

Code:
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("c:\scripts\inventory.doc")


Can somebody help me out here, how I would get the handler for the documents object so I can call the method ?
I suspect I would have to do something with COM_Queryinterface and maybe use the IID of the document object ? If so, how do I get the ID ?

Thanks alot !


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 13th, 2007, 4:15 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
hotzenpl0tz wrote:
Code:
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("c:\scripts\inventory.doc")

Verbatim translation:
Code:
objWord := COM_CreateObject("Word.Application")
objDoc  := COM_Invoke(COM_Invoke(objWord, "Documents"), "Open", "c:\scripts\inventory.doc")

Quote:
I suspect I would have to do something with COM_Queryinterface and maybe use the IID of the document object ?

I don't think VBS has the function of QueryInterface.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2007, 4:34 pm 
Offline

Joined: October 22nd, 2007, 3:44 pm
Posts: 11
Thanks alot Sean, helped me out immensely !


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], Bing [Bot], Exabot [Bot], krajan, kwfine, MilesAhead, Rathgar2, rbrtryn, reesd, tomL and 31 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group