iMacro中的循环内循环

时间:2018-08-22 18:41:59

标签: javascript imacros

我在js文件中有以下代码:

i = 0
do
{
i=i+1;

//Set Date +4
var someDate = new Date();
var numberOfDaysToAdd = 4;
someDate.setDate(someDate.getDate() + numberOfDaysToAdd); 

var dd = someDate.getDate();
var mm = someDate.getMonth();
var y = someDate.getFullYear();

var monthNames = ["January", "February", "March", "April", "May", "June",
  "July", "August", "September", "October", "November", "December"
];

ret=iimSet("someFormattedDate",someFormattedDate = monthNames[mm] + ' '+ dd + ','+ y);

// Opens Order Page Loop
ret=iimSet("myloop", i);
ret=iimPlay("sfiles/#Loop_Extract_1.iim");

// Extract and set order statuss
var status=iimGetLastExtract();

// Continue if order statuss processing
if( status.toLowerCase().indexOf('processing') >= 0){
ret=iimSet("someFormattedDate",someFormattedDate = monthNames[mm] + ' '+ dd + ','+ y);
ret=iimPlay ("sfiles/#Loop_1.iim");
}

}

while (ret  > 0);

这将循环播放Loop_Extract_1.iim,其内容如下:

VERSION BUILD=9030808 RECORDER=FX
TAB T=1
'Set Data source excel sheet
SET !DATASOURCE C:\Users\pc\Desktop\Script_Excel\orders.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{myloop}}
URL GOTO=https://www.example.com/post.php?post={{!COL1}}&action=edit

然后,它播放Loop1.iim,其内容如下:

VERSION BUILD=9030808 RECORDER=FX

TAB T=1

'Click on Load in Order Viewer Button
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL 
TAG POS=1 TYPE=SPAN ATTR=CLASS:layers

我需要在Loop_1.iim内定义另一个循环,以便POS由写在数据源表的第2列中的数字定义。例如,如果第2列有3,则Loop_1.iim应该以POS = 1播放,然后应该以POS = 2播放,依此类推,直到达到3。该怎么做?

0 个答案:

没有答案