Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   File and Product Version From File info (http://forums.winamp.com/showthread.php?t=304719)

I_Need_help2 28th March 2009 16:20

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?

Animaether 28th March 2009 16:58

no?

code:

!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):
code:

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

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


I_Need_help2 28th March 2009 20:04

thank you

I_Need_help2 29th March 2009 11:05

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

Comperio 29th March 2009 16:20

You should just be able to unpack the file to a temp location (like $PLUGINSDIR or $TEMP):
code:
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


Afrow UK 29th March 2009 16:24

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

I_Need_help2 29th March 2009 16:35

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.


All times are GMT. The time now is 17:44.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.