Uploaded v0.6 with the new $ArrayErr (stack) error support. Use !define ArrayErrorMsgBox to use the old school error message boxes.
-Stu
NSISArray plugin
147 posts
Afrow,
Just found another bug. In your header in the macro 'Array_Delete', you are undefining ${ArrayObj}.
Since ${ArrayObj} is used goblaly (meaning that more than one array can use it), it will cause the compiler to crash when you need to undefine more than one array.
(The reason I spotted it was becuase I happend to be using 2 arrays in my installation.)
Just found another bug. In your header in the macro 'Array_Delete', you are undefining ${ArrayObj}.
Since ${ArrayObj} is used goblaly (meaning that more than one array can use it), it will cause the compiler to crash when you need to undefine more than one array.
(The reason I spotted it was becuase I happend to be using 2 arrays in my installation.)
For some reason I missed out the new header file which adds support for the ArrayErrorMsgBox define (and fixes that problem you've mentioned).
-Stu
-Stu
Another issue I'm still looking into, but perhaps you could guide me:
I've noticed that NSISArray.dll is not being removed from the plugins directory. I'm using 2 arrays and I'm deleting both using the ${arrayName->delete} command in my last (hidden) section.
Should I be placing this command somewhere else (like in .onInstSuccess)? Is there another command/procedure I should be using?
I've noticed that NSISArray.dll is not being removed from the plugins directory. I'm using 2 arrays and I'm deleting both using the ${arrayName->delete} command in my last (hidden) section.
Should I be placing this command somewhere else (like in .onInstSuccess)? Is there another command/procedure I should be using?
I'll have a look. It could be a /NOUNLOAD issue.
-Stu
-Stu
I've added ${ArrayUnload} to this build (v0.6 RC3).
Also updated all your example scripts (can't use ${Array} inside a Section or Function, added ${Array->Delete} and ${ArrayUnload} to all scripts).
I found out why NSISArray.nsh wasn't included in the last Zip. It actually was, but for some reason it was put in the Plugins folder instead. So make sure you delete Plugins\NSISArray.nsh.
-Stu
Also updated all your example scripts (can't use ${Array} inside a Section or Function, added ${Array->Delete} and ${ArrayUnload} to all scripts).
I found out why NSISArray.nsh wasn't included in the last Zip. It actually was, but for some reason it was put in the Plugins folder instead. So make sure you delete Plugins\NSISArray.nsh.
-Stu
Thanks! I'll check it out.
edit:
Things seem to be working great!
😁
edit:
Things seem to be working great!
😁
I want to use two arrays in my installer. This basic example results in a compiling error. A bug?
!include nsisarray.nsh
outfile array.exe
${Array} "array1"
${Array} "array2"
section -array
sectionend
Error: variable "ArrayErr" already declared
Error in macro Array on macroline 3
I did some digging and found the problem (and turned up another problem in the process). My modified header file attached should fix it. (Note that I changed the name of the header file. Afrow may have another way he'd prefer to handle it so I didn't want my modifications to be confused with the 'official' version.)
Two problems addressed (which are also commented in the attached header file):
1. the variable ArrayErr was getting defined multiple times when the array messagebox handling was turned off. To correct this, I turned the !define "ArrayErrorMsgBox" into a macro. So insted of using the "!define ArrayErrorMsgBox", I can now use "${ArrayErrorMsgBox}". (This is only if you want the plugin to generate error messages instead of you handling it the script. See the original docs for more info.)
2. ArrayUnload was also getting defined more than once. To correct this, I simply enclosed the ArrayUnload define inside an "!ifndef" block.
Two problems addressed (which are also commented in the attached header file):
1. the variable ArrayErr was getting defined multiple times when the array messagebox handling was turned off. To correct this, I turned the !define "ArrayErrorMsgBox" into a macro. So insted of using the "!define ArrayErrorMsgBox", I can now use "${ArrayErrorMsgBox}". (This is only if you want the plugin to generate error messages instead of you handling it the script. See the original docs for more info.)
2. ArrayUnload was also getting defined more than once. To correct this, I simply enclosed the ArrayUnload define inside an "!ifndef" block.
Thanks for helping out.
I had to go about ArrayErrorMsgBox differently though as when the ArrayErrorMsgBox is defined, all functions will do a Pop $ArrayVar. However, your code had it defined constantly and therefore it couldn't work.
With the Var ArrayErr, I've just added another define so that it isn't added twice.
(Uploaded v0.6 RC4)
-Stu
I had to go about ArrayErrorMsgBox differently though as when the ArrayErrorMsgBox is defined, all functions will do a Pop $ArrayVar. However, your code had it defined constantly and therefore it couldn't work.
With the Var ArrayErr, I've just added another define so that it isn't added twice.
(Uploaded v0.6 RC4)
-Stu
I see your point...
🤨
RC4 looks good. Thanks again!
🤨
RC4 looks good. Thanks again!
Uploaded v0.7.
Added a second parameter to ${myArray->Sort} which can specify another array name. The 2nd array will be rearranged into the same order as the sorted array (works like associative arrays). Both arrays must be of the same size initially.
Added the SetSize function to set the array to a specific size of items.
-Stu
Added a second parameter to ${myArray->Sort} which can specify another array name. The 2nd array will be rearranged into the same order as the sorted array (works like associative arrays). Both arrays must be of the same size initially.
Added the SetSize function to set the array to a specific size of items.
-Stu
Uploaded v0.7 RC3.
Minor code changes and readme typo fixes.
-Stu
Minor code changes and readme typo fixes.
-Stu
Uploaded 0.7 RC4
Added ReadFirst, ReadNext and ReadClose.
-Stu
Added ReadFirst, ReadNext and ReadClose.
-Stu
Uploaded v0.8
Added IsEmpty, IsFull, IsInRange, and ArrayExists / Inited.
-Stu
Added IsEmpty, IsFull, IsInRange, and ArrayExists / Inited.
-Stu
Hello,
It would be possible to add a function in the array plug-in that erase the elements which appear already in the array?
It would be possible to add a function in the array plug-in that erase the elements which appear already in the array?
array-pop does not work
Hi Stu
This array-plugin is great! Thank you very much!
With the plugin I would like to pop some values from the array. The value returned was "2" and nothing happened to the array.
Even the provided example did not work. I would be glad, if you could investigate in this.
Thank you very much!
Have a nice Day.
-Bruno.
Hi Stu
This array-plugin is great! Thank you very much!
With the plugin I would like to pop some values from the array. The value returned was "2" and nothing happened to the array.
Even the provided example did not work. I would be glad, if you could investigate in this.
Thank you very much!
Have a nice Day.
-Bruno.
Will look at it now.
-Stu
-Stu
Thanks, fixed.
Let me know if you discover any other problems.
SuperPat:
Use ${myArrayName->Clear}
-Stu
Let me know if you discover any other problems.
SuperPat:
Use ${myArrayName->Clear}
-Stu
Wow great! Thank you very much!
-Bruno.
-Bruno.
Hey Stu!
Your plugin is really great!
But I have a problem with your script.
For example when executing ${MyArray->Init} there seems to be a value popped from the stack but the function in your plugin doesn't push anything to the stack so the stack is getting emptier!
Some other macros do this too!
I think it's a bug, isn't it!?
-Marcy
Your plugin is really great!
But I have a problem with your script.
For example when executing ${MyArray->Init} there seems to be a value popped from the stack but the function in your plugin doesn't push anything to the stack so the stack is getting emptier!
Some other macros do this too!
I think it's a bug, isn't it!?
-Marcy
Variable name length
I'm new to NSIS and gratefully using the NSISArray plugin. I stumbled upon an issue which I, by some debugging, tracked down to variable name length of arrays. I'm not sure whether this restriction is by NSIS design, or an NSISArray issue (or just me overlooking something else).
Anyway, when using the following code:
Am I stretching some limits, or is this a bug?
I'm new to NSIS and gratefully using the NSISArray plugin. I stumbled upon an issue which I, by some debugging, tracked down to variable name length of arrays. I'm not sure whether this restriction is by NSIS design, or an NSISArray issue (or just me overlooking something else).
Anyway, when using the following code:
you'll only get a debug window for the last initialized array (you can verify that by swapping the 2 Init statements). If you remove the underscore to shorten the variable names, all works fine.
${Array} "TheObject->Foo1_"
${Array} "TheObject->Foo2_"
Section
${TheObject->Foo1_->Init}
${TheObject->Foo2_->Init}
${TheObject->Foo1_->Debug}
${TheObject->Foo2_->Debug}
SectionEnd
Am I stretching some limits, or is this a bug?
Re: Variable name length
Originally posted by GrimaceOk, I took a quick look at the plugin code, and I guess this one's responsible for it:
Am I stretching some limits, or is this a bug?
I think I'll just recompile then 😉
char arrNames[ARRAY_MAX_COUNT][16];
I thought I put an error check in for that, but perhaps not.
-Stu
-Stu
Version 1.1 is available for download.
Its most notable change is support for dynamic arrays.
A complete list of changes can be found in the included documentation.
-Stu
Its most notable change is support for dynamic arrays.
A complete list of changes can be found in the included documentation.
-Stu
Very interesting...
Thanks AfrowUK!
😁
CF
Thanks AfrowUK!
😁
CF
I can't wait to test it after my vacation! 😁
1.2 is now available with some modifications for better error checking.
-Stu
-Stu
Hello
It there a bug with NSISArray 1.2 with the Exists and ExistsI function?
This is a peace of code that add in a array the name of all the directory contained in $SMPROGRAMS (it work well with the version 1.0):
Consequently, no items are added in the array
It there a bug with NSISArray 1.2 with the Exists and ExistsI function?
This is a peace of code that add in a array the name of all the directory contained in $SMPROGRAMS (it work well with the version 1.0):
Tthe value of $MUI_TEMP2 is curiously allways "4" 😱StrCpy $MUI_TEMP2 ""
NSISArray::New /NOUNLOAD "SMProgList"
SetShellVarContext current
FindFirst $UMUI_TEMP3 $MUI_TEMP1 "$SMPROGRAMS\*"
FindNext $UMUI_TEMP3 $MUI_TEMP1
loop:
FindNext $UMUI_TEMP3 $MUI_TEMP1
StrCmp $MUI_TEMP1 "" exit
IfFileExists $SMPROGRAMS\$MUI_TEMP1\* add
goto loop
add:
NSISArray::ExistsI /NOUNLOAD "SMProgList" "$MUI_TEMP1" 0
Pop $MUI_TEMP2
MessageBox MB_OK "$MUI_TEMP1 $MUI_TEMP2"
StrCmp $MUI_TEMP2 -1 0 NoAdd
NSISArray::Push /NOUNLOAD "SMProgList" $MUI_TEMP1
NoAdd:
goto loop
exit:
FindClose $UMUI_TEMP3
Consequently, no items are added in the array
I have found an other problem:
This is a test code:
Edit: apprently "4" is the error code for the array does not exist
This is a test code:
Instead of return "a|b|c|d|e|f|g", it return "4" 🙁
NSISArray::New /NOUNLOAD "SMProgList"
NSISArray::Push /NOUNLOAD "SMProgList" "a"
NSISArray::Push /NOUNLOAD "SMProgList" "b"
NSISArray::Push /NOUNLOAD "SMProgList" "c"
NSISArray::Push /NOUNLOAD "SMProgList" "d"
NSISArray::Push /NOUNLOAD "SMProgList" "e"
NSISArray::Push /NOUNLOAD "SMProgList" "f"
NSISArray::Push /NOUNLOAD "SMProgList" "g"
NSISArray::Concat /NOUNLOAD "SMProgList" "|"
Pop $UMUI_TEMP3
MessageBox MB_OK "$UMUI_TEMP3"
NSISArray:😁elete /NOUNLOAD "SMProgList"
NSISArray::Unload
Edit: apprently "4" is the error code for the array does not exist