Solved

ghostscript silent install

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

685 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