Hi all,
I'm a new user of this forum and I'm a newbie of NSIS installer and JSON.
Unfortunately, I've to make an NSIS script that, taking values from a form in the installer, will create a JSON, in order to make an http request.
The question is, it is possible to create a json variable in nsis? All threads I've seen, talking about a json file for input, but in this case, I should have a json variable for output.
It is possible? I took a look to nsJSON plugin, but I don't know if it is the right plugin..
Thanks!
Re DeL SiLeNziO
Create a JSON variable in an NSIS script
7 posts
mmm ok, I've already read this thread but I need some explaination...
the example of thread says:
How can I do an http call?
the example of thread says:
in this case, where is the variable containing my data?nsJSON::Set `more_stuff` `PSCHED_009_NAME` /value `QoS Packet Scheduler`
How can I do an http call?
I tried to use nsJSON but, when compile I obtain:
Should I include anything else?!
this is my code:Invalid command: nsJSON::Set
...
!include MUI2.nsh
....
Page custom nsDialogsPage
...
Function nsDialogsPage
SetOutPath "$INSTDIR\bin"
File "..\bin\nsJSON.dll"
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateLabel} 0 0 100% 12u "Registering a new AIC"
Pop $Title
${NSD_CreateLabel} 0 20 20 12u "AIC:"
Pop $LabelAIC
${NSD_CreateText} 40 20 80 12u ""
Pop $TextAIC
${NSD_GetText} $TextAIC $prova
nsJSON::Set /value `{}`
nsJSON::Set `aic` /value `"$prova"`
nsJSON::Serialize /format /file c:\Temp\test.json
DetailPrint `Generate: c:\Temp\test.json`
nsDialogs::Show
FunctionEnd
Should I include anything else?!
Invalid command probably means it cannot find the plugin, use !addplugindir...
Ok!! Thanks! With addplugindir works!Originally Posted by Anders View PostInvalid command probably means it cannot find the plugin, use !addplugindir...
In order to take the value of my ${NSD_CreateText} I used NSD_GetText:
...but, even if I write some text in the field my var $a is empty and my json result is:
Var a
...
${NSD_CreateText} 40 20 80 12u ""
Pop $txt
${NSD_GetText} $txt $a
nsJSON::Set /value `{}`
nsJSON::Set `VARTEXT` /value `"$a"`
nsJSON::Serialize /format /file c:\Temp\test.json
DetailPrint `Generate: c:\Temp\test.json`
{Where is the error?! 🙁 😢
"VARTEXT": ""
}
thanks so much!!!!
Ok, solved! My mistake... 🙁