Sort Custom Content (CC) in CAS Alphabetically

2,069 Downloads 57 Thanks  Thanks 38 Favourited 18,515 Views
Uploaded: 19th Nov 2020 at 5:22 PM
Updated: 19th Jan 2021 at 12:26 PM
This is made for a 1920x1080 resolution, and taskbar at the bottom of the screen. Feel free to modify it for any other (you'll need the images + all coordinates), as I can't do that on my end.
This is an AHK script that will make your CC appear in CAS by the filename order, automating the use of S4CAS Tools v3 by CmarNYC.
So I recommend sorting your CC into multiple folders, as there's little point in sorting certain things, like accessories (unless you have a lot of them).
You could sort everything in one go, but I recommend at least separating your CAS CC into: Hair, Clothes (Top + Full + Bottom can be in 1 folder), Accessories.
Subfolders will no longer be sorted, as that created some mess in file order in the previous version.

This process will take quite a while, but should no longer require user supervision after the first file or two.

Installation and use:
- Sort your CC into folders and rename any files that aren't in the order you want them to be in (you can use Sims4Studio to preview the files).
- Download and install CmarNYC's S4 CAS Tools (here) and configure its game paths.
- Download and instal AutoHotKey (here).
1. Download and extract to some folder.
2. Edit SortCAS.ahk (right click it), and make the ending of "folderPath" point to the folder you want to sort. Make S4CASToolsPath point to your S4CASTools.exe.
3. Run SortCAS.ahk. F9 will pause the script in case of emergency, but pausing is not recommended as it can throw off the flow.

If something went too wrong, or you're out of time: F9 to exit + editing the SortCAS.ahk will allow you to continue from a specific file.

I'm not 100% sure if it can handle the 'value does not match' error, as I was not able to reproduce it (because I fixed those files). If you get this error, please send me a fullscreen screenshot (.png or .bmp).
Critical errors come from ancient CC or CC errors, they require a restart of S4CAS Tools before continuing (the script will do it now). Files that throw critical errors have to be edited with a different tool (like s4se), or ignored.
Merged packages often rely on the sorting order, and therefore shouldn't be sorted with this tool. It wouldn't be very effective even if it worked.

Additional Credits:
CmarNYC for his tools.

- The tool will now keep a log of which files were sorted in each folder, allowing you to skip those files up to 5 times when sorting the same folder again. More than 5 times won't be as accurate, unless you're only adding files to the very bottom of the list (alphabetical bottom of the folder).
- Some computers have issues with AHK coordinates, added various changes that should deal with those issues. If it still doesn't work, make sure everything is ran on screen 1 if using multiple screens.
- Added progress bar. Will open S4CAS Tools on its own now. 10/10 wow.
- Improved sorting, there was a problem in the previous version that placed special symbols (like []) at the bottom.
- To fix the above, had to remove subdirectory sorting (it was a bit bad anyway). Now subdirectories are ignored.
- Improved script speed. Will take slightly longer to detect errors more accurately, but deal with it a lot quicker if there is one.
- Script should deal with missing mesh warnings quicker, and will handle Critical errors properly (restart and continue).
- Critical error files will be tracked to a list, and prompt user to move them to a subfolder for a more convenient manual fixing.