From: adam beazley Date: 2005-12-31T00:52:38+09:00 Subject: Re: Directory and file listing thanks for your reply. Well I am almost there I just need a little more help to get me home. Here is the script so far, the trouble I am having now is with the while loop. -------------------------------------------- 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 while images <= maxnum m = materials.add "images[img_num]" m.texture=images[img_num] img_num += 1 end end So the while loop doesnt seem to be working at all and im not sure why. Please help. thanks -- Posted via http://www.ruby-forum.com/.