Author Topic: Lisp to delete AutoCAD Recent folder contents  (Read 16732 times)

0 Members and 1 Guest are viewing this topic.

bayoubuoy

  • Guest
Lisp to delete AutoCAD Recent folder contents
« on: January 01, 2011, 07:09:12 PM »
Does anyone have a  lisp routine to delete the contents of the AutoCAD Recent folder?

thanks,
bayoubuoy

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #1 on: January 01, 2011, 11:06:56 PM »
To the best of my knowledge :

The MRU list is stored in the registry.

The List is read into Memory when AutoCAD starts.

As drawings are created/saved in Autocad the memory list and MRU list are updated ... the registry is not updated.

The registry is updated/overwritten when AutoCad closes.

Changes made to the registry while AutoCAD is open have no effect on the current session, and because they are overwritten when AutoCAD closes, no effect on subsequent sessions.

WARNING: attempt the following at your own risk.
This can be demonstrated with code ... something like
Code: [Select]
(setq KeyList '( "File" "FilePinned" "FileTime" "Class"))
(foreach key keylist
  (setq index 0)
  (repeat 50
    (setq index     (1+ index)
          valuename (strcat key (itoa index))
    )
    (vl-registry-delete (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Recent File List\\")
                        valuename
    )
  )
)


Considering this, the way I'd handle the issue is
Open AutoCAD
run this code to get the registry address of the MRU list
(strcat (strcat "HKEY_CURRENT_USER\\" (vlax-product-key)) "\\Recent File List\\")

Open regedit
Navigate to the  address.
Close AutoCAD
In Regedit: Highlight the Recent File List key in the left pane
Right Click the Mouse on that entry and select Delete from the Options.
Close Regedit
Re-open AutoCAD

The MRU list will start a new list as you save files.

The number of files displayed in the list can be controlled from Options->Open and Save  < edit the File Open and Application Menu Count values>
The registry entries will continue to be written but the file Names will not be displayed.

« Last Edit: January 01, 2011, 11:10:11 PM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #2 on: January 01, 2011, 11:32:02 PM »
Kerry, I don't know if the OP is talking about the MRU list or not, and you are 100% correct with that. However, AutoCAD does tend to pollute the user profile with tons of unused shortcuts.

To find these shortcuts, you merely need browse to the location where your profile is stored, in 2007 (what I currently have loaded) the location is C:\Documents and Settings\%username%\Application Data\Autodesk\AutoCAD 2007\R17.0\enu\Recent.

I don't have any code right off hand to delete those shortcuts, but it shouldn't be difficult to roll one.

If I were to code it, I'd get the path from the support path sysvar, drop \Support from the path, append \Recent and delete everything in the Recent folder, although there could be a better solution ... like just not to worry about it and occasionally delete them or setup a task in the OS to do it at the desired intervals.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #3 on: January 02, 2011, 07:51:19 AM »
Wow, there is a lot of stuff in there.
You can delete all of it? :-o
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #4 on: January 02, 2011, 08:50:01 AM »

I wouldn't.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #5 on: January 02, 2011, 09:25:04 AM »
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #6 on: January 02, 2011, 11:35:10 AM »
The shortcuts to drawings can be deleted without issue. Just as can the shortcuts in C:\Documents and Settings\%username%\Recent
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #7 on: January 02, 2011, 12:19:21 PM »
Hi Guys,
Hope you all had a "Happy Holiday".
I guess I am just paranoid. I like to cover all my tracks (that I know of) on the company computer at the end of the day. Who knows, I might not feel like going back tomorrow.
I manually navigate to the folders and delete the contents. That includes internet cookies, Windows recent, temp, etc.
I have not had any problems deleting the contents of C:\Documents and Settings\MyName\Application Data\Autodesk\AutoCAD 2005\R16.1\enu\Recent unless a drawing has been moved or deleted.
I thought it would be nice to have a toolbar button for a lisp routine to clear the recent folder just before shutting down AutoCAD for the day.

bayoubuoy
If you were truly paranoid, you would simply be sure to NOT go anywhere or do anything you should NOT be doing at the office; even IF you were to use your very own laptop at the office.  I say this as some routers, and servers keep track of ALL internet activity that pass through them.  Just something to consider there whilst you try to cover your tracks.
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #8 on: January 02, 2011, 12:40:13 PM »
I manually navigate to the folders and delete the contents. I have not had any problems deleting the contents of C:\Documents and Settings\MyName\Application Data\Autodesk\AutoCAD 2005\R16.1\enu\Recent unless a drawing has been moved or deleted.
bayoubuoy

so you didn't want to delete the MRU list ??
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #9 on: January 02, 2011, 12:44:20 PM »

Quote
AutoCAD 2005\R16.1\enu\Recent

just noticed the version ... would have been really nice of you to say that at the start.

Can someone with 2005/2006 confirm if the MRU list is stored in the folder mentioned.

 :|
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #10 on: January 02, 2011, 12:48:05 PM »
Code: [Select]
C:\Documents and Settings\Alan\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Recent
and

Code: [Select]
C:\Documents and Settings\Alan\Application Data\Autodesk\AutoCAD 2006\R16.2\enu\Recent
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #11 on: January 02, 2011, 12:52:59 PM »
Yes Alan ... and I have this folder ...

Code: [Select]
C:\Users\kdub\AppData\Roaming\Autodesk\AutoCAD Mechanical 2011\R18.1\enu\Recentbut it does NOT contain the Most recently used drawing files list.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #12 on: January 02, 2011, 03:04:01 PM »
OH, then this?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #13 on: January 02, 2011, 04:47:00 PM »
The MRU is not stored in the \Recent folder in any of the versions that I have examined.

As a side note, the \Recent folder contains shortcuts to drawings that have been opened by the application and/or used as block storage. If you move, delete or rename the drawing that the shortcut points to, the next time you open a moved or renamed drawing, a new shortcut is created in that folder and the original one stays intact. This means that there may be shortcuts to nowhere numbering into the hundreds, if not thousands on systems where the user regularly copy, move or rename files. In fact, if the user has never cleared this folder but has used AutoCAD for some time, the number of phantom shortcuts possible become mindboggling.

Also, consider that upgrades to newer versions don't remove the recent folder, it is possible to have shortcuts that were created by versions as old as 2004 while using 2011 ... i.e. you could have 8 versions spanning 8 years of shortcuts for every drawing you ever opened, presuming you still have the same profile and/or computer.

It is the same as "My Recent Documents" in the menu. If you look at the recent documents menu item in XP for example, you might see 10 to 15 documents listed, however, if you browse to C:\Documents and Settings\%username%\Recent you will find many many more ... in my system alone, I show 15 in the recent documents list, but 261 shortcuts exist in the folder.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #14 on: January 02, 2011, 07:37:29 PM »
Just to clarify.

In Win7 64

Recent Documents list is drawn from the Shortcuts listed in
Code: [Select]
C:\Users\kdub\AppData\Roaming\Microsoft\Windows\RecentThis is a listing kept by Windows  and does hold some shortcut links to recently opened .dwg files

Then there is this :
 
Code: [Select]
C:\Users\kdub\AppData\Roaming\Autodesk\AutoCAD Mechanical 2011\R18.1\enu\Recentmaintained by my particular Autocad version.
The folder content looks like the attached piccy, and has no MRU list.


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #15 on: January 02, 2011, 10:48:22 PM »
The folder content looks like the attached piccy, and has no MRU list.

The MRU list is maintained in the registry, just as you pointed out in your first post
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #16 on: January 02, 2011, 11:02:28 PM »
It is now, but Alans post sems to indicate it was kept in a folder.


I'd be interested in knowing if that list matches the MRU list on the menu->File pulldown
.. I can't recall because of a selective memory.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #17 on: January 03, 2011, 12:26:59 AM »
I'll take a look tomorrow. Too late here.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #18 on: January 03, 2011, 08:59:34 AM »
This folder has most of the files listed in the MRU pull down menu but not all and some that are not listed:
C:\Documents and Settings\Alan\Application Data\Autodesk\AutoCAD 2006\R16.2\enu\Recent\Select File

The registry has the exact list.
When I run Kerry's routine the registry is cleared but the MRU in the file pull down remains un affected.
Shutting ACAD down & re start the registry list is restored with the list.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Lisp to delete AutoCAD Recent folder contents
« Reply #19 on: January 03, 2011, 12:28:20 PM »
The registry has the exact list.
When I run Kerry's routine the registry is cleared but the MRU in the file pull down remains un affected.
Shutting ACAD down & re start the registry list is restored with the list.

The MRU list in the registry is read when AutoCAD opens only. Once the menu is populated the registry isn't used again until AutoCAD closes, at which point, the MRU list is updated in the registry. This would mean that AutoCAD maintains the MRU list in the registry while it isn't running, but in the application while it is, only updating upon closing.

If you open multiple instances of AutoCAD and open different drawings in each, the MRU in each instance will be slightly different. Then as you close AutoCAD instances, the registry MRU is updated. The MRU in the last instance of AutoCAD to close will be the MRU that is displayed when AutoCAD is started again.

Some earlier versions of AutoCAD allowed multiple instances, I don't know if you can make the later ones open separate application windows.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie