View Full Version : Getting recent file list in 2010
floopyb 07-15-2009, 05:14 AM 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?
|
|
denisT
07-15-2009, 05:20 PM
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?
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 %\n" mrus
)
)
)
else messageBox ("No Info for \"." + (toUpper type) + "\"\t") title:"Warning!" beep:off
)
But are you really sure that MAX 2010 doesn't store recent files list in some .ini file?
LoneRobot
07-15-2009, 06:12 PM
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.
LoneRobot
07-15-2009, 11:29 PM
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()
floopyb
07-16-2009, 01:08 AM
Ahh, thanks pete!
I missed the xml file, that is the way to go!
Cheers!!!
AlpineMan
07-16-2009, 03:07 AM
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! :)
LoneRobot
07-16-2009, 06:57 AM
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
Zbuffer
07-16-2009, 10:56 PM
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! :)
This sounds very interesting !
How would you go coding such Objects ?
I'd love to read more (from Nicolas ?)
Thanks for this promising lead ;)
floopyb
07-20-2009, 03:09 AM
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
Yes, I did notice that! It will handy to get to the thumbnail that easily!
AlpineMan
07-20-2009, 03:24 AM
Look at System.XML.Serialization.XMLSerializer.
I've never done it using maxscript though.
CGTalk Moderation
07-20-2009, 03:24 AM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.