From: adam beazley Date: 2005-12-31T01:06:16+09:00 Subject: Re: Directory and file listing Nevermind, I figured it out and the script works and it does exactly what I wanted it to do. Thank you so much everyone, I appreciate the support on this one. Here is the final code: #----------------------------------------------------------------------------- require 'sketchup.rb' #----------------------------------------------------------------------------- def materialimporter prompt = ["Directory Location"] value = [] results = inputbox prompt, value, "Directory" if (!results) #failure return else #success: you can extract values from the results array end directory = results.to_s Dir.chdir directory images=Dir["*.*"] [images].to_s maxnum = images.length img_num = 0 model = Sketchup.active_model materials = model.materials until img_num > maxnum m = materials.add images[img_num] m.texture=images[img_num] img_num += 1 end end if( not file_loaded?("massmaterialimporter.rb") ) # This will add a separator to the menu, but only once add_separator_to_menu("Plugins") plugins_menu = UI.menu("Plugins") plugins_menu.add_item("Import Materials") { materialimporter } end #----------------------------------------------------------------------------- file_loaded("massmaterialimporter.rb") So i only have one last question: I would like it if the name of the material could be brushedsteel instead of brushedsteel.jpg so how do I take off the file extension? thanks -- Posted via http://www.ruby-forum.com/.