In the new versions (1.1 and 1.2) Write function has a bug when it is writing to the last element. It's creating new "empty" element or "undeleting" one of previosuly deleted.
NSISArray plugin
147 posts
Thanks Filus, this problem has been fixed in the new version. The problem also appeared in three other functions while I was making modifications between 1.1 and 1.2.
v1.3 is now available for download from the same location.
Please note:
If you have a previous release of NSISArray installed, please delete the Contrib\NSISArray and Examples\NSISArray folders before installing the new release.
SuperPat:
Sorry I hadn't updated the information on the New function.
It now requires two extra parameters.
-Stu
v1.3 is now available for download from the same location.
Please note:
If you have a previous release of NSISArray installed, please delete the Contrib\NSISArray and Examples\NSISArray folders before installing the new release.
SuperPat:
Sorry I hadn't updated the information on the New function.
It now requires two extra parameters.
-Stu
Sorry I hadn't updated the information on the New function.Yes But:
It now requires two extra parameters.
even with the 2 parameters, this code don't work
NSISArray::New /NOUNLOAD "SMProgList" 7 1
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
the string is empty... 🙄
What is wrong in my code?
You forgot (or perhaps didn't know) that C strings have a NULL character on the end of them (/0) which specifies the end of the string.
I should put a note about this in the documentation, but the minimum string length is 2 not 1.
If you get any other problems, use NSISArray::ErrorStyle /NOUNLOAD 2 or 4 to find out what error is being produced.
-Stu
I should put a note about this in the documentation, but the minimum string length is 2 not 1.
If you get any other problems, use NSISArray::ErrorStyle /NOUNLOAD 2 or 4 to find out what error is being produced.
-Stu
Even by putting 10 15 like parameters, the string of exit remains always equal to 0
My other example gives the same result
NSISArray::New /NOUNLOAD "SMProgList" 10 15
NSISArray::Push /NOUNLOAD "SMProgList" "e"
NSISArray::Push /NOUNLOAD "SMProgList" "f"
NSISArray::Push /NOUNLOAD "SMProgList" "g"
NSISArray::Push /NOUNLOAD "SMProgList" "a"
NSISArray::Push /NOUNLOAD "SMProgList" "b"
NSISArray::Push /NOUNLOAD "SMProgList" "c"
NSISArray::Push /NOUNLOAD "SMProgList" "d"
NSISArray::Sort /NOUNLOAD "SMProgList" ""
; Build the list
NSISArray::Concat /NOUNLOAD "SMProgList" "|"
Pop $0
MessageBox MB_OK "$0"
I can't test the script here at college but when I get home I will do so (6 hours from now).
-Stu
-Stu
I see with the debug window that the Push and the Sort functions work, but the Concat function return always "0"
I have identified the problem. It's a problem in the DLL. I'll fix it when I get home. There is also a problem with the script header which I need to fix.
-Stu
-Stu
This version work fine.
A few suggestions for the docs whenever you happen to add/change something else:[list=1][*]Sometimes it's hard to remember if an array starts with element "0" or element "1". (I know the norm is to have zero-based arrays, but I use scripting languages that work both ways, so sometimes I just get confused...) It might be helpful to have this stated somewhere in the beginning of the docs.
[*]The function ${Array->Write} allows you to overwrite elements. It's made clear in the docs that the ${Array->Put} command DOES NOT overwrite existing values, but it does not mention in the docs for the ${Array->Write} command that it WILL overwrite values.[/list=1]
PS: I just have to say how extremely useful your plugin has been for me! I use it every chance I get!
😁 👍
[*]The function ${Array->Write} allows you to overwrite elements. It's made clear in the docs that the ${Array->Put} command DOES NOT overwrite existing values, but it does not mention in the docs for the ${Array->Write} command that it WILL overwrite values.[/list=1]
PS: I just have to say how extremely useful your plugin has been for me! I use it every chance I get!
😁 👍
Thanks Comperio I shall add some notes to the documentation for next release.
-Stu
-Stu
The latest NSISArray plugin freezes my installer... I had to revert to the version that I have that uses the .NET Framework...
It would be more helpful if you could identify what exactly freezes the installer (e.g. which plugin function).
Perhaps you could create an example which reproduces the problem.
Did you make sure you extracted all the plugin files from the Zip? You can't expect to use the new plugin if you don't extract the new script header as well for example.
-Stu
Perhaps you could create an example which reproduces the problem.
Did you make sure you extracted all the plugin files from the Zip? You can't expect to use the new plugin if you don't extract the new script header as well for example.
-Stu
I am using Component Manager, which utilizes the NSISArray plugin, and comes with it... It turns out a special build is required to use it with Component Manager... Unfortunately, neither I nor dandaman32 have VC6, but we had C::B, but I don't have a clue how to dynamically link to the VC6 library using MinGW... So, it was statically linked... If it could be dynamically linked to the VC6 DLL using MinGW, that would be good, because my installer blew up 120K for including a statically linked version...
I guess the special build was made for custom array sizes. Since NSISArray 1.0, arrays are now dynamic and so special builds are not needed.
I haven't seen dandaman32 around for a while, so he may not know about the new version. To use the new plugin, major changes are needed on old scripts.
-Stu
I haven't seen dandaman32 around for a while, so he may not know about the new version. To use the new plugin, major changes are needed on old scripts.
-Stu
Hello,
I have a problem with NSISArray, To be more precise, with the Concat function:
I wish to create a MULTILANGUAGE page for UltraModernUI.
I have a variable named $UMUI_LANGLIST that contain all the names of the language inserted in the NSIS script.
Example:
"English|Français|Português (do Brasil)|Deutsch|Español|Chinese (Simplified)|Chinese (Traditional)|Japanese|Korean|Italiano|Nederlands|Danish|Svenska|Norwegian|Suomi|Greek|Russian|Português|Polski|Ukrainian|Cesky|Slovensky|Hrvatski|Bulgarian|Magyar|Thai|Romana|Latvieðu|Macedonian|Eesti keel|Türkçe|Lietuviu|Català|Slovenski jezik|Serbian Cyrillic|Serbian Latin|Arabic|Farsi|Hebrew|Indonesian|Mongolian|Lëtzebuergesch|Albanian|Brezhoneg|Byelorussian|Icelandic|Malay|Bosanski|Kurdî|Euskera|Welsh|Irish"
Its StrLen is 499
The goal of this code is to sort the language list:
Why NSISArray has not returned the others items?
I have a problem with NSISArray, To be more precise, with the Concat function:
I wish to create a MULTILANGUAGE page for UltraModernUI.
I have a variable named $UMUI_LANGLIST that contain all the names of the language inserted in the NSIS script.
Example:
"English|Français|Português (do Brasil)|Deutsch|Español|Chinese (Simplified)|Chinese (Traditional)|Japanese|Korean|Italiano|Nederlands|Danish|Svenska|Norwegian|Suomi|Greek|Russian|Português|Polski|Ukrainian|Cesky|Slovensky|Hrvatski|Bulgarian|Magyar|Thai|Romana|Latvieðu|Macedonian|Eesti keel|Türkçe|Lietuviu|Català|Slovenski jezik|Serbian Cyrillic|Serbian Latin|Arabic|Farsi|Hebrew|Indonesian|Mongolian|Lëtzebuergesch|Albanian|Brezhoneg|Byelorussian|Icelandic|Malay|Bosanski|Kurdî|Euskera|Welsh|Irish"
Its StrLen is 499
The goal of this code is to sort the language list:
The array contain well all the 52 items but when I want to get the list with the Concat function, it return only the 41 first items...StrLen $R0 $UMUI_LANGLIST ; $Ro = 499
; create an array that containing the langstring
NSISArray::New /NOUNLOAD "LangList" 55 8
NSISArray::WriteListC /NOUNLOAD "LangList" "$UMUI_LANGLIST" "|"
NSISArray::Sort /NOUNLOAD "LangList" ""
NSISArray::Concat /NOUNLOAD "LangList" "|"
Pop $UMUI_LANGLIST
StrLen $R1 $UMUI_LANGLIST ; $R1 = 392 Only....
NSISArray:😁ebug /NOUNLOAD "LangList" ; The array contain well all the 52 items
MessageBox MB_OK "$R1 instead of $R0" ; ===> 392 instead of 499 bytes returned
Why NSISArray has not returned the others items?
I'll look into this tomorrow morning as soon as possible. It's getting late here 🙂
-Stu
-Stu
Work fine, Thanks
how many entries/bytes can hold an array?
i have 2 hash arrays and after extact 361 entries with
each 32 token the script quits without warning or gpf.
🙁
i have 2 hash arrays and after extact 361 entries with
each 32 token the script quits without warning or gpf.
🙁
I have uploaded v1.4 which has a new "Subtract" function among code cleanup and utilisation.
Subtract allows you to take-away items in one array that are in another. This is useful for comparing two arrays to see which items do not match (i.e. with GetDrives or something).
Stu
Subtract allows you to take-away items in one array that are in another. This is useful for comparing two arrays to see which items do not match (i.e. with GetDrives or something).
Stu
Brummelchen, sorry I missed that post. Can you create a script to reproduce this?
Stu
Stu
I found out what was causing the crashing.
I tested the plugin with all 8 arrays filled with 10000 strings of 100 characters and everything was fine.
Uploaded v1.5
Stu
I tested the plugin with all 8 arrays filled with 10000 strings of 100 characters and everything was fine.
Uploaded v1.5
Stu
Thank you - i try it next build here.
meanwhile right after trouble i repalced the array
with a file list as TXT and it runs smooth. now i
need to improve zero byte files which all have same
hash - nsis itself can handle that - me not.
meanwhile right after trouble i repalced the array
with a file list as TXT and it runs smooth. now i
need to improve zero byte files which all have same
hash - nsis itself can handle that - me not.
Uploaded v1.5 RC2. Fixed some parameter validation check issues for some of the functions.
Stu
Stu
SizeOf
I tried using this plugin today, and find that the ${myArray->SizeOf} macro would cause an error. After assorted cursing and headscratching, I discovered:
Line 686 of NSISArray.nsh:
!macro Array_IndexesOf Name VarBufferLen VarItems VarIndexes
should be
!macro Array_SizeOf Name VarBufferLen VarItems VarIndexes
Note that this bug did cause the Examples/NSISArray/Sizeof.nsi to fail, and this change fixed it.
I tried using this plugin today, and find that the ${myArray->SizeOf} macro would cause an error. After assorted cursing and headscratching, I discovered:
Line 686 of NSISArray.nsh:
!macro Array_IndexesOf Name VarBufferLen VarItems VarIndexes
should be
!macro Array_SizeOf Name VarBufferLen VarItems VarIndexes
Note that this bug did cause the Examples/NSISArray/Sizeof.nsi to fail, and this change fixed it.
Thanks, fixed.
That probably happened when I did a Size->Indexes text replace in the script header 🙁
Stu
That probably happened when I did a Size->Indexes text replace in the script header 🙁
Stu
Stu,
I am using the array plugin in both my installer and uninstaller in oder to register (during installation) and unregister (during uninstall) a large number of file extensions for my application. I am creating an array at my .onInit function and then call it inside a section of the installer and this works fine.
However if I create the array for the uninstaller in my un.onInit section and try to call it in any of my uninstall sections, the uninstaller crashes (no messages, it just dies).
After playing around with it I finally got it to work without declaring an array in the un.onInit function, but right inside an uninstall section.
Any ideas why this is happening?
Note that even the NSISArray::ArrayExists command inside an uninstall section causes a crash in the case that the array was created in the un.onInit function
Cheers,
CF
I am using the array plugin in both my installer and uninstaller in oder to register (during installation) and unregister (during uninstall) a large number of file extensions for my application. I am creating an array at my .onInit function and then call it inside a section of the installer and this works fine.
However if I create the array for the uninstaller in my un.onInit section and try to call it in any of my uninstall sections, the uninstaller crashes (no messages, it just dies).
After playing around with it I finally got it to work without declaring an array in the un.onInit function, but right inside an uninstall section.
Any ideas why this is happening?
Note that even the NSISArray::ArrayExists command inside an uninstall section causes a crash in the case that the array was created in the un.onInit function
Cheers,
CF
I'll need to make a script to reproduce this. If you have one, I would be grateful.
Stu
Stu