Page 1 of 2 12>
Topic Options
#65743 - 2002-05-26 05:50 PM metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Anyone know how to access the properties / summary data of a file (from explorer in win2k/xp)

For example, if I wanted to edit the ownername property from a word document, or read the album name from a MP3.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65744 - 2002-05-26 10:10 PM Re: metadata editing help needed
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
All I can do at this time is list them:
code:
$obj = createobject("word.application")
$objdoc = $obj.Documents.Open("c:\data\scripts\titlea.doc")
for each $property in $objdoc.BuiltinDocumentProperties
? $property.name + "=" + $property.value
next
$objdoc.close
$obj.quit

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65745 - 2002-05-26 11:08 PM Re: metadata editing help needed
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Radimus, I have now been successful in changing the "Title" and the "Author" of the document. I have confirmed this in both my Hex editor and Word. It surprised me that I did not have to explicitly SAVE the document.

code:
$obj = createobject("word.application")
$objdoc = $obj.Documents.Open("c:\data\scripts\titlea.doc")
for each $property in $objdoc.BuiltinDocumentProperties
? $property.name + "=" + $property.value
next
$objdoc.BuiltinDocumentProperties.item("Title").value="Title www"
$objdoc.BuiltinDocumentProperties.item("Author").value="Kenobi, Obi-Wan (Ben)"


$objdoc.close
$obj.quit



[ 26 May 2002, 23:22: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65746 - 2002-05-26 11:44 PM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Cool.. Do you know of a way to get it via explorer or scripting.filesystemobject.

[ 27 May 2002, 00:29: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65747 - 2002-05-27 12:46 AM Re: metadata editing help needed
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I'm still learning the COM object model. I can see the same data using IE propertites as I changed via Word COM. At this time I can't seem to find out how to do anything once I have the InternetExplorer application object.

$obj = createobject("internetexplorer.application")

[ 27 May 2002, 00:47: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65748 - 2002-05-27 06:40 AM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
This gets the file via COM, but I don't know what to do with it now... The for/next thig returns nothing.

code:
$filedir="\\server\drives$$\Listening\Singles"
$obj = createobject("Scripting.FileSystemObject")
$objdoc = $obj.getfolder("$filedir")
? $objdoc

$file= $obj.GetFile("$filedir\01--Wils.mp3")
? $file
? $file.name
for each $property in $file
? $property.name + "=" + property.value
next

$obj.quit

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65749 - 2002-05-27 07:04 AM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I found this...
http://msdn.microsoft.com/library/en-us/dnw2k/html/shellcolhand.asp?

But it is greek to me.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65750 - 2002-05-27 04:07 PM Re: metadata editing help needed
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
We'll I found this and it does not look like that data is not available using the FileSystemObject.
FileSystemObject Properties
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#65751 - 2002-05-27 04:56 PM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
the previous post has come of the info needed, but doesn't specify the COM object used to get it.

this will enum a dir using COM:
$obj = createobject("Scripting.FileSystemObject")
$objdoc = $obj.getfolder("$filedir")

$d= $objdoc.Files
for each $file in $d
? $file.name+" "+ $file.type
next

$obj.quit
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65752 - 2002-05-27 05:47 PM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I think this is what I'm trying to get at:
http://msdn.microsoft.com/library/en-us/com/stgu_73eb.asp?frame=true
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65753 - 2002-05-27 09:23 PM Re: metadata editing help needed
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Rad, i was kinda heading down this path, based on Howards and yours pointers, but she hasn't yielded her secrets yet, hope this helps or moves things along:

break on

$shell = createobject("shell.application")

$folder = $shell.namespace("C:\")

$file = $folder.parsename("text.txt")

?"val=" $file.extendedproperty("Title")

@SERROR

exit 1


-Shawn

p.s. just for your further investigation, not sure if mentioned already, these properties are members of ShellFolderItem, which is an extention of FolderItem - I think its the "extention" part that is not being realized here. Even though it seems like @SERROR is reporting OK - no data being displayed.

--Shawn

[ 27 May 2002, 21:27: Message edited by: Shawn ]

Top
#65754 - 2002-05-28 05:05 AM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I came across references to ACShellExt.ContextMenu , but I don't know... This is a bit out of my league (for a systems Admin)

I've tried this:
code:
$filedir="\\server\drives$$\Listening\Singles"
$fso= createobject("Scripting.FileSystemObject")
$cd = $fso.getfolder("$filedir")

$shell = createobject("shell.application")
$foldir = $shell.namespace("$filedir")

$folder= $cd.Files
for each $file in $folder
? $file.name+" "+ $file.type
$fparse = $foldir.parsename($file.name)
$fparse.value
next
$shell.quit
$fso.quit

I've replaced $fparse.value with every property I could think of, but nothing volunteers...

[ 28 May 2002, 05:05: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65755 - 2002-05-28 10:06 AM Re: metadata editing help needed
Breaker Offline
Hey THIS is FUN
*****

Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
Guys,

Try this (you can tell its been a slow morning - what the hell is wrong with MS technical writers? They really don't try hard to make things simple, do they?)

Replace the file and folder with your particular target(s):

code:
 break on

$shell = createobject("shell.application")
? @ERROR + " - " + @SERROR
$files = $shell.namespace("C:\").items
? @ERROR + " - " + @SERROR
$file = $files.item("passage.txt")
? @ERROR + " - " + @SERROR
$title = $file.extendedproperty("title")
? @ERROR + " - " + @SERROR
$author = $file.extendedproperty("author")
? @ERROR + " - " + @SERROR

? "Title is " + $title
? "Author is " + $author

:end
Exit

Do I get a vote? Huh? [Wink]

Hmm...maybe not - afraid you still can't set/edit these properties, read-only at the moment! Sorry!

[ 28 May 2002, 10:09: Message edited by: Breaker ]
_________________________
================================================
Breaker


Top
#65756 - 2002-05-28 02:00 PM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
It's getting there... Thanks for the help.
but for some reason, it isn't pulling the title. Writing these values will be necessary

code:
break on
$filedir="\\server\drives$$\Listening\Singles"
$fso = createobject("Scripting.FileSystemObject")
$cd = $fso.getfolder("$filedir")
$folder= $cd.Files

$shell = createobject("shell.application")
$foldir = $shell.namespace("$filedir").items

for each $file in $folder
; ? $file.name+" "+ $file.type

$fparse = $foldir.item($file.name)
? $fparse.extendedproperty("Name")+" "
$fparse.extendedproperty("Title")+" "
$fparse.extendedproperty("Artist")+" "
$fparse.extendedproperty("Album")+" "
next
$shell.quit
$fso.quit



[ 28 May 2002, 15:52: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65757 - 2002-05-28 04:55 PM Re: metadata editing help needed
Breaker Offline
Hey THIS is FUN
*****

Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
Radimus,

You may be able to find more info at this web address - the suggestion seems to be that a lot of the Shell objects and functions aren't available through scripts.

Also, I've done a bit of digging this afternoon, and there's no mention of writing these attributes anywhere. I'm off home in a bit, but if you find anything, please post it - I'll have a glance in the morning.
_________________________
================================================
Breaker


Top
#65758 - 2002-05-28 11:28 PM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Check this page, but I don't understand how to access the data...

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/ifaces/icolumnprovider/icolumnprovider.asp?frame=true
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65759 - 2002-05-28 11:33 PM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
here is another...

http://msdn.microsoft.com/library/en-us/shellcc/platf orm/shell/reference/ifaces/ishellfolder2/getdetailsof.asp?frame=true

and another:

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/structures/shcolumnid.asp?frame=true

[ 28 May 2002, 23:37: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65760 - 2002-05-29 01:08 AM Re: metadata editing help needed
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Rad, heres the last two of those interfaces converted over into kixtart, the first one is non-scriptable i think:

break on

$shell = createobject("shell.application")

$folder = $shell.namespace("C:\")

for each $item in $folder.items
 
 ?
 ? "name: " $folder.getdetailsof($item,0)
 ? "size: " $folder.getdetailsof($item,1)
 ? "type: " $folder.getdetailsof($item,2)
 ? "date: " $folder.getdetailsof($item,3)
 ? "attr: " $folder.getdetailsof($item,4)
 ? "itip: " $folder.getdetailsof($item,-1)
 ?
 ? "enter..." gets$
 ?
next

exit 1



-shawn

[ 29 May 2002, 01:09: Message edited by: Shawn ]

Top
#65761 - 2002-05-29 01:46 AM Re: metadata editing help needed
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
it doesn't retuen any data, just the attribute name

Name-Size-Type-
Name-Size-Type-
Name-Size-Type-
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#65762 - 2002-05-29 01:50 AM Re: metadata editing help needed
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
what OS you running there ?
Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1821 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.08 seconds in which 0.031 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org