Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > windows gs detection

Reply
Thread Tools

windows gs detection

 
 
Martin DeMello
Guest
Posts: n/a
 
      08-21-2004
Is there a nice way under windows to determine if the user has
ghostscript installed? Do I have to rely on his having it in his path?

martin
 
Reply With Quote
 
 
 
 
Shashank Date
Guest
Posts: n/a
 
      08-21-2004
Hi Martin,

"Martin DeMello" <(E-Mail Removed)> wrote in message

> Is there a nice way under windows to determine if the user has
> ghostscript installed?


Searching for the registry is one way to do it ... see attached
screen-shot of how it looks on my machine. Of course, you would
want to determine this programmatically, right? Hint: You will have
to require 'win32/registry.rb'

> Do I have to rely on his having it in his path?


Well, path will tell you that gswin32.exe is available as a command
without requiring explicit full path-name. It does not prove the
existence (or lack thereof) of the software.

> martin


HTH,
-- shanko
PS> I am curious to know how your postscript generation is coming
along .. are you also generating PDFs?




 
Reply With Quote
 
 
 
 
Martin DeMello
Guest
Posts: n/a
 
      08-22-2004
Shashank Date <(E-Mail Removed)> wrote:
> Hi Martin,
>
> "Martin DeMello" <(E-Mail Removed)> wrote in message
>
> > Is there a nice way under windows to determine if the user has
> > ghostscript installed?

>
> Searching for the registry is one way to do it ... see attached
> screen-shot of how it looks on my machine. Of course, you would
> want to determine this programmatically, right? Hint: You will have
> to require 'win32/registry.rb'


Thanks, I'll dig into that. Is it guaranteed that ghostscript will make
a registry entry when it's installed, do you know? I'm optimistic about
this because cutepdf
[http://www.acrosoftware.com/Products...DF/writer.asp] says it'll
autodetect a ghostscript installation; I just didn't know how it was
done.

> > Do I have to rely on his having it in his path?

>
> Well, path will tell you that gswin32.exe is available as a command
> without requiring explicit full path-name. It does not prove the
> existence (or lack thereof) of the software.


I don't get this bit. What I meant was, need a solution depend on gs
being in the path, and test directly if I can run ps2pdf or if it
returns an error.

> > martin

>
> HTH,
> -- shanko
> PS> I am curious to know how your postscript generation is coming
> along .. are you also generating PDFs?


Coming along very nicely, and yes, it's doing pdfs too (once I figured
out I had to call "ps2pdf.bat" rather than "p2spdf"). Right now it relies
on the fact that both ps2pdf.bat and gswin32.exe are in my path, which
from the point of view of a non-techie user is suboptimal; I'm looking
into autodetecting the ghostscript install and adding it to ENV['PATH']
before calling system().

You can see the code and sample output at http://zem.novylen.net/ruby

martin

 
Reply With Quote
 
Shashank Date
Guest
Posts: n/a
 
      08-22-2004
Hi Martin,

"Martin DeMello" <(E-Mail Removed)> wrote in message
> Thanks, I'll dig into that. Is it guaranteed that ghostscript will make
> a registry entry when it's installed, do you know?


Assuming that the installation procedures get properly executed,
yes, I am reasonably sure that the registry entry will be there.

> I'm optimistic about this because cutepdf
> [http://www.acrosoftware.com/Products...DF/writer.asp]
> says it'll autodetect a ghostscript installation; I just didn't know how

it was
> done.


Don't know how they do it but thanks for the link. Will check it out.

> > > Do I have to rely on his having it in his path?

> >
> > Well, path will tell you that gswin32.exe is available as a command
> > without requiring explicit full path-name. It does not prove the
> > existence (or lack thereof) of the software.


I meant that the installation does not seem to add the component to
the path so the end-user has to do it manually. And any time there is
manual intervention, things be messed up

So, in my case, for example I have installed GS but did not add it to
the path. OTOH, you may add it to the path and then uninstall GS.
Relying on the PATH environment variable will be risky.

> I don't get this bit. What I meant was, need a solution depend on gs
> being in the path, and test directly if I can run ps2pdf or if it
> returns an error.


Again, if you run ps2pdf and the test comes back with error it does
NOT imply that the s/w is not installed.

Hope I'm not missing the point.

> > > martin

> >
> > HTH,
> > -- shanko
> > PS> I am curious to know how your postscript generation is coming
> > along .. are you also generating PDFs?

>
> Coming along very nicely, and yes, it's doing pdfs too (once I figured
> out I had to call "ps2pdf.bat" rather than "p2spdf"). Right now it relies

^^^^^^^^^
He he, saw your tip on this a while back

> on the fact that both ps2pdf.bat and gswin32.exe are in my path, which
> from the point of view of a non-techie user is suboptimal; I'm looking
> into autodetecting the ghostscript install and adding it to ENV['PATH']
> before calling system().


Then registry is the way to go ... but still "guaranteed" is too strong a
word.

> You can see the code and sample output at http://zem.novylen.net/ruby


Cool ! Thanks will check it out.

> martin

-- shanko
PS> Did not know your IITB (sorry IITM) lineage


 
Reply With Quote
 
Martin DeMello
Guest
Posts: n/a
 
      08-22-2004
Shashank Date <(E-Mail Removed)> wrote:
>
> Again, if you run ps2pdf and the test comes back with error it does
> NOT imply that the s/w is not installed.
>
> Hope I'm not missing the point.


No, I was the one who missed the point. I wasn't sure if the registry
thing was guaranteed, and it seemed then that the only perfectly sure
way was (i) to require it in the path and (ii) to test that I could
actually call it.

> PS> Did not know your IITB (sorry IITM) lineage


Which year?

martin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
detection process in windows xp, vista, seven. Beusse Beusse Ruby 3 01-23-2011 05:54 PM
Best way to create clean Windows XP boot cd for running rootkit detection pamelafiischer@yahoo.com Computer Support 18 11-23-2005 11:19 PM
Windows XP SCSI detection Chris Computer Support 4 08-22-2005 08:01 PM
BT Voyager 2100 Detection Problems itsmattyboy Wireless Networking 0 06-08-2005 07:23 PM
comment faire une détection de niveau haut ou "1" en vhdl ? Arnaud VHDL 2 02-11-2004 06:34 PM



Advertisments