Component Browser Alternative?

UI.inputbox does not give you any control. You could maybe hit the key (tab).

I’d prefer not to because it is sort of the point of all this to get down to as few keystrokes as possible.

Here is an htmldialog version that is getting closer…

require 'sketchup.rb'
module ZCode
module ZInsert

def self.z_insert()
    
    model_defs = Sketchup.active_model.definitions
    option_list = ""
    comp_defs =  []
    model_defs.each_with_index{|cdef,index|
        #print model_defs[index].hidden?
        if(!model_defs[index].hidden?) && (!model_defs[index].group?)
            option_list += "<option value='#{cdef}'>#{cdef.name}</option>"
            comp_defs.push(cdef)
        end
    }
    
    html_dialog = UI::HtmlDialog.new()
    html_dialog.center
    html = "
        <b>Select Component</b>
        <select id='sel' onchange='if(this.selectedIndex) sketchup.comp_selected(this.selectedIndex);'>
    "
    html += option_list
    html += "
    </select>
    "
    html_dialog.set_html(html)
    html_dialog.show
    
    html_dialog.add_action_callback("comp_selected") { |action_context, sel_index|
        Sketchup.active_model.place_component(comp_defs[sel_index], false)
        html_dialog.close
    }
    
end
    
end # end of module ZInsert
end # end of module ZCode

just need to figure out how to focus the select element onLoad.

I tried some of the stuff mentioned here:

https://forums.sketchup.com/t/how-to-pass-values-to-htmldialog/47968

to no avail.