1. Konrad Kaltenbach
  2. PowerBuilder
  3. Monday, 28 June 2021 09:40 AM UTC

Dear Experts,

I want to get the file version and the product version (Major, Minor, Build, Revision) of the application built by PowerBuilder and date and time when it was built.

How do I get these informations with PowerScript functions?

In VisualBasic.NET e. g. it's possible get them in the following way in a string:

Dim fi_EXE As New FileInfo(Application.ExecutablePath)
Dim str_VersionDate As String = Application.ProductVersion & " (" & fiEXE.LastWriteTime.ToString & ")".

 

Regards,
Konrad Kaltenbach

Attachments (1)
Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 28 June 2021 11:04 AM UTC
  2. PowerBuilder
  3. # Permalink

have a look at the Environment object and the GetEnvironment() function.

If you still need more information you could consider using:

the ns_osversion object, which I've attached in exported code.

regards

Attachments (1)
Comment
  1. Miguel Leeuwe
  2. Tuesday, 29 June 2021 08:13 AM UTC
Glad to hear that Konrad.

I'm not sure if that also allows you to get the file date, but if not (and using the pfc classes), you can have a look at the "pfc_n_cst_filesrvunicode" or use another very useful object provided on Roland's website: "n_filesys": https://www.topwizprogramming.com/freecode_filesys.html

regards

  1. Helpful
  1. Konrad Kaltenbach
  2. Tuesday, 6 July 2021 14:49 PM UTC
Hi Miguel,

thank you for the hints! Indeed I didn't get the file date using n_osversion. But I managed it writing a class in VB.NET with with an apropriate method, see below. The pfc classes I am not knowing yet.

Regards,

Konrad
  1. Helpful
  1. Miguel Leeuwe
  2. Tuesday, 6 July 2021 15:08 PM UTC
Great! it doesn't matter which way you get it, as long as you get the information!

regards

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 28 June 2021 15:26 PM UTC
  2. PowerBuilder
  3. # 1

Hi Konrad;

  FYI: My framework grabs many aspects of the PB Application and logs these as part of it's "System to System" checking at App start-up. If you are interested, I can point you to the location of the code in the framework and you are moist welcome to grab any code that you need for your App's use as the framework is open source and free. Here are two examples:

IDE:

EXE:

HTH

Regards ... Chris

Comment
  1. Konrad Kaltenbach
  2. Tuesday, 6 July 2021 14:53 PM UTC
Hi Chris,

thank you very much for your kind offer! But for the moment I have managed to get what I wanted to get as you can see.

Regards,

Konrad
  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 6 July 2021 17:40 PM UTC
That is awesome Konrad ... excellent news! :-)
  1. Helpful
There are no comments made yet.
Konrad Kaltenbach Accepted Answer Pending Moderation
  1. Tuesday, 6 July 2021 14:41 PM UTC
  2. PowerBuilder
  3. # 2

For getting the file date(s) I wrote the following class in VB.NET (using VisualStudio), made a DLL of it and imported it using Tools>.NET DLL Importer in PowerBuilder 2019 R2:

"Imports System.IO 'File Class
Public Class CHilfsfunktionen

  Public Shared Function FileVersion(ByVal Path As String) As String(,)
        FileVersion = Nothing
        Dim fi As FileInfo = Nothing

        If Not File.Exists(Path) Then Return Nothing
        Try
            fi = New FileInfo(Path)

            FileVersion = {{"Directory", fi.Directory.FullName},
                           {"Full Name", fi.FullName},
                           {"Name", fi.Name},
                           {"Creation Time", fi.CreationTime.ToString},
                           {"Last Write Time", fi.LastWriteTime.ToString},
                           {"Last Access Time", fi.LastAccessTime.ToString}
            }
        Catch ex As Exception
            FileVersion = {{"Exception", ex.Message}}
        End Try

    End Function

End Class".

In my PowerScript script I could access the file dates afterwards the following way:

Application              gnv_thisApp
string                    gs_ThisAppPath
string                    lsm_exe[]
nvo_chilfsfunktionen nvo_help

gnv_thisApp      = GetApplication ()
gs_ThisAppPath = getcurrentdirectory () + "\" + gnv_thisApp.appname

nvo_help = Create  nvo_chilfsfunktionen
lsm_exe  = nvo_help.of_fileversion( gs_thisAppPath + ".exe" )


messagebox("", lsm_exe[4] + ": " + lsm_exe[10] + "~n" + &
                      lsm_exe[5] + ": " + lsm_exe[11] + "~n" + &
                      lsm_exe[6] + ": " + lsm_exe[12])

Attachments (1)
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.