# Shoes GUI question - downloading body of sites using Ruby

**URL:** <https://www.ruby-forum.com/t/shoes-gui-question-downloading-body-of-sites-using-ruby/150738>\
**Category:** Ruby\
**Created:** [October 12, 2008, 8:55am UTC](https://www.ruby-forum.com/t/shoes-gui-question-downloading-body-of-sites-using-ruby/150738 "2008-10-12T08:55:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![doubleminus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@doubleminus](https://www.ruby-forum.com/u/doubleminus)\
**Post date:** [October 12, 2008, 8:55am UTC](https://www.ruby-forum.com/t/shoes-gui-question-downloading-body-of-sites-using-ruby/150738/1 "2008-10-12T08:55:26Z")

</div>

Hi all,

I want to use shoes to be able to download the body of a website that a  
user enters in an edit\_line. How can I make this work? Can anyone help  
explain why the below code does not work? It just pops up a new window,  
and does not download the site from the text entered…

Here’s my code thus far:

```
Shoes.app do
  stack (:left => 175, :top => 200) do
    para "Enter a url:"
    flow do
      @url = edit_line
      button "OK" do

    window do
        stack do
         title "Searching site", :size => 16
          @status = para "One moment..."
           # Search site for query and print body
            download @url.text do |site|
              @status.text = "Body: " + site.response.body.inspect
           end
        end
      end
    end
  end
end

```

end

---

<div class="post-metadata">

**Author:** ![doubleminus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/5daacb/32.png) [@doubleminus](https://www.ruby-forum.com/u/doubleminus)\
**Post date:** [October 13, 2008, 6:10am UTC](https://www.ruby-forum.com/t/shoes-gui-question-downloading-body-of-sites-using-ruby/150738/2 "2008-10-13T06:10:31Z")

</div>

On Sun, Oct 12, 2008 at 03:52:58PM +0900, Double M. wrote:

> I want to use shoes to be able to download the body of a website that a  
> user enters in an edit\_line. How can I make this work?

You’re very, very close. The problem is that instance variables  
aren’t shared between windows. You can use a normal variable `url`  
or, if you really need to use an instance variable, you can use  
`owner.instance_variable_get("@url")` to get to it.

A good section to read in the docs is the “Block Redirection”  
stuff, basically the first two sections on this page:  
[http://help.shoooes.net/Rules.html](http://help.shoooes.net/Rules.html)

\_why
