From: Ben Giddings Date: 2007-10-17T10:33:00+09:00 Subject: Re: Mind giving a little help? On Oct 16, 2007, at 19:56, Tj Superfly wrote: > Goal: To have a program that will ask me what I'd like to search for > (news images or captions - and then more, but we'll stick with > those for > now) and then pull this list of image URLs from a notepad file. In the > notepad, each URL is on one line. The program then checks to see if > the > each URL from the list is 'real' or not (meaning it's uploaded and you > don't get an Error 404). When the program finds an image that is > 'real' > I want it to put out that particular image URL the give me the > option to > delete or keep it in the file If I understand correctly the goal is to maintain a list of URLs that don't work, so you want to remove working ones from the list. By "notepad" here I'm guessing you just mean a text file that you can edit using notepad, not some kind of OLE interaction with Windows Notepad. I think the best way to do this is to use two files, using one as the source of URLs and the other as the destination, then at the end, if desired, to move the new file over the old one. So the basic process would be. File.open("urls_checked.txt", "w") do |out| File.foreach("urls.txt") do |url| if url_exists?(url) if user_wants_to_save?(url) out.puts url end else out.puts url end end end FileUtils.mv("urls_checked.txt", "urls.txt") url_exists can come from the code from the other day, "user_wants_to_save?" can be whatever you like, a TK dialog box or something simply reading $stdin.gets and seeing if it's a 'y' or a 'n'. Ben