Sign in to follow this  
Followers 0
caner

read MS Office properties using AutoIT

17 posts in this topic

i'm trying to write a script to read MS Office properties (Author,Title,Last Saved By etc) from existing MS Office files. i dont create a word document, i use existing one. i dont want to open doc files with application but only read.

official example:

#include <Word.au3>

$oWordApp = _WordCreate(@ScriptDir & "\Test.doc")

$oDoc = _WordDocGetCollection($oWordApp, 0)

ConsoleWrite("Title - " & _WordDocPropertyGet($oDoc, "Title") & @CRLF)

ConsoleWrite("Subject - " & _WordDocPropertyGet($oDoc, "Subject") & @CRLF)

ConsoleWrite("Author - " & _WordDocPropertyGet($oDoc, "Author") & @CRLF)

Share this post


Link to post
Share on other sites



And the question is?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

how can i do it?

Share this post


Link to post
Share on other sites

But the script you posted does exactly what you need, doesn't it?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

i dont want to create Word application. i want only use existing documents.

Share this post


Link to post
Share on other sites

and also create a gui listbox like this photo. In fact i created an application using C# with DSOFile.dll but it doesnt work all Windows. So i want to create a code with AutoIt.

post-59035-0-35756300-1329598934_thumb.j

Share this post


Link to post
Share on other sites

Or try this, function _File_Ext_PropertiesGet.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

broken link!!!

Server Error in '/' Application.

Share this post


Link to post
Share on other sites

ok i've downloaded it.

Share this post


Link to post
Share on other sites

it contains only File system metadata. i need MS Office metadata.

Share this post


Link to post
Share on other sites

To get MS Office metadata you have to open the file and get the data like you did in your first post.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

but the code creates blank word document!

Share this post


Link to post
Share on other sites

or opens exist document with Word. i dont want to open document actually.

Share this post


Link to post
Share on other sites

Then open Word invisible and quit when finished.

#include <Word.au3>
$oWordApp = _WordCreate(@ScriptDir &amp; "\Test.doc", 0, 0)
$oDoc = _WordDocGetCollection($oWordApp, 0)
ConsoleWrite("Title - " & _WordDocPropertyGet($oDoc, "Title") & @CRLF)
ConsoleWrite("Subject - " & _WordDocPropertyGet($oDoc, "Subject") & @CRLF)
ConsoleWrite("Author - " & _WordDocPropertyGet($oDoc, "Author") & @CRLF)
_WordQuit($oWordApp, 0)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

i dont want to open document actually.

You have to open the document - that's the only way I know to access the properties.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

ok but it runs slowly... i'll try it again using C#..

thank you.

Share this post


Link to post
Share on other sites

If you want to extract the metadata from many word documents you could extract the part where the object is created from _WordCreate, process each document in a loop and close each document but leaving word running. At the end close Word.

Can't test at the moment because my Ubuntu PC doesn't understand MS Word :)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0