JoeSchmoe wrote:Heya, I think this program looks great. I love that it's open source and I've been keeping my eyes out for an open source Launchy replacement now that Launchy isn't being updated. I've got some feedback that I'd love to give, but, first, would you mind either adding some more comments to Fuzzy()? In particular it would help if you could document what arr contains and what its structure is.
Fuzzy seems super important because the killer feature for a launcher is having the thing that you are looking for pop to the top of the list.
Also, how does Columbus incorporate the history of which options have been chosen in the past into its sorting algorithm?
Hi, and thanks :]
I could sure add some comments to the Fuzzy function, but if you want to use the function for something else you can just ask me to explain it, as I'll be able to answer specific questions. The arr parameter is just a simple array, and the input parameter is just the input. It returns a 2D array with item names, and properties of each item. The priority of the properties are from lowest to highest:
score: The "score", I don't remember how this is calculated.. it's actually a penalty so a list would be sorted from low score to high score.
contains: Whether the input is found inside the item name.
outline: Whether the input matches the first character of each word (for example, "ksp" matches with "Kerbal Space Program", "mw" matches with "Microsoft Word")
start: Whether the input is found to be the first character(s) of one of the words in the item name.
The Fuzzy function returns the list, fully ordered. So using the function would just be like:
Code: Select all
LV_Delete() ; clear the listview
for a, b in Fuzzy(input, arr) ; get the ordered list, according to the input
LV_Add(, b.name) ; add the items in order to the listview
It's worth noticing that the function uses some of my custom string base functions (or references), so it might need some tweaking before being compatible with a new script.
The times a program has been launched is saved by the program, but it is not directly incorporated into the Fuzzy function. It is just added as a coloumn in the listview which is hidden from the user. It does also not matter when the user is searching, it is only when the input is empty that the most launched programs are sorted to the top. I have thought of adding some type of "weight" to the items if they haven't been launched in some time, so that after some time of not being launched it won't stick at the top just because it was used heavily for some time. I have not got around to this and I'm not 100% sure how to make this work smoothly.