Solved

ghostscript silent install

Posted on 2010-09-13
3
1,991 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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…

803 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