Hi,

Using some code I found on the web I can read the Extended file properties.

Some of the properties are clearly read only, but how can I change the
ones which aren't?

<code>
Function GetFileInformation() As Boolean
On Error GoTo ErrorHandler
Dim arrHeaders(35)
Set objShell = CreateObject("Shell.Application")
Set objfolder = objShell.Namespace("C:\TestFolder")
For i = 0 To 34
arrHeaders(i) = objfolder.GetDetailsOf(objfolder.Items, i)
Next
For Each strFileName In objfolder.Items
For i = 0 To 34
Debug.Print i & vbTab & arrHeaders(i) & ": " _
& objfolder.GetDetailsOf(strFileName, i)
Next
Next
GetFileInformation = True
Exit Function
ErrorHandler:
MsgBox "Unable to process data in Function 'GetFileInformation' due
to:" & vbCrLf & Err.Description, vbCritical
Err.Clear
GetFileInformation = False
End Function ' GetFileInformation
</code>


Regards


Laurie Comerford

Re: Extended File properties by mayayana

mayayana
Sat Oct 18 19:35:40 CDT 2008

>
> Using some code I found on the web I can read the Extended file
properties.
>
> Some of the properties are clearly read only, but how can I change the
> ones which aren't?
>

They're all read-only when you're using Shell.Application.
With properties that can be written, the method depends
on the property.


> <code>
> Function GetFileInformation() As Boolean
> On Error GoTo ErrorHandler
> Dim arrHeaders(35)
> Set objShell = CreateObject("Shell.Application")
> Set objfolder = objShell.Namespace("C:\TestFolder")
> For i = 0 To 34
> arrHeaders(i) = objfolder.GetDetailsOf(objfolder.Items, i)
> Next
> For Each strFileName In objfolder.Items
> For i = 0 To 34
> Debug.Print i & vbTab & arrHeaders(i) & ": " _
> & objfolder.GetDetailsOf(strFileName, i)
> Next
> Next
> GetFileInformation = True
> Exit Function
> ErrorHandler:
> MsgBox "Unable to process data in Function 'GetFileInformation' due
> to:" & vbCrLf & Err.Description, vbCritical
> Err.Clear
> GetFileInformation = False
> End Function ' GetFileInformation
> </code>
>
>
> Regards
>
>
> Laurie Comerford



Re: Extended File properties by Laurie

Laurie
Sun Oct 19 18:00:04 CDT 2008

Hi mayayana,

Thanks for confirming my current knowledge. Can you give me some
guidelines as to where I can find more information?

Regards


Laurie Comerford

mayayana wrote:
>> Using some code I found on the web I can read the Extended file
> properties.
>> Some of the properties are clearly read only, but how can I change the
>> ones which aren't?
>>
>
> They're all read-only when you're using Shell.Application.
> With properties that can be written, the method depends
> on the property.
>
>
>> <code>
>> Function GetFileInformation() As Boolean
>> On Error GoTo ErrorHandler
>> Dim arrHeaders(35)
>> Set objShell = CreateObject("Shell.Application")
>> Set objfolder = objShell.Namespace("C:\TestFolder")
>> For i = 0 To 34
>> arrHeaders(i) = objfolder.GetDetailsOf(objfolder.Items, i)
>> Next
>> For Each strFileName In objfolder.Items
>> For i = 0 To 34
>> Debug.Print i & vbTab & arrHeaders(i) & ": " _
>> & objfolder.GetDetailsOf(strFileName, i)
>> Next
>> Next
>> GetFileInformation = True
>> Exit Function
>> ErrorHandler:
>> MsgBox "Unable to process data in Function 'GetFileInformation' due
>> to:" & vbCrLf & Err.Description, vbCritical
>> Err.Clear
>> GetFileInformation = False
>> End Function ' GetFileInformation
>> </code>
>>
>>
>> Regards
>>
>>
>> Laurie Comerford
>
>

Re: Extended File properties by Kevin

Kevin
Sun Oct 19 22:48:08 CDT 2008

Is your maiden name Stork? Just curious. If so, we know each other IRL.
If not, nevermind. :-)

"Laurie Comerford" <Laurie@I_hate_Spam.com.au> wrote in message
news:eCQip5jMJHA.1612@TK2MSFTNGP03.phx.gbl...
| Hi mayayana,
|
| Thanks for confirming my current knowledge. Can you give me some
| guidelines as to where I can find more information?
|
| Regards
|
|
| Laurie Comerford
|
| mayayana wrote:
| >> Using some code I found on the web I can read the Extended file
| > properties.
| >> Some of the properties are clearly read only, but how can I change the
| >> ones which aren't?
| >>
| >
| > They're all read-only when you're using Shell.Application.
| > With properties that can be written, the method depends
| > on the property.
| >
| >
| >> <code>
| >> Function GetFileInformation() As Boolean
| >> On Error GoTo ErrorHandler
| >> Dim arrHeaders(35)
| >> Set objShell = CreateObject("Shell.Application")
| >> Set objfolder = objShell.Namespace("C:\TestFolder")
| >> For i = 0 To 34
| >> arrHeaders(i) = objfolder.GetDetailsOf(objfolder.Items, i)
| >> Next
| >> For Each strFileName In objfolder.Items
| >> For i = 0 To 34
| >> Debug.Print i & vbTab & arrHeaders(i) & ": " _
| >> & objfolder.GetDetailsOf(strFileName, i)
| >> Next
| >> Next
| >> GetFileInformation = True
| >> Exit Function
| >> ErrorHandler:
| >> MsgBox "Unable to process data in Function 'GetFileInformation' due
| >> to:" & vbCrLf & Err.Description, vbCritical
| >> Err.Clear
| >> GetFileInformation = False
| >> End Function ' GetFileInformation
| >> </code>
| >>
| >>
| >> Regards
| >>
| >>
| >> Laurie Comerford
| >
| >



Re: Extended File properties by mayayana

mayayana
Sun Oct 19 23:28:48 CDT 2008


> Thanks for confirming my current knowledge. Can you give me some
> guidelines as to where I can find more information?
>

You still didn't indicate which properties you
want to write. I'm not trying to give you a
hard time. The different properties just don't
fit into one system. Shell.App aggregates a
lot of disparate data. For instance, if you need
to change file times you can look here:

http://vbnet.mvps.org/code/fileapi/filedatetime.htm

Some other properties may be stored in alternate
data streams on NTFS systems, depending on file
type. I think DOC files have their own system to
store title, author, etc. JPG files have a different
system for the same properties, using Microsoft's
custom version of EXIF data tags. I don't know
anything about music file data. They may have their
own custom header storage options.

Attributes can be most easily changed, but are
yet again different from the other properties listed
above.

So... guidelines to find more info. about ALL properties?
If you don't have the patience to clarify your needs to
timewasting fools who answer posts in newsgroups, then I
guess lots of Googling would be your best bet. :)




Re: Extended File properties by Laurie

Laurie
Thu Oct 23 16:17:05 CDT 2008

Hi mayayana,

I guess I didn't fully understand your initial response. Here is an
output set from the code I posted for a file created by Windows Media
Player. Note that some of the data is duplicated e.g. 0 and 10, 9 and
16, 12 and 20

0 Name: Jamaican Rumba.wma
1 Size: 1,926 KB
2 Type: Windows Media Audio file
3 Date Modified: 17/08/2008 6:59 PM
4 Date Created: 24/10/2008 8:08 AM
5 Date Accessed: 24/10/2008 8:08 AM
6 Attributes: A
7 Status: Online
8 Owner: AMD4\default
9 Author: London Promenade Orchestra
10 Title: Jamaican Rumba
11 Subject:
12 Category: Classical
13 Pages:
14 Comments:
15 Copyright:
16 Artist: London Promenade Orchestra
17 Album Title: Wonderful World Of Melody Disc 3
18 Year:
19 Track Number: 5
20 Genre: Classical
21 Duration: 0:02:02
22 Bit Rate: 128kbps
23 Protected: No
24 Camera Model:
25 Date Picture Taken:
26 Dimensions:
27 :
28 :
29 Episode Name:
30 Program Description:
31 :
32 Audio sample size: 16 bit
33 Audio sample rate: 44 kHz
34 Channels: 2 (stereo)


The values I want to set are music related for MP3, WMA, and/or WAV
files and include the items:
10 Title:
16 Artist:
17 Album Title:
19 Track Number:
20 Genre:

However, as the files are for my own use only, it really doesn't matter
what items I assign the data to as I can then read it back with my code
from any of these fields. e.g. My five data items could be stored in
any the fields:

9 Author:
10 Title:
11 Subject:
12 Category:
13 Pages:
14 Comments:
15 Copyright:
24 Camera Model:
25 Date Picture Taken:
26 Dimensions:
27 :
28 :
29 Episode Name:
30 Program Description:
31 :

Hence, if you can give me a start to write to any of the fields, I will
be able to achieve my aim.

I have spent some time searching the web, but clearly I'm not asking the
right questions. That was why I posted here.


Regards


Laurie Comerford

mayayana wrote:
>> Thanks for confirming my current knowledge. Can you give me some
>> guidelines as to where I can find more information?
>>
>
> You still didn't indicate which properties you
> want to write. I'm not trying to give you a
> hard time. The different properties just don't
> fit into one system. Shell.App aggregates a
> lot of disparate data. For instance, if you need
> to change file times you can look here:
>
> http://vbnet.mvps.org/code/fileapi/filedatetime.htm
>
> Some other properties may be stored in alternate
> data streams on NTFS systems, depending on file
> type. I think DOC files have their own system to
> store title, author, etc. JPG files have a different
> system for the same properties, using Microsoft's
> custom version of EXIF data tags. I don't know
> anything about music file data. They may have their
> own custom header storage options.
>
> Attributes can be most easily changed, but are
> yet again different from the other properties listed
> above.
>
> So... guidelines to find more info. about ALL properties?
> If you don't have the patience to clarify your needs to
> timewasting fools who answer posts in newsgroups, then I
> guess lots of Googling would be your best bet. :)
>
>
>

Re: Extended File properties by mayayana

mayayana
Thu Oct 23 17:07:47 CDT 2008


> Hence, if you can give me a start to write to any of the fields, I will
> be able to achieve my aim.
>

Maybe someone will show up with more info.,
but it looks like you're in for a lot of work. If
you go here there's a link for the ASF file spec.:

http://www.microsoft.com/windows/windowsmedia/forpros/format/asfspec.aspx

Apparently wma is a version of asf. There's
also a link there to the Windows Media SDK.
According to this page the SDK has support
for editing "metadata".

http://msdn.microsoft.com/en-us/library/aa387410.aspx

And here are download links for the SDK:

http://msdn.microsoft.com/en-us/windowsmedia/bb190309.aspx

The latest requires that you apply for a license!
I found that the v. 9 download provided a direct
download link with no license or WGA nonsense.
According to the help file in that there's a
Metadata Editor Object. So maybe that's what you
need. There's actually a C++ metadata edit sample
among the code samples.

Unfortunately, every file type is different. Some
music files apparently have something called ID3
-- another format to store tags in the file header.
And that's just audio. I don't know if you'll find
a tagging or "metadata" system that can be used with
mp3, wma AND wav. Wav files may not even provide
that option.

I think there are options to store data for all files
on XP with NTFS formatting, in which case the data
is stored as alternate data streams, which are hidden
files that don't show in Explorer and that are lost when
a file is moved to non-NTFS. As I understand it, that
system was scrapped in Vista due to the limitation
of needing to keep the file on an NTFS partition. In any
case, that's the closest thing to a general method of
storing metadata for files. I suspect that Shell.App is
probably drawing on a large number of different
libraries/methods in order to provide the convenient
appearance of standardized metadata.




Re: Extended File properties by Laurie

Laurie
Thu Oct 23 22:56:01 CDT 2008

Hi mayayana ,

Thank you. Now the hard work starts.

I'll transform the C++ code to VB code (if I can)

Regards


Laurie Comerford

mayayana wrote:
>> Hence, if you can give me a start to write to any of the fields, I will
>> be able to achieve my aim.
>>
>
> Maybe someone will show up with more info.,
> but it looks like you're in for a lot of work. If
> you go here there's a link for the ASF file spec.:
>
> http://www.microsoft.com/windows/windowsmedia/forpros/format/asfspec.aspx
>
> Apparently wma is a version of asf. There's
> also a link there to the Windows Media SDK.
> According to this page the SDK has support
> for editing "metadata".
>
> http://msdn.microsoft.com/en-us/library/aa387410.aspx
>
> And here are download links for the SDK:
>
> http://msdn.microsoft.com/en-us/windowsmedia/bb190309.aspx
>
> The latest requires that you apply for a license!
> I found that the v. 9 download provided a direct
> download link with no license or WGA nonsense.
> According to the help file in that there's a
> Metadata Editor Object. So maybe that's what you
> need. There's actually a C++ metadata edit sample
> among the code samples.
>
> Unfortunately, every file type is different. Some
> music files apparently have something called ID3
> -- another format to store tags in the file header.
> And that's just audio. I don't know if you'll find
> a tagging or "metadata" system that can be used with
> mp3, wma AND wav. Wav files may not even provide
> that option.
>
> I think there are options to store data for all files
> on XP with NTFS formatting, in which case the data
> is stored as alternate data streams, which are hidden
> files that don't show in Explorer and that are lost when
> a file is moved to non-NTFS. As I understand it, that
> system was scrapped in Vista due to the limitation
> of needing to keep the file on an NTFS partition. In any
> case, that's the closest thing to a general method of
> storing metadata for files. I suspect that Shell.App is
> probably drawing on a large number of different
> libraries/methods in order to provide the convenient
> appearance of standardized metadata.
>
>
>