MFL : Scene name search

I made this patch to perform keyword based search in the names of the scenes of a liveset and select the first scene containing that keyword. I came with something that seems to work but I’m pretty new to max and this live api stuff. If such a device can appeal to you, can you please test it and, for those who know this kind of stuff, can you please comment on mistakes or possible improvements. I struggled to make this one and would like to start on solid ground !
Thanks !

-- Pasted Max Patch, click to expand. --

Copy all of the following text. Then, in Max, select New From Clipboard.

I am aware that this js doesn’t do as thorough a search as your max implementation (e.g. no regex replacements of underscores/dashes into spaces), but I really wanted to demonstrate how much more succinct the API iteration side of things can be…

Thanks WillyC, This looks pretty concise ! But I don’t know anything about Javascript. What should I do with these lines of code ? I tried to paste them in a text editor but it didn’t let me save it with a .js extension.

There’s a strange behaviour with this and I can’t understand why : after making a search, if I copy / paste or duplicate scenes, the second time I do one of these actions, the device selects back the scene I previously searched. I looked at the patch but can’t understand why. So I thought maybe this could be a bug in the api, even if I know I just start working with live.api. Can somenone please confirm this, and maybe tell me where this comes from ? You can DL it here : http://www.maxforlive.com/library/device.php?id=1281.