在没有循环的情况下在iMacros上自动递增变量

时间:2016-04-16 15:15:02

标签: auto-increment imacros

这是我目前需要帮助的iMacro代码:

`VERSION BUILD=8961227 RECORDER=FX
SET !LOOP 1
SET !var1 
add !var1 {{!loop}}
TAB T=1
URL GOTO=https://www.google.com/?gws_rd=ssl
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:tsf ATTR=ID:lst-ib CONTENT={{!var1}}`

此代码适用于循环模式,但我想在每次手动执行中自动增加var1

测试1:     TAG POS=1 TYPE=INPUT:TEXT FORM=ID:tsf ATTR=ID:lst-ib CONTENT=1

测试2:TAG POS=1 TYPE=INPUT:TEXT FORM=ID:tsf ATTR=ID:lst-ib CONTENT=2

我希望明白,谢谢你的帮助

2 个答案:

答案 0 :(得分:2)

您可以尝试EVAL

SET !VAR1 1
TAB T=1
URL GOTO=https://www.google.com/?gws_rd=ssl
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:tsf ATTR=ID:lst-ib CONTENT={{!VAR1}}
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; parseInt(s)+1;")
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:tsf ATTR=ID:lst-ib CONTENT={{!VAR1}}

答案 1 :(得分:0)

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">

  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">

  <script>
    $(function () {
      $("#datepicker").datepicker();
    });

    $(function () {
      $("#datepicker1").datepicker();
    });
  </script>

  <title>JS Bin</title>
</head>
<body>
  <p>From: <input type="text" id="datepicker"></p>
  <p>To: <input type="text" id="datepicker1"></p>
</body>
</html>