Start Objects (MS Office) non-visible

  • 90 Views
  • Last Post 20 June 2019
admin@repcat.cat posted this 19 June 2019

Hello all,

If there is a way to work with MS Office Objects without displaying them, I would greatly appreciate learning how to do it. My problem is that I have not yet found a way to set the "Visible" property of these COM objects (I assume, without actually knowing, that they are in fact COM objects) to "False", which will make processing less obtrusive and use less resources (i.e. no display resources required). Below is some AutoHotkey code which does what I want to do: open a document and save it under another name (of course I would normally process the document before saving it, but for purposes of illustration this may suffice).

wd := ComObjCreate("Word.Application")
; Create a COM Word object for manipulation
wd.Visible := False
; Set its "Visible" property to "False".
doc := wd.Documents.Open(A_ScriptDir . "\Document2.docx")
; Open a document for processing
sleep, 100
; A delay inserted for quick prototyping.
; There are better ways to accomplish this.
wd.ActiveDocument.SaveAs(A_ScriptDir . "\DocumentX.docx")
; Now that we have the active document (which is "doc" in our case),
; save it under another name.
doc.Close()
wd.Quit()
; Close and quit, of course, releasing the object and resources.

 Any help with this will be deeply appreciated!

Regards,

Winter

Order By: Standard | Newest | Votes
Swathi Muppalla posted this 20 June 2019

 

Hello Winter,

Thank you for reaching out to the Intellibot Forum Support Team.

Intellibot provides a connector for Microsoft Word using which different actions can be performed on existing or new documents.

For example, “Open” method is used to open a file and “SaveAs” method is used to save a file.

Other methods can be used for processing of documents. Please visit the below website for documentation on

Microsoft Word connector:

https://docs.intellibot.io/Studio/connectors/Word/

 A sample screenshot is provided below as a reference:

Note: In the above scenario, changes to the document are executed in the background.

Feel free to revert for any further clarification.

Thanks & Regards

Swathi Muppalla

 

 

admin@repcat.cat posted this 20 June 2019

Swathi, thank you for your reply.

Your instructions made it quite clear, I'm grateful for that. I duplicated the workflow described, and it does run. However, Word stays visible during the entire process. As I said above, "If there is a way to work with MS Office Objects without displaying them, I would greatly appreciate learning how to do it." If I'm not mistaken (please see my AHK code above), visibility is a property. Although I can use the methods for the object, I see no ability to alter a property. Thus my question.

I have since received word from Mr. Barli that the ability to hide MS Office objects will be added in v2.0, and I look forward to it.

Thanks again,

Winter

Close