The Disk Cleaner forum

Because I have a huge e-mail backlog

You are not logged in.

Announcement

Sep 8, 2009: Version 1.6.1273 (RC2) of Disk Cleaner for XP/Vista/Windows 7 available. Click here.

#1 2005-08-16 10:48

Robert
Authmin
From: NL
Registered: 2005-06-27
Posts: 229
Website

The plug-in How-To

How to create Disk Cleaner .dct plug-ins
----------------------------------------

v1.2 - 09/15/2009
v1.1 - 03/31/2004
v1.0 - 01/03/2004


0. About

This file is about how to create dct (Disk Cleaner Text) plug-ins. You can use these to
augment the cleaning capability of Disk Cleaner without programming, and makes it possible to
write plug-ins for programs that are not supported by Disk Cleaner (yet).


1. What you need

Well, next to Disk Cleaner 1.5.1 (or higher), the only thing you need is a text editor. Notepad will do
just fine.


2. Sections and Keywords

Each dct plug-in contains sections that instruct Disk Cleaner to remove registry items or
files on disk. Right now, there are only three available sections. These are 'info',
'registry' and 'files'.

2.1 The info section

The 'info' section is obligatory in every plug-in. The other two are optional. To start a
section, enclose it in square brackets, like [info]. The exact location of each section within
the file is of no importance, but it should start on a new line. In the [info] section, you
must specify two things, the Title of the plug-in and a Description. The description is shown
when a user clicks the ? button and then the plug-in (NB: in version 1.6 this has changed,
the description is now always displayed on the same line as the plug-in title).

An example looks like this:

Code:

[info]
Title=My plug-in title
Description=My first hand-made plug-in that currently does nothing...

Note that the keywords (Title, Description and Icon) as well as the section names are not case
sensitive (i.e. [Info] is the same as [INFO] or [infO]). Don't leave spaces between the '='.


2.2 The registry section

The registry section is started on a new line as well. The registry section does not have
keywords, but instead it is composed of items, each on a new line, that tell Disk Cleaner what
registry key or value to remove. Such a line looks like this:

ROOT_KEY|LIST_OF_SUBKEYS|VALUE

The ROOT_KEY can be HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE. HKEY_USERS or HKEY_CLASSES_ROOT.
The LIST_OF_SUBKEYS is the complete list of subkeys that lead to the final item, i.e. software
\microsoft\windows\current version\explorer. If you leave away '|VALUE' (note the pipe
symbol), the complete key is removed together with subkeys. If you do place a '|' after the
list of keys but you leave VALUE blank, Disk Cleaner considers the item to be the default
value that is related to that key (be careful not to leave a space then, or Disk Cleaner will
look for a value called ' '). Otherwise fill in the name of the value that Disk Cleaner should
remove. Examples:

Code:

[registry]
HKEY_CURRENT_USER|Software\Microsoft\Office\10.0\Access\Settings
HKEY_CURRENT_USER|Software\Microsoft\Office\10.0\PowerPoint\Recent File List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent File List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent Page List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent Web List
HKEY_CURRENT_USER|Software\Microsoft\Office\10.0\Excel\Recent Files
HKEY_CURRENT_USER|Software\Microsoft\Office\10.0\Word\Data|settings
HKEY_CURRENT_USER|Software\Microsoft\Office\9.0\Access\Settings
HKEY_CURRENT_USER|Software\Microsoft\Office\9.0\PowerPoint\Recent File List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent File List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent Page List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent Web List
HKEY_CURRENT_USER|Software\Microsoft\Office\9.0\Excel\Recent Files
HKEY_CURRENT_USER|Software\Microsoft\Office\9.0\Word\Data|settings

Do not add comments to the registry section, and do not leave blank lines in between the
items.

The total plug-in would now look like this:

Code:

[info]
Title=My plug-in title
Description=My first hand-made plug-in that currently looks a lot like an Office recent files 
cleaner:)

[registry]
HKEY_CURRENT_USER|Software\Microsoft\Office\10.0\Access\Settings
HKEY_CURRENT_USER|Software\Microsoft\Office\10.0\PowerPoint\Recent File List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent File List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent Page List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent Web List
HKEY_CURRENT_USER|Software\Microsoft\Office\10.0\Excel\Recent Files
HKEY_CURRENT_USER|Software\Microsoft\Office\10.0\Word\Data|settings
HKEY_CURRENT_USER|Software\Microsoft\Office\9.0\Access\Settings
HKEY_CURRENT_USER|Software\Microsoft\Office\9.0\PowerPoint\Recent File List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent File List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent Page List
HKEY_CURRENT_USER|Software\Microsoft\FrontPage\Explorer\FrontPage Explorer\Recent Web List
HKEY_CURRENT_USER|Software\Microsoft\Office\9.0\Excel\Recent Files
HKEY_CURRENT_USER|Software\Microsoft\Office\9.0\Word\Data|settings

2.3 The files section

The final section type is the files section. Start the section on a new line. Each line
following the [files] section is a path to a directory and a search mask, using the wildcards
that Windows supports. Example:

Code:

[files]
C:\My folder\*.junk

This will remove all files in the C:\My Folder folder ending on .junk. Again, do not leave
empty lines between items, and don't add comments in this section. If you also wish to scan
subfolders as well, add '/s' to the line. Example:

Code:

[files]
C:\My folder\*.junk /s

Note that also the subfolders are removed!

All options:

/s  - include and remove subfolders
/so - include and remove subfolders only (no files from base folder are removed)
/si - include base folder (also base folder is removed, if empty)


If you have some Windows experience, you know that not every machine is the same. For
instance, in my case Windows is installed in the C:\WinXP folder, but it could be E:\Windows
in your case. So what if you'd want to write a plug-in to remove files from the windows\temp
folder? You can instruct Disk Cleaner to look up the correct Windows folder for the machine it
is currently running on, by using a special construct in the path. This special construct is
%windir%. Example:

Code:

[files]
%windir%\Temp\*.* /s

This would remove all files from the Windows\Temp folder, including subfolders, regardless of
what the exact name and location of the Windows folder on your machine is. There are other
constructs like that. These are:

Construct            Typical example
---------            ---------------
%sysdir%         -    C:\Windows\System or C:\WinNT\System32
%appdata%         -    C:\Documents and Settings\robert\Application Data
%commonappdata%     -     C:\Documents and Settings\All Users\Application Data
%programfiles%         -    C:\Program Files
%commonprogramfiles%    -    C:\Program Files\Common Files
%drive%            -    All Hard disks


Moreover, any enviroment variable is expanded as well.

The %drive% construct is special. First, it is the only one that has a trailing backslash. The
other are without the trailing backslash, so you should have one there in the plug-in after
the construct (like the example, %windir%\Temp\*.*). Second, it will generate a list from the
given path that encompasses all the drives in your machine. Example:

Code:

[files]
%drive%*.chk

Will become (note that I did not add a trailing backslash to the %drive% construct):

C:\*.chk

When you have one disk. If have have three disks, it will become

C:\*.chk
D:\*.chk
E:\*.chk

By the way, I know that this trailing backslash versus no trailing backslash is confusing, and
it didn't have to be that way. Unfortunately I forgot to correct this and I already released
Disk Cleaner smile

3. Saving the plug-in

The text file you've created should be saved to the installation folder of Disk Cleaner, in the subfolder 'plug-ins'. Save the file and make sure that the extension is .dct! Otherwise Disk Cleaner will simply skip your plug-in. Also note that you can open all the already present .dct files in this folder with notepad, to see more examples.

4. Ending

Well, this is all there is to it. Of course, you are welcome to give your comment on this or
to ask questions. Please use this forum for that.


A bug or not a bug, that's the question

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson