![]() |
#1 |
Member
Join Date: Apr 2005
Posts: 57
|
outsourcing functions to own "units" ?
Hi!
is there any documentation about outsourcing my own functions to external "units"? i would like to use some functions in different projects, so it would be nice to write them in one "unit" and include it to the different projects. possible? didn't find anything about that in this forum or help / readmes. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
|
If you mean parts of code writen in NSIS then you can use .nsh -file (NSIS header file). Put your functions in it and add this file to your script with !include command.
|
![]() |
![]() |
![]() |
#3 |
Member
Join Date: Apr 2005
Posts: 57
|
yes, that's what i mean. sounds easy. i'll try.
|
![]() |
![]() |
![]() |
#4 |
Member
Join Date: Apr 2005
Posts: 57
|
today i continued to work on my script and i got a strange error, when i try to work with functions in external nsh files:
!include: closed: "C:\Programme\NSIS\Include\CustFunctions.nsh" Processed 1 file, writing output: Error: invalid script: never had OutFile command Error - aborting creation process ...i copied a function from my mainscript and saved it in a nsh-file (included Function/FunctionEnd. - nothing else above or below). when i comment the line !include "CustFunctions.nsh" and the function i copied is still in my mainscript everything works fine. But when i comment the function and activate the !include-line, i got that outfile-error. my include line follows the !include "mui.nsh" - line. What am i doing wrong? Anybody got an idea? |
![]() |
![]() |
![]() |
#5 |
Guest
Posts: n/a
|
this should not work:
code: try this instead: code: The call to the functions on the included file can be done as ordinary. And review the documentation this is explained there. regards. |
![]() |
![]() |
#6 | |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Quote:
The error is there... You're missing the OutFile command. -Stu |
|
![]() |
![]() |
![]() |
#7 |
Member
Join Date: Apr 2005
Posts: 57
|
you got it afrow =) it's the error-message, not my sourcecode
but the error-message doesn't make any sense imho. i got the outfile command in my mainscript....and if i don't use that function of my nsh-file, but exactly the same of my mainscript, it works. i am not sure, but i think it already worked with the outsourced code on last friday and i didn't change any code since that day. could it be caused by some changes in preferences or something like that? tomorrow i will look into it more exactly. |
![]() |
![]() |
![]() |
#8 |
Major Dude
|
the out file command should be close to the beginning of the script.
any function should be after it i think. hand by comm@nder21 ---------- WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility |
![]() |
![]() |
![]() |
#9 |
Member
Join Date: Apr 2005
Posts: 57
|
well, i'm a bit confused, but now it works again. i just set the outfile-command to some different places. the order was var-lines, !include-lines, outfile-line. then i set the outfile-line above the !include-lines and compiled the script. i just got a few zeroing-code-warnings (why? no idea). then i saved both scripts and opened them again. suddenly they were working. after that i set the lines to their old positions and it still works...
sounds like a nsis-bug...but i'm not sure...maybe i overlooked something... (sry, if my english is kinda bad - just overlook ![]() |
![]() |
![]() |
![]() |
#10 |
Member
Join Date: Apr 2005
Posts: 57
|
i found out the cause of that problem. i try to subcribe. last week i tried to add another function (not that one i'm talkin about above) from my mainscript (there it was working correct) to my secondary-script. apparently i got an error (maybe the same) that day, deleted the function, added it back to my mainsript and stopped working. with the second function in the secondary-script i must have temporary made some chaos in nsis and nothing worked, though the function was in my main-script again. the second function is:
Function "FillLbl" ;keine Rückgabe FindWindow $2 "#32770" "" $HWNDPARENT GetDlgItem $2 $2 $1 CreateFont $3 "Arial" 8 0 SendMessage $2 ${WM_SETFONT} $3 0 SendMessage $2 ${WM_SETTEXT} 0 "STR:$0" FunctionEnd i think the exchange of the variables could be the problem....no idea... |
![]() |
![]() |
![]() |
#11 |
Junior Member
Join Date: Jul 2020
Posts: 1
|
RE: outsourcing functions to own "units" ?
I will start off by apologizing if this isn't the right location for this post. I tried to search for similar topics, but couldn't find anything for my specific questions and then I found this. I don't know why but I keep on getting error in this. I've put the out file command close to the beginning of the script and still got an error.
|
![]() |
![]() |
![]() |
#12 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,358
|
...and the error message is?
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|