Re: [shoes] Component not Located
- From:
- Roger Lovelock
- Date:
- 2011-07-14 @ 21:46
Many thanks for looking that up for me. Your example works OK for me,
but when I try to access a local file nothing happens (no error either).
The code I am using is as follows :-
pdf.Output('example2.pdf')
urlName = File.expand_path('example2.pdf')
alert urlName
visit "file:///" + urlName
The alert shows the correct full path to my pdf, which I can open
manually OK. I have tried with both Firefox and Internet Explorer as my
default browser with the same result. Am I doing something silly with
the URL - I have a feeling I am doing something basic wrong! Any help
much appreciated!
Roger
On 14/07/2011 10:15 PM, Steve Klabnik wrote:
>> Had a hunt through the manual with search with no success - when you have
>> time (no rush) could you please point me in the right direction - many
>> thanks!
> No worries! We're trying to improve Shoes' documentation, there are
> lots of little corners.
>
> Aaaand I found out what it is, and the manual is lying! It's 'visit':
>
> Shoes.app do
> visit "http://google.com"
> end
>
> That opens google in my browser.
>
>> The problem with the launchy gem may be related to my 'ignorance'. I
>> have downloaded the 'launchy gem' and tried it in various places (my apps
>> home directory, the shoes gem directory etc) - I may not have it in the
>> right place - or there may be more required to install it - I am just
>> working from references in the mailing list archive.
> Ah! You don't need to do all that! Here:
>
> Shoes.setup do
> gem "launchy"
> end
>
> Put that at the beginning of your code, and Shoes will download and
> install the gem for you.
>
> Unfortunately, when I try this, Shoes complains that it can't install
> the gem, because we are running too old a version of Rubygems. You can
> install older versions of gems by adding a gem "launchy", "0.0.1" or
> whatever.
>
> But in this case, visit should work for you, I think.
>
> -Steve
>
>
Re: [shoes] Component not Located
- From:
- ashbb
- Date:
- 2011-07-15 @ 12:29
Hi Roger,
Try out the following. ;-)
Shoes.app do
button 'open pdf' do
system '"C:/Program Files/Mozilla Firefox/firefox.exe" ./example.pdf'
end
end
ashbb
Re: [shoes] Component not Located
- From:
- Roger Lovelock
- Date:
- 2011-07-15 @ 21:50
Thanks ashbb - I'd already tried that and it worked fine as did a couple
of other variations such as :-
system("start example2.pdf")
and
shell = WIN32OLE.new('Shell.Application') # windows only!
shell.ShellExecute('example2.pdf')
The latter was better as it did not open a console window.
What I was trying to do was to find a way of opening the pdf which was
cross-platform ie I could distribute my software and have it work on any
OS etc it was installed on, hence my reason for playing with Launchy and
trying the 'visit' command to open my pdf.
Thanks
Roger
On 15/07/2011 10:29 PM, ashbb wrote:
> system '"C:/Program Files/Mozilla Firefox/firefox.exe" ./example.pdf'
Re: [shoes] Component not Located
- From:
- ashbb
- Date:
- 2011-07-15 @ 23:53
Oh, I see.
Thank you for sharing your work. I've learned a lot.
Let's continue enjoying Shoes. ;-)
ashbb
Re: [shoes] Component not Located
- From:
- Roger Lovelock
- Date:
- 2011-07-15 @ 23:58
Thanks - but I still haven't resolved my problem - can I open a local
pdf using visit?
On 16/07/2011 9:53 AM, ashbb wrote:
> Oh, I see.
> Thank you for sharing your work. I've learned a lot.
> Let's continue enjoying Shoes. ;-)
>
> ashbb
Re: [shoes] Component not Located
- From:
- ashbb
- Date:
- 2011-07-16 @ 01:57
Hi Roger,
> can I open a local pdf using visit?
Sorry, I think it's not possible.
Because Shoes only judges by the header 'http|https', not 'file://' for now.
ashbb
Re: [shoes] Component not Located
- From:
- Roger Lovelock
- Date:
- 2011-07-16 @ 06:55
OK - thanks for that.
On 16/07/2011 11:57 AM, ashbb wrote:
> Hi Roger,
>
> > can I open a local pdf using visit?
> Sorry, I think it's not possible.
> Because Shoes only judges by the header 'http|https', not 'file://'
> for now.
>
> ashbb
Re: [shoes] Component not Located
- From:
- Cecil Coupe
- Date:
- 2011-07-16 @ 08:09
Roger,
Instead of debugging all the ways Shoes visit and launchy won't work
(there are many edge cases for each that will fail) write a shoes
alert/window/dialog thingy that defaults to 'system (start ..)' for
Windows, 'system (open ...)' for OSX and for linux you can default to
system (gnome-open...) That covers 95% of the audience. Also allow the
user to browse for the App they want to use to open a .pdf and then
you've got 100%. Twenty lines of Shoes code?
Shoes is funny or liberating in that way. There is often a simple user
written GUI solution when you re-think about the problem in a different
way.
--Cecil
On Sat, 2011-07-16 at 16:55 +1000, Roger Lovelock wrote:
> OK - thanks for that.
>
> On 16/07/2011 11:57 AM, ashbb wrote:
> > Hi Roger,
> >
> > > can I open a local pdf using visit?
> > Sorry, I think it's not possible.
> > Because Shoes only judges by the header 'http|https', not 'file://'
> > for now.
> >
> > ashbb
Re: [shoes] Component not Located
- From:
- Roger Lovelock
- Date:
- 2011-07-16 @ 08:15
Thanks - I'll give that a go!
Roger
On 16/07/2011 6:09 PM, Cecil Coupe wrote:
> Roger,
>
> Instead of debugging all the ways Shoes visit and launchy won't work
> (there are many edge cases for each that will fail) write a shoes
> alert/window/dialog thingy that defaults to 'system (start ..)' for
> Windows, 'system (open ...)' for OSX and for linux you can default to
> system (gnome-open...) That covers 95% of the audience. Also allow the
> user to browse for the App they want to use to open a .pdf and then
> you've got 100%. Twenty lines of Shoes code?
>
> Shoes is funny or liberating in that way. There is often a simple user
> written GUI solution when you re-think about the problem in a different
> way.
>
> --Cecil
>
> On Sat, 2011-07-16 at 16:55 +1000, Roger Lovelock wrote:
>> OK - thanks for that.
>>
>> On 16/07/2011 11:57 AM, ashbb wrote:
>>> Hi Roger,
>>>
>>>> can I open a local pdf using visit?
>>> Sorry, I think it's not possible.
>>> Because Shoes only judges by the header 'http|https', not 'file://'
>>> for now.
>>>
>>> ashbb
>
>
>