简体   繁体   中英

copy variables in NSIS

I am using nsisXML by Wizou to read and write from XML configuration file. In uninstaller, I'd like to report back which version was uninstalled. There are multiple parts of my app, each with a version string.

This is how I report back:

inetc::post '{"extra":{"app1":"$u_app1","app2":"$u_app2", "app3":"$u_app3", "app4":"$u_app4", "app5":"$u_app5" }}' /SILENT /HEADER "Content-Type: application/json" "https://myurl.com/uninstalled" /CONNECTTIMEOUT -5

The problem with nsisXML, is that it writes to nsis registers $0, $1, $2, $3 and so on.. If I read from multiple nodes, the return value is stored in $3 for all and is being overwriten with each read.

 nsisXML::create
nsisXML::load "conf.dont.touch.xml"
nsisXML::select "/data/app1"
nsisXML::getText ;stored in $3
nsisXML::select "/data/app2"
nsisXML::getText ;stored in $3
nsisXML::select "/data/app3"
nsisXML::getText ;stored in $3
nsisXML::select "/data/app4"
nsisXML::getText ;stored in $3
nsisXML::select "/data/app5"
nsisXML::getText ;stored in $3


need $u_app1, $u_app2,$u_app3,$u_app4,$u_app5 at the same time

inetc::post '{"extra":{"app1":"$u_app1","app2":"$u_app2", "app3":"$u_app3", "app4":"$u_app4", "app5":"$u_app5" }}' /SILENT /HEADER "Content-Type: application/json" "https://myurl.com/uninstalled" /CONNECTTIMEOUT -5

How do I copy $3 in to a $R1 or any custom variable so I can use it a later time?

Variables are just strings so you can copy them as a string:

var whatever

Section
StrCpy $R1 $3
StrCpy $whatever $3
SectionEnd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM