Archive: File and Product Version From File info


File and Product Version From File info
Hi
I would Like to get the Product Name and version from the Exe File and use this information on the welcome screen.

I have tried MoreInfo plug in and can get it to work if run from with in a Section but if I place i call it from a function all the values are blank.

I want to just set the file name and location and it pick up the product name version etc automaticaly thus I would only need to change one line each time I need to build an installer!

Any idea why I can only use MoreInfo after the welcome screen in a section?


no?


!addplugindir "."
!addincludedir "."

!include "nsDialogs.nsh"
!include "winmessages.nsh"
!include "logiclib.nsh"

; !include "MUI2.nsh"

OutFile "test.exe"

Function .onInit
InitPluginsDir
MoreInfo::GetFileDescription "$SYSDIR\rundll32.exe"
Pop $0
MoreInfo::GetFileVersion "$SYSDIR\rundll32.exe"
Pop $1
MessageBox MB_OK "[$0]$\r$\n[$1]"
FunctionEnd

Section
SectionEnd


Results in (on this machine):

---------------------------
Name Setup
---------------------------
[Run a DLL as an App]

[5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)]
---------------------------
OK
---------------------------

thank you


OK It was / is working but only when I run it from inside HM NSIS!

I think the problem is that the file I want to use to get the information from is the the main file I'm delivering, so at the welcome screen it's still in the package!

can I use the moreinfo to get file info from the file to be delivered while still in the package so I can show the info on the welcome screen? Or is there a way of getting the info at compile time and saving it to be used during installation?

thanks


You should just be able to unpack the file to a temp location (like $PLUGINSDIR or $TEMP):

Function .onInit
InitPluginsDir
File "/oname=$PLUGINSDIR\somefile.dll" somefile.dll
MoreInfo::GetFileDescription "$PLUGINSDIR\somefile.dll"
Pop $0
MoreInfo::GetFileVersion "$PLUGINSDIR\somefile.dll"
Pop $1
MessageBox MB_OK "[$0]$\r$\n[$1]"
FunctionEnd

If it's the file you are packing then you should be getting version information from it at compile time, not at run time.

http://nsis.sourceforge.net/Invoking...n_compile-time

Stu


thanks Stu I will look into this.

Currently I have got around this by extracting it to the plugin folder so it gets auto deleted again and then reading its values from there.