Solved

ghostscript silent install

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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 …
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 …

947 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

23 Experts available now in Live!

Get 1:1 Help Now