Solved

ghostscript silent install

Posted on 2010-09-13
3
1,982 Views
Last Modified: 2013-11-13
From the run dialog, the following works just as intended:
"D:\HPFFA Solution\HPF_Forms_Assistant Solution\HPF_Forms_Assistant Solution\HPF_Forms_Manager\setupgs.exe"  "%ProgramFiles%\gs"

The free ghostscript program is quietly installed on the user's machine.

However, when I use the code attached from within my vb.net winforms program (in debug mode), the installation program fails saying it cannot copy the gsdll32.dll file to the Program Files destination.     If I run "D:\HPFFA Solution\HPF_Forms_Assistant Solution\HPF_Forms_Assistant Solution\HPF_Forms_Manager\setupgs.exe"  "%ProgramFiles%\gs" while my winforms program is open, it still works as expected.

Any ideas, suggestions, would be greatly appreciated.

Public Function InstallGhostScript() As Boolean
        Dim retval As Boolean = True
        Dim str_base_dir As String = ""
        Dim inst_gs As Process = Nothing
        Dim str_run As String = ""

        Dim pinfo As ProcessStartInfo = Nothing

        Dim str_dest_dir As String = Nothing


        Try
            str_base_dir = System.AppDomain.CurrentDomain.BaseDirectory()
            str_run = str_base_dir & "setupgs.exe" & Space(1) & Chr(34) & "%ProgramFiles%\gs" & Chr(34)
            pinfo = New ProcessStartInfo
            pinfo.FileName = str_base_dir & "setupgs.exe"
            pinfo.WorkingDirectory = str_base_dir
            pinfo.Arguments = "%ProgramFiles%\gs"
            frm.Cursor = Cursors.WaitCursor
            ShowMessage("Please wait...installing conversion utility", MessageAlert.MyMessageType.information)
            Application.DoEvents()
            inst_gs = Process.Start(pinfo)
            inst_gs.WaitForExit()
            frm.Cursor = Cursors.Default

        Catch ex As Exception
            retval = False
            lex.Message = ex.Message


        Finally
            frm.Cursor = Cursors.Default

        End Try

        Return retval
    End Function

Open in new window

0
Comment
Question by:codefinger
  • 2
3 Comments
 
LVL 21

Expert Comment

by:chapmanjw
ID: 33664409
Have you tried this while running your application as Administrator?  (Right-click your executable, Run As Administrator)
0
 

Author Comment

by:codefinger
ID: 33665913
"Have you tried this while running your application as Administrator?  (Right-click your executable, Run As Administrator)"

Good suggestion,  so I tried it but it did not help.

0
 

Accepted Solution

by:
codefinger earned 0 total points
ID: 33666837
Never mind.  After Googling most of the day, I found another ghostscript install program that is a lot more straightforward, is silent, and works just the way I need it to.....


http://www.matthanson.ca/2009/08/silently-install-cutepdf-writer-and-ghostscript/

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This is about my first experience with programming Arduino.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now