AO Container Cleanup tool
Every time your character receives (via trade with other players or when bought from a shop) a backpack, two new files will be created on your computer to hold the associated settings for the backpack. But even if the backpack later gets removed from your character (deleted, sold, traded to someone), those associated files won't.
Also, the game sometimes "decides" to abandon a previously used file in the prefs fileset for no apparent reason and creates a new instance of it under a different name. This can happen repeatedly every now and then, leaving you with several duplcates of the exact same file, of which only one is actually used.
Basically, the game keeps leaving a lot of garbage on your computer which it never bothers to clean up. Ever. Because of this, your Prefs folder constantly grows both in total file size and number of individual files (up to several thousands or more), which may cause a freeze when you access your bank in the game, and can make backing up and restoring your Prefs take quite some time because of the sheer number of files involved.
Using this tool once every few months (or more frequently if you often trade larger numbers of backpacks) on your characters to remove such unused files should keep the garbage level down.
Version history
v1.1 (2010-Jun-17)
- Grouped windows should no longer become ungrouped after cleanup
- The tool is now able to repair certain kinds of inconsistencies in the prefs fileset
- Fixed a potential issue which could've introduced non-critical inconsistencies to the prefs fileset in certain cases
v1.0 (2010-Jun-09)
Download
A few things we need to make clear first:
- The script reads, creates and modifies files and folders on your computer. If this is not OK with you, don't download it.
- I did my best to ensure that the script works as intended and it's safe to use in general. If you don't trust my programming skills, don't download it.
- Should the script fail in any way and with any consequences, I don't take responsibility for it. Consider yourself warned. If you can't accept this risk, don't download it.
Cleanup tool file: AO_CCleanup_Tool_v1.1.vbs
The tool is not a stand-alone executable but an MS Visual Basic script (a simple text file with a .vbs extension, containing the source code in readable form). It relies on the Windows Scripting Host (WSH) component built into most recent Windows operating systems to get executed straight from this source code state.
In general, it should run on any Windows from XP and up, 32/64 bit, provided you don't have the WSH component somehow disabled.
How to use
#0: Locate the Prefs folder (and make a backup)
- Completely exit the game
- Start the AO launcher, click "Settings", then select the "GUI" tab in the Settings window
- Click the "Open" button next to the "Skins" line in the "Folders" frame to open the custom GUI folder, then click "Cancel" in the AO Settings window
- Go one step up, where you should now see the "Prefs" folder; this will be your starting point for the cleanup process, it's the best to work with this window
Optional: Now that you are here, it might be a good idea to copy the entire "Prefs" folder to a different location as a backup, in case something fails.
#1: Prepare
The only viable way to tell if a container file is still in use is to look at its "last modified" date, which gets updated every time you use the associated backpack in the game. If it has not been updated in a while, then it may have become orphaned... Or you just havent't used it lately.
By default, the script considers container files older than 30 days as unused, and will remove them. If you are sure you've used all backpacks on the given character in the last 30 days, you can skip this part.
- Log in to the game with the character you want to perform the cleanup on.
- Open your Inventory, then open and close each and every backpack you have in it.
- Open your Bank and go through all the backpacks stored there: move them into your Inventory, open and close them, then move them back to your Bank. Important: Simply moving them out then back is not enough. You also have to open and close each of them.
- When you are sure you went through all your backpacks stored anywhere on the given character, log out of the game.
#2: Execute
When you are sure all the backpacks on the given character had been accessed in the last 30 days, you should be ready to perform the actual cleanup:
- Place a copy of the cleanup tool file into the "Prefs\<AccountName>\<CharId>" folder of the character you want to perform cleanup on.
- Double click on the cleanup tool file to execute it.
-
If everything checks out, you will get a message window telling you that the tool is ready to perform the cleanup. Click OK to continue.
If there's something wrong at this point, a message window informs you about what's the problem, and the tool exits.
- There is no progress indicator during the cleanup process, and it may need up to a minute to finish, depending on the number of files to be processed. Be patient, you'll get a notification when the cleanup is completed (or some error has occured and execution was aborted).
- Eventually, a message window should appear to tell you that the cleanup has been completed. Click OK to close it.
#3: Verify
After the tool has reported a successful cleanup, there are a few things left to check and do:
- Look into the "Prefs\<AccountName>\<CharId>" folder, where you should see an "old_Containers" and an "old_DockAreas" folder, as well as an "old_Prefs.xml" file. These are the backups from before the cleanup, in case you need them.
-
Log in to the game with the character you've performed the cleanup on and check a few windows and backpacks to see if they still open where they used to be, their view settings have not changed, and the custom names on backpacks are not lost.
If you see excessive changes in the things listed above, then something may have gone wrong during the cleanup. In this case, you can undo the cleanup attempt by restoring the previous fileset from the backup (see "Troubleshooting / The tool exited with a "Completed" message" section).
- If everything in the game looks and works as it should, then you should be safe to delete the backup folders and files ("old_Containers", "old_DockAreas" and "old_Prefs.xml").
To change the number of days after which a backpack is considered unused:
- Open the cleanup tool file with a plain text editor (eg. Notepad)
- Locate the line near the beginning of the script similar to this: Const cleanup_age = 30
- Change the number in this line to any value greater than zero
- Save and close the file
Troubleshooting
The tool exited with a message about not finding "Prefs.xml" or "DockAreas"
- You have tried to use the tool at an incorrect location.
- The tool needs to be located in the "Prefs\<AccountName>\<CharId>" folder of the character you want to perform the cleanup on.
The tool exited with some message about "old_" folders being present
- You have tried to use the tool on a character which had already been cleaned up recently.
- If you really want to perform the cleanup (again), delete the previous backups ("old_Containers", "old_DockAreas" and "old_Prefs.xml") first.
The tool exited with some message about "clean_" folders being present
- A previous cleanup attempt was aborted because of encountering some error.
- If you want to attempt the cleanup again, delete the temporary files and folders ("clean_Containers", "clean_DockAreas" and "clean_Prefs.xml").
- The previous cleanup attempt may have failed because of some file inconsistency, in which case it's very likely to fail again. This means that the prefs fileset of the given char is corrupt in some way and cleanup cannot be reliably performed on it.
The tool exited with a "Completed" message
- The prefs fileset of the given character should be cleaned up and ready for use.
- If you didn't encounter problems after logging in and checking your windows and backpacks, you can consider deleting the "old_Containers" and "old_DockAreas" folders as well as the "old_Prefs.xml" file.
- If you did encounter problems with your character after the cleanup, you can restore the previous fileset by deleting the current "Containers" and "DockAreas" folders, and the "Prefs.xml" file, then renaming the "old_Containers" and "old_DockAreas" folders and the "old_Prefs.xml" file respectively to "Containers", "DockAreas" and "Prefs.xml".
The tool exited with a "Fatal Error" message
- Some unrecoverable error occured during the cleanup attempt and the process had to be aborted.
- If any of the "clean_Containers" and "clean_DockAreas" folders or the "clean_Prefs.xml" is still present, you should delete them.
- If the "old_Containers" and "old_DockAreas" folders and the "old_Prefs.xml" file is present, they contain a backup of the previous fileset, while the current "Containers" and "DockAreas" folders and the "Prefs.xml" file may or may not be usable.
- You can restore the previous fileset by deleting the current "Containers" and "DockAreas" folders, and the "Prefs.xml" file, then renaming the "old_Containers" and "old_DockAreas" folders and the "old_Prefs.xml" file respectively to "Containers", "DockAreas" and "Prefs.xml".
The tool exited with some Visual Basic Script Error
-
Some critical internal or external error occured during the cleanup attempt which the tool itself was not prepared to handle, and the WSH runtime terminated the process.
Because this was a critical error resulting from something unexpected, or even from some coding error in the tool itself, there is no guarantee that any of the files and folders are in a condition they normally can expected to be.
Do not permanently delete or overwrite anything that you believe to be unneeded before making sure it actually isn't.
- If any of the "clean_Containers" and "clean_DockAreas" folders or the "clean_Prefs.xml" is present, you can delete them.
- If the "old_Containers" and "old_DockAreas" folders and the "old_Prefs.xml" file is present, they should contain a backup of the previous fileset, while the current "Containers" and "DockAreas" folders and the "Prefs.xml" file may or may not be usable.
- If the "old_" folders and files are present, you should be able to restore the previous fileset by deleting the current "Containers" and "DockAreas" folders, and the "Prefs.xml" file, then renaming the "old_Containers" and "old_DockAreas" folders and the "old_Prefs.xml" file respectively to "Containers", "DockAreas" and "Prefs.xml".