Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MS Word document built-in Properties
#1
Dear Gintaras,

I understand that when you right-click an MS-Word (.doc) document in Windows Explorer you get its properties, including a tab named as "summary" including BuiltInDocumentProperties information (eg. Title, Subject etc.)

I also understand that (a) with QM FileGetAttributes you may get some of the document properties and (b) you can get BuiltInDocumentProperties information of an open word document using various methods, including scripts.

My question is : Is there any way, analogous to that used by the system to display above tab, to access BuiltInDocumentProperties information using a QM function?

Many thanks. Best regards!
#2
This is my best approximation, It is implied that I am not satisfied :

Macro Macro_1947
Code:
Copy      Help
;http://www.quickmacros.com/forum/viewtopic.php?p=21525"Word.Application")
;app.Visible = TRUE
IDispatch docs=app.Documents
;load file
VARIANT d=_s.expandpath("C:\tmp\hlp.doc")
IDispatch doc=docs.Add(d)
;text
;out doc.Content.Text
str subj=doc.BuiltInDocumentProperties(2) ;; get subject
out subj
app.Quit
#3
Macro get file extended properties
Code:
Copy      Help
out
str folder="Q:\MP3"

Shell32.Shell x._create
Shell32.Folder f=x.NameSpace(folder)

;get column names
ARRAY(str) columns
int i
for(i 0 1000000) _s=f.GetDetailsOf(0 i); if(_s.len) columns[]=_s; else break
;for(i 0 columns.len) out columns[i]

;enumerate files in the folder and display all non-empty properties
Shell32.FolderItem k
foreach k f.Items
,if(k.IsFolder) continue
,str name=k.Name
,out F"<><Z 0x80E080>{name}</Z>"
,for i 0 columns.len
,,_s=f.GetDetailsOf(k i)
,,if(!_s.len) continue
,,out F"{columns[i]}={_s}"
,,
#4
Thank you very much, indeed!
#5
For single file
Macro get file extended properties2
Code:
Copy      Help
out
str folder="Q:\MP3"
str filename="05 - DEUTER - Sound Of Invisible Waters.mp3"

Shell32.Shell x._create
Shell32.Folder f=x.NameSpace(folder)

;get column names
ARRAY(str) columns
int i
for(i 0 1000000) _s=f.GetDetailsOf(0 i); if(_s.len) columns[]=_s; else break
;for(i 0 columns.len) out columns[i]

Shell32.FolderItem k=f.ParseName(filename)
str name=k.Name
out F"<><Z 0x80E080>{name}</Z>"
for i 0 columns.len
,_s=f.GetDetailsOf(k i)
,if(!_s.len) continue
,out F"{columns[i]}={_s}"
#6
Gets only specified columns
Macro get file extended properties1
Code:
Copy      Help
out
str folder="Q:\MP3"
str filename="05 - DEUTER - Sound Of Invisible Waters.mp3"
str getColumns="Title[]Authors[]Length"

Shell32.Shell x._create
Shell32.Folder f=x.NameSpace(folder)

;get column names
ARRAY(str) columns
int i
for(i 0 1000000) _s=f.GetDetailsOf(0 i); if(_s.len) columns[]=_s; else break
;for(i 0 columns.len) out columns[i]

;find indices of columns specified in getColumns
ARRAY(int) colIndices
foreach _s getColumns
,for(i 0 columns.len) if(_s=columns[i]) colIndices[]=i; break

;display data of specified columns of the file
Shell32.FolderItem k=f.ParseName(filename)
str name=k.Name
out F"<><Z 0x80E080>{name}</Z>"
for i 0 colIndices.len
,int j=colIndices[i]
,_s=f.GetDetailsOf(k j)
,out F"{columns[j]}={_s}"

For all files
Macro get file extended properties3
Code:
Copy      Help
out
str folder="Q:\MP3"
str getColumns="Title[]Authors[]Length"

Shell32.Shell x._create
Shell32.Folder f=x.NameSpace(folder)

;get column names
ARRAY(str) columns
int i
for(i 0 1000000) _s=f.GetDetailsOf(0 i); if(_s.len) columns[]=_s; else break
;for(i 0 columns.len) out columns[i]

;find indices of columns specified in getColumns
ARRAY(int) colIndices
foreach _s getColumns
,for(i 0 columns.len) if(_s=columns[i]) colIndices[]=i; break

;enumerate files in the folder and display all non-empty properties
Shell32.FolderItem k
foreach k f.Items
,if(k.IsFolder) continue
,str name=k.Name
,out F"<><Z 0x80E080>{name}</Z>"
,;display data of specified columns of the file
,for i 0 colIndices.len
,,int j=colIndices[i]
,,_s=f.GetDetailsOf(k j)
,,out F"{columns[j]}={_s}"
#7
I think that the last part of the code in the case of specified columns it sould be replaced as it follows :

Macro get file extended properties1
Code:
Copy      Help
for i 0 colIndices.len
,_s=f.GetDetailsOf(k colIndices[i])
,str s.getl(getColumns i)
,out F"{s}={_s}"

Many thanks again.
#8
fixed

,int j=colIndices[i]
,_s=f.GetDetailsOf(k j)
,out F"{columns[j]}={_s}"
#9
Dear Gintaras,

These routines proved to be very useful. I am now wondering whether there exists a way to set one of these properties, for example "subject".

Best regards.
#10
I think Explorer extracts these properties from various sources, for example from file content.


Forum Jump:


Users browsing this thread: 1 Guest(s)