本文介绍了如果否则imacros使用javascript命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我编写脚本我想检查{{!COL22}} NOT NULL的复选框,并取消检查{{!COL22}}是NULL

please help me with my scripti want to check the checkbox if {{!COL22}} NOT NULL and uncheck the checkbox if {{!COL22}} is NULL

但是此脚本在具有格式设置条件的语句中不起作用

but this script not work in this statement with formating condition

if (\"{{!COL22}}\" = "") {
        var uncheck = "CODE:";
        uncheck += "FRAME NAME=\"rf\"" + "\n";
        uncheck += "TAG POS=1 TYPE=LABEL ATTR=ONCLICK:publishVipJS.toggleSaleAttr(this,'text');&&FOR:testsale2260958&&DATA:9248:2260958&&TXT:" + "\n";
        uncheck += "TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:testsale2260958 CONTENT=NO" + "\n";
        iimset(uncheck);
        iimPlay(uncheck);
        var notif = alert("NULL");
    }else{
        var check = "CODE:";
        check += "FRAME NAME=\"rf\"" + "\n";
        check += "TAG POS=1 TYPE=LABEL ATTR=ONCLICK:publishVipJS.toggleSaleAttr(this,'text');&&FOR:testsale2260958&&DATA:9248:2260958&&TXT:" + "\n";
        check += "TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:testsale2260958 CONTENT=YES" + "\n";
        iimset(check);
        iimPlay(check);
        var notif = alert("SUCCSES");
    }

完整脚本如下

var isi = "CODE:";
isi += "VERSION BUILD=8970419 RECORDER=FX" + "\n";
isi += "TAB T=1" + "\n";
isi += "SET !REPLAYSPEED FAST" + "\n";
isi += "SET !ERRORIGNORE YES" + "\n";
isi += "SET !TIMEOUT_PAGE 20" + "\n";
isi += "SET !TIMEOUT_STEP 0" + "\n";
isi += "SET !DATASOURCE_LINE {{!LOOP}}" + "\n";
isi += "SET !DATASOURCE Shoes<SP>05-04-2018.csv" + "\n";
isi += "SET !LOOP 4" + "\n";
isi += "FRAME NAME=\"mainFrame\"" + "\n";
isi += "EVENT TYPE=CLICK SELECTOR=\"#mainContent>DIV:nth-of-type(29)>DIV>DIV>INPUT:nth-of-type(2)\" BUTTON=0" + "\n";
isi += "TAG POS=1 TYPE=INPUT:TEXT ATTR=TYPE:text&&ONCHANGE:publishVipJS.changeAlias(this,<SP>'text');&&VALUE:* CONTENT=" + "\n";
isi += "FRAME NAME=\"rf\"" + "\n";
isi += "TAG POS=101 TYPE=INPUT:TEXT ATTR=* CONTENT={{!COL22}}" + "\n";
isi += "FRAME F=0" + "\n";
isi += "TAG POS=1 TYPE=A ATTR=CLASS:btn" + "\n";
iimPlay(isi);

if (\"{{!COL22}}\" = "") {
    var uncheck = "CODE:";
    uncheck += "FRAME NAME=\"rf\"" + "\n";
    uncheck += "TAG POS=1 TYPE=LABEL ATTR=ONCLICK:publishVipJS.toggleSaleAttr(this,'text');&&FOR:testsale2260958&&DATA:9248:2260958&&TXT:" + "\n";
    uncheck += "TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:testsale2260958 CONTENT=NO" + "\n";
    iimset(uncheck);
    iimPlay(uncheck);
    var notif = alert("NULL");
}else{
    var check = "CODE:";
    check += "FRAME NAME=\"rf\"" + "\n";
    check += "TAG POS=1 TYPE=LABEL ATTR=ONCLICK:publishVipJS.toggleSaleAttr(this,'text');&&FOR:testsale2260958&&DATA:9248:2260958&&TXT:" + "\n";
    check += "TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:testsale2260958 CONTENT=YES" + "\n";
    iimset(check);
    iimPlay(check);
    var notif = alert("SUCCSES");
}

推荐答案

不可能直接在js脚本中获取!COL22值.您应该在使用iim代码之前将其提取.例如,通过使用其他宏:

It's impossible to get the !COL22 value directly inside a js-script. You should extract it before with an iim-code. For example by using an additional macro:

...
iimPlay(isi);

iimPlayCode (
    'SET !DATASOURCE Shoes<SP>05-04-2018.csv' + "\n" +
    'SET !EXTRACT {{!COL22}}' + "\n"
);

if (iimGetExtract() = "") {
...

这篇关于如果否则imacros使用javascript命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 17:15