如何将变量从 imacros 传递到 javascript?
How can I pass a variable from imacros to a javascript?
我需要将 imacros 中的值与 javascript 值相乘。
我可以将 javascript 值传递给 imacros,但 imacros 无法乘以它。
另外,我没有找到任何解决方案,如何从 imacros 中提取变量并将其传递给 javascript.
var macro, iret;
var JsNumber = 5;
function macro1()
{
iimSet("VAR1", JsNumber);
macro = "CODE:";
macro += "VERSION BUILD=8961227 RECORDER=FX\n";
macro += "CMDLINE !DATASOURCE c:\database.csv\n";
macro += "SET !DATASOURCE_LINE 1\n";
macro += "SET !VAR2 {{!COL1}}\n";
macro += "SET !VAR3 EVAL(VAR1 * VAR2)\n";
macro += "PROMPT {{!VAR3}} !VAR4\n";
iret = iimPlay(macro)
}
{
macro1();
}
解决方法是:iimGetExtract()
这可以从 imacros 脚本到 javascript.
提供一个变量
var macro, iret;
var JsNumber = 5;
var theReturn=macro1(JsNumber);
function macro1(JsNumber)
{
iimSet("VAR1", JsNumber);
macro = "CODE:";
macro += "VERSION BUILD=8961227 RECORDER=FX\n";
macro += "CMDLINE !DATASOURCE c:\database.csv\n";
macro += "SET !DATASOURCE_LINE 1\n";
macro += "SET !VAR2 {{!COL1}}\n";
macro += "SET !VAR3 EVAL(VAR1 * VAR2)\n";
macro += "SET !EXTRACT {{!VAR3}}\n";
macro += "PROMPT {{!VAR3}} !VAR4\n";
iret = iimPlay(macro)
var ret=iimGetLastExtract();
return ret;
}
试试这个...
我需要将 imacros 中的值与 javascript 值相乘。 我可以将 javascript 值传递给 imacros,但 imacros 无法乘以它。 另外,我没有找到任何解决方案,如何从 imacros 中提取变量并将其传递给 javascript.
var macro, iret;
var JsNumber = 5;
function macro1()
{
iimSet("VAR1", JsNumber);
macro = "CODE:";
macro += "VERSION BUILD=8961227 RECORDER=FX\n";
macro += "CMDLINE !DATASOURCE c:\database.csv\n";
macro += "SET !DATASOURCE_LINE 1\n";
macro += "SET !VAR2 {{!COL1}}\n";
macro += "SET !VAR3 EVAL(VAR1 * VAR2)\n";
macro += "PROMPT {{!VAR3}} !VAR4\n";
iret = iimPlay(macro)
}
{
macro1();
}
解决方法是:iimGetExtract() 这可以从 imacros 脚本到 javascript.
提供一个变量var macro, iret;
var JsNumber = 5;
var theReturn=macro1(JsNumber);
function macro1(JsNumber)
{
iimSet("VAR1", JsNumber);
macro = "CODE:";
macro += "VERSION BUILD=8961227 RECORDER=FX\n";
macro += "CMDLINE !DATASOURCE c:\database.csv\n";
macro += "SET !DATASOURCE_LINE 1\n";
macro += "SET !VAR2 {{!COL1}}\n";
macro += "SET !VAR3 EVAL(VAR1 * VAR2)\n";
macro += "SET !EXTRACT {{!VAR3}}\n";
macro += "PROMPT {{!VAR3}} !VAR4\n";
iret = iimPlay(macro)
var ret=iimGetLastExtract();
return ret;
}
试试这个...