The "first" part worked because the "Name:" was changed. The "second" part changed the "Definition Name:" which is apparently what you were looking for. So just ignore the first part.
My apologies, I forgot that SU8 doesn't accept multi-line input. But since you have Aerilius' console, you can save the snippet and recall and use it anytime you need it.
Be aware that, as written, the code expects the components to not be aligned with or along the "Y" axis. Otherwise, it should always work.