HOWTO: Maintain a common shared list of hidden ads and search results across your characters #299
DemonPriestessSahala
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Taken from a comment on #163
Problem
If you like to prune your in-client character search results or hidden-ad lists, but you spread your time across multiple characters, you'll quickly find that your lists are unsynchronized, you perform a lot of repeated manual work to hide the same results, and you spend more time trying to import between characters.
Solution
Fortunately, there are ways to merge the lists from all (or groups) of your characters into one common list, and then distribute that common list back to all (or groups) of your characters.
Note: this looks like an ominous wall of text. But, the actual process of merging, sorting, formatting, and exporting only takes about ten to twenty minutes to merge lists for twenty characters with an old version of Excel, and this is really only needed every few weeks or more.
As always, log out of F-Chat and close the program entirely before doing this. Back up before you do anything that involves manipulating these files. The batch file below will try to back up your existing list before it acts, but your data = your responsibility.
Collecting values
As a reminder, these exist at C:\Users\(your Windows username)\AppData\Roaming\fchat\data\(your character name)\settings\hiddenUsers. You can see the syntax in the comment above.
Both spreadsheet programs have a selectable option to choose comma-separated values. The text-to-columns operation produces a row with many, many cells.
Your values are now in a column, rather than a row. Feel free to delete the row.
Now your data should look like this:
Merging lists in Excel
There are several ways to merge and remove duplicates, depending on which version of Excel you have installed. Feel free to use your own method; here's one that should work for most.
Unless your version of Excel supports functions like TEXTJOIN, you may have to do this manually. In that case, copy all of the values from a column on the right and paste them at the end of the column to the left. Keyboard shortcuts are your friend.
For example:
becomes
This opens the Remove Duplicates window.
Excel removes any names that were common between characters, leaving you with a much shorter column of names.
Merging lists in Sheets
This process is MUCH easier and faster with an array formula, which is why the collection procedure had you put values into columns by character.
=SORT(UNIQUE({A:A;B:B}))
, where A and B are the columns full of values from your characters.Adapt or add to the range as required. For example, if you're using columns A, B, and C, the formula goes in D1 and your range becomes
A:A;B:B;C:C
.Sheets removes any names that were common between characters and sorts the list, leaving you with a much shorter column of names.
Working with raw values is necessary for the next part. Sheets leaves you with something that looks like this:
Put the combined list back into CSV format
Now you have to undo the earlier transposition, which isn't difficult at all.
Your values are now in a row again.
When they first come out of Excel or Sheets, your values are separated by tabs.
For Notepad, this is Edit > Replace. Since you cannot directly type a tab character, copy one from the pasted data and paste it into the Find what field. Put a single comma in the Replace with field.
becomes
Make a list of your character folders
The automation needs this list and you can reuse it later without more work.
Each character path should be on a separate line.
Your file contents should look like this:
If you want to maintain separate hide lists for groups of characters, just make more lists of character folders.
The batch file
Here's a handy batch file that takes (as command-line arguments) a list of character folders and a combined list of hidden users.
Pushing updates back to the characters
Now you can use the Windows command prompt (Start > search for "cmd") to work with the batch file:
Replace the filenames with whatever you saved earlier. The batch file syntax is:
ShareHiddenAdList.bat <list-of-characters> <common-list>
Many of you can already see what the batch file is doing. But here's the most important part of the output:
The first line is the batch file making a backup of your existing list, in case you need to roll back. The second line is the batch file copying the common list to each of your character folders, with the correct name.
The takeaway
After you do this the first time, you shouldn't need to touch the batch file again. If you make or delete characters, remember to update the folder list for next time. Then, all you need to do is make a new common hidden-character list every so often, and use the batch file to distribute it to your characters.
Now that I have my own list of character profile paths handy, I may write some VBA to automatically pull and reformat the existing lists for each character, then dump them together into a single spreadsheet, which is most of the manual work. In the meantime, if anyone would like to contribute an easier method of merging the lists, please feel free.
Enjoy!
Beta Was this translation helpful? Give feedback.
All reactions