[英]How to use NSIS Internet plugin?
I have some code that defines a variable like so: 我有一些代码定义这样的变量:
....
Var IP
...
I have some other code that runs on init 我还有其他在init上运行的代码
Function .onInit
;Default installation folder
StrCpy $INSTDIR "C:\PTL\${Project}"
Internet::GetLocalHostIP ${IP}
FunctionEnd
When I run the interpreter against the script, I get a warning: 当我对脚本运行解释器时,收到警告:
[exec] Variable "IP" not referenced or never set, wasting memory!
I figure this is because im not assigning some constant value to IP, and it doesnt recognize the set operation thats happening with the Internet plugin, but when I run the installer it generates, and check the JVM args which use this value (-Djava.rmi.hostname) I have this value: 我认为这是因为我没有为IP分配一些常量值,并且它无法识别Internet插件发生的设置操作,但是当我运行安装程序时,它会生成并检查使用此值的JVM参数(-Djava。 rmi.hostname)我有这个值:
-Djava.rmi.server.hostname=
I tried using a value like $8 but it does the same thing, only the value becomes: 我尝试使用类似$ 8的值,但它执行相同的操作,只有该值变为:
-Djava.rmi.server.hostname=0 -Djava.rmi.server.hostname = 0
How do I use this plugin correctly? 如何正确使用此插件?
In terms of setup, I just dropped the plugin into ./Plugins/x86-ansi 在设置方面,我只是将插件放入./Plugins/x86-ansi
${x}
is for !define
's, the syntax for variables is $x
so in your case $IP
but the NSIS plugin API does not allow output into a variable like that. ${x}
是用于!define
的,变量的语法为$x
因此在您的情况下$IP
但NSIS插件API不允许将输出输出到这样的变量中。
This plugin has a unusual design, if you take a look at its included .nsh file you see it has some defines where VAR_0 = 0 etc. 这个插件的设计不寻常,如果您查看其中包含的.nsh文件,就会发现它具有一些定义,其中VAR_0 = 0等等。
This means you have to do something like this: 这意味着您必须执行以下操作:
Internet::GetLocalHostIP 1 ; Tells the plugin to put the result in $1
StrCpy $IP $1 ; Copy into your variable
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.