Notifications
Clear all

[Closed] Get/Set external file properties with maxscript?

Is there a way to get/set file properties of external files (not .max files) with maxscript?

4 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

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.

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.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

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:
"
	if PropertySets.Contains member.SummaryInformation do
	(
		SummaryInfoIds = dotnetclass "CalumMcLellan.StructuredStorage.SummaryInfoIds"
		pp = PropertySets.item[member.SummaryInformation]
		
		title = pp.item[SummaryInfoIds.Title]
		format "	%: %
" title.name title.value
		subject = pp.item[SummaryInfoIds.Subject]
		format "	%: %
" subject.name subject.value
		author = pp.item[SummaryInfoIds.Author]
		format "	%: %
" author.name author.value
	)
	format "Custom:
"
	if PropertySets.Contains member.UserDefinedProperties do
	(
		pp = PropertySets.item[member.UserDefinedProperties]
		enum = pp.GetEnumerator()
		enum.MoveNext()
		while enum.current != undefined do
		(
			format "	%: %
" 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:
"
	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 "	%: %
" title.name title.value
	)
	PropertySets.Dispose()
)

best,

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.