Notifications
Clear all

[Closed] Getting recent file list in 2010

Max 2010 is no longer getting its recent file list from the 3dsmax.ini, seems like its using the windows recent documents to store it. How can i access this by maxscript?

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

Posts: 0

fn getRecentFiles type:"max" = 
(
 local mru_path = "software\\microsoft\\windows\\currentversion\\explorer\\comDlg32\\OpenSaveMRU\\"
 local mru_list = mru_path + type + "\\"
 local names, values, ktype, kval, hkey, file
 if (registry.openKey HKEY_CURRENT_USER mru_list accessRights:#readOnly key:&hkey) and hkey != undefined then
 (
  registry.getValueNames hkey names:&names
  if names != undefined and (k = finditem names "MRUList") != 0 do 
  (
   registry.queryValue hkey names[k] type:&ktype value:&kval
   if kval != undefined do 
   (
	mrus = for i=1 to kval.count collect
	(
	 registry.queryValue hkey kval[i] type:&ktype value:&file
	 file
	)
--	format "MRUList %
" mrus
   )
  )
 )
 else messageBox ("No Info for \"." + (toUpper type) + "\"	") title:"Warning!" beep:off
)


But are you really sure that MAX 2010 doesn’t store recent files list in some .ini file?

in max 2010, my recent file list is stored here in XML format –


 C:\Documents and Settings\Administrator\Local Settings\Application Data\Autodesk\3dsmax\2010 - 64bit\enu\RecentDocuments.xml

it would be pretty easy to write an XML parser function to retrieve this info.


Fn LoadRecentFileList =
(
local recentfiles = (getdir #maxData) + "RecentDocuments.xml"
if doesfileexist recentfiles then
	(
	XMLArray = #()		
	xDoc = dotnetobject "system.xml.xmldocument"	
	xDoc.Load recentfiles
	Rootelement = xDoc.documentelement

	XMLArray = for i = 0 to rootelement.childnodes.item[4].childnodes.itemof[0].childnodes.count-1 collect 
		(
		rootelement.childnodes.item[4].childnodes.itemof[0].childnodes.itemof[i].childnodes.itemof[3].innertext	
		)
		
	Return XMLArray
	LRXML = Undefined
	XDoc = Undefined
	XDoc = nothing	
	)
)
Loadrecentfilelist()

Ahh, thanks pete!
I missed the xml file, that is the way to go!
Cheers!!!

You could probably use a .NET XML Serializer to read in that XML document, since I’m sure that’s how Nicolas wrote the code. He loves Serialization!

Hi chris,

could you explain a little more about serialization, i’ve not come across this.

and jordan, if you tweak the index of what the xml function retrieves, you can also access the thumbnail image stored for the file. this is simpler than using the structured storage dotnet method i posted here – http://lonerobot.net/?p=151

1 Reply
(@floopyb)
Joined: 11 months ago

Posts: 0

Yes, I did notice that! It will handy to get to the thumbnail that easily!

This sounds very interesting !
How would you go coding such Objects ?
I’d love to read more (from Nicolas ?)
Thanks for this promising lead

Look at System.XML.Serialization.XMLSerializer.

I’ve never done it using maxscript though.