Getting the recent documents

Getting the recent documents

Lukas_cp
Participant Participant
1,691 Views
5 Replies
Message 1 of 6

Getting the recent documents

Lukas_cp
Participant
Participant

On the Inventor home screen is a list of recent documents. Is there a way to retrieve these documents via the API?

0 Likes
Accepted solutions (1)
1,692 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Hi @Lukas_cp.  I don't recall a tool specifically for retrieving that list of 'recent documents', but I know of a couple of related tools for dealing with them.  Under the Inventor.Application object, there is a property called MRUDisplay, and a property called MRUEnabled.  In this case the 'MRU' stands for 'Most Recently Used' (or similar).  You can visit those links to read a bit more about them.  But to get the list of all 'in memory' documents, you can use the ThisApplication.Documents properties.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡 or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

Lukas_cp
Participant
Participant

@WCrihfield Thank you for your answer. MRU seems to be the right direction, unfortunately I haven't found a MRU list yet.

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor

There may not be a tool specifically for this task built into Inventor's API, but I bet we could create a custom tool for it if we needed to.  This has apparently been done many, many times over the years using vb.net (the basis for iLogic code).  Some tools use the Windows Registry, but this might not be available for editing if you don't have administrative rights on your computer though.  One thought might be to get the windows special folder called 'Recent', where it temporarily stores 'recent' documents you've opened or edited.  Then loop through the documents in that folder, filtering for Inventor's file types, then make a list of them to present to the user, so they can choose one.  It's just an idea in my head right now, so I'm not 100% sure if it's doable yet, but does that sound like something you would want to dig into?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor

I did a quick test of that last theory, and found out that folder wasn't being updated with the Inventor files I was opening, so that might not be the correct folder to search in.  I know where the Undo data is stored, but when I searched in that folder I didn't find any Inventor files.  And I know where Inventor stores recent old versions of iLogic rules that I've worked on, but again, I didn't find any Inventor files there either.  I also know that there is an OldVersions folder in each directory where Inventor files are kept, but those folders are full of files that aren't necessarily 'recent', so that doesn't seem right either.  I'm not sure where it stores its recent Inventor documents, or even if there is a single folder for this.  It may just be something that Autodesk deals with seperately, in its own way, internally.

Here's the simple little iLogic rule to check in the current Windows user account's 'Recent' folder, just in case it may be useful to someone.

oRecent = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Recent)
If Not System.IO.Directory.Exists(oRecent) Then
	MsgBox("Could not find the 'Recent' folder.", , "")
	Exit Sub
End If
oRecentFiles = System.IO.Directory.GetFiles(oRecent)
If oRecentFiles.Length = 0 Then
	MsgBox("There were no files in the 'Recent' folder.", , "")
Else
	oFileName = InputListBox("", oRecentFiles, "", "Recent Files", "List Of Recent Files")
	If Not String.IsNullOrEmpty(oFileName) Then
		MsgBox("You chose:  " & oFileName, , "")
	End If
End If

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 6

Lukas_cp
Participant
Participant
Accepted solution

A list of recent files for the current user can be found in the registry.

Computer\HKEY_CURRENT_USER\SOFTWARE\Autodesk\Inventor\RegistryVersion26.0\Recent File List

Note that RegistryVersionXX.X depends on the Inventor version.

0 Likes