|
|
#1 |
|
Junior Member
Join Date: Oct 2002
Posts: 46
|
Calling Function (?) from Main and Uninstall Sections
I use the function below to close my app before the File command in my script and before the Delete command in the unstaller. But I have to completely redefine the function for the uninstaller with a un. prefix, how can i get around this so that I only it defined once, thanks.
code: |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
You can put the function in a macro to save the time. For example:
code: NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Oct 2002
Posts: 46
|
Excellent worked perfectly!!!!
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jun 2004
Posts: 6
|
Indeed this is a good solution.
But why does NSIS unforce such a constraint ? It really complexify write utility function (used in installers as well as uninstaller) without this work-around. -- Nicolas |
|
|
|
|
|
#5 |
|
Member
Join Date: Jun 2006
Location: Paris - FR
Posts: 58
|
Hi,
Kichik, when using "function-in-a-macro" in a section i have errors so i ve found another way : i use "macro-in-a-function" ! like : PHP Code:
Call MyFunc / Call un.MyFunc |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
With kichik's code, you put:
!insertmacro DefineMyFunc "" !insertmacro DefineMyFunc "un." ...outside Sections and Functions. It will work fine then. -Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#7 |
|
Member
Join Date: Jun 2006
Location: Paris - FR
Posts: 58
|
This is surely my misusing of NSIS. I thought i had to place code !insertmacro where i need the code to execute. So in this case how do i call the macro in my section ?
|
|
|
|
|
|
#8 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
code: -Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|