PDA

View Full Version : Get/Set external file properties with maxscript?


3rd Dimentia
12-10-2010, 12:37 AM
Is there a way to get/set file properties of external files (not .max files) with maxscript?

denisT
12-10-2010, 12:50 AM
Is there a way to get/set file properties of external files (not .max files) with maxscript?

there is no way to get it with maxscript only. there are some free DLLs which give access to file proprties (some of them are open source). using .net you technically can get this data. try to search on this forum, i posted some links.

3rd Dimentia
12-10-2010, 02:42 AM
Thanks Denis, I'm assuming you men the CalumMcLellan StructuredStorage DLLs. If so, thanks for the tip. However I wouldn't even know where to put them, never mind how to access/use them. I appreciate the reply though.

Cheers,

Cg.

denisT
12-10-2010, 03:16 AM
Thanks Denis, I'm assuming you men the CalumMcLellan StructuredStorage DLLs. If so, thanks for the tip. However I wouldn't even know where to put them, never mind how to access/use them. I appreciate the reply though.

Cheers,

Cg.

yes. it's Calum McLellan StructuredStorage. I think it's one of the best things about this matter. I'm using my own but his one is much more powerful. Unfortunately I can't share my DLL but my experiments with Calum's might be helpful:


global StructuredStorage = dotnet.loadassembly @"C:\Tools\StructuredStorage\64\CalumMcLellan.Struct uredStorage.dll"
-- read properties
(
file = @"C:\Temp\attr_test01.max"
PropertySets = dotnetobject "CalumMcLellan.StructuredStorage.PropertySets" file on -- ON is for read only
member = dotnetclass "CalumMcLellan.StructuredStorage.PropertySetIds"
format "Summary:\n"
if PropertySets.Contains member.SummaryInformation do
(
SummaryInfoIds = dotnetclass "CalumMcLellan.StructuredStorage.SummaryInfoIds"
pp = PropertySets.item[member.SummaryInformation]

title = pp.item[SummaryInfoIds.Title]
format "\t%: %\n" title.name title.value
subject = pp.item[SummaryInfoIds.Subject]
format "\t%: %\n" subject.name subject.value
author = pp.item[SummaryInfoIds.Author]
format "\t%: %\n" author.name author.value
)
format "Custom:\n"
if PropertySets.Contains member.UserDefinedProperties do
(
pp = PropertySets.item[member.UserDefinedProperties]
enum = pp.GetEnumerator()
enum.MoveNext()
while enum.current != undefined do
(
format "\t%: %\n" enum.current.name enum.current.value
enum.MoveNext()
)
enum.Dispose()
)
PropertySets.Dispose()
)
-- write properties
(
file = @"C:\Temp\attr_test.max"
PropertySets = dotnetobject "CalumMcLellan.StructuredStorage.PropertySets" file off -- OFF is not read only
member = dotnetclass "CalumMcLellan.StructuredStorage.PropertySetIds"
format "Summary:\n"
if PropertySets.Contains member.SummaryInformation do
(
SummaryInfoIds = dotnetclass "CalumMcLellan.StructuredStorage.SummaryInfoIds"
pp = PropertySets.item[member.SummaryInformation]

title = pp.item[SummaryInfoIds.Title]
title.value = "changed"
format "\t%: %\n" title.name title.value
)
PropertySets.Dispose()
)


best,

LoneRobot
12-10-2010, 02:46 PM
ooh, interesting. I'd looked into COM structured storage before - http://lonerobot.net/?p=151 when I was working out how to get the max file thumbnail through dotnet. I dont think his API was out at the time. I used microsoft's dsofile.dll. This looks much better, thanks Denis.

CGTalk Moderation
12-10-2010, 02:46 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.