【问题标题】:loop the whole macro but with different "Input" each time?循环整个宏但每次都有不同的“输入”?
【发布时间】:2017-02-02 15:21:57
【问题描述】:

我对这些家伙非常非常菜,所以请不要生我的气 :oops: 我正在为 Chrome 使用 Imacros。

1- 当宏找到我在其中搜索的“关键字”时,我想停在“当前页面”。 2- 我想循环这个宏,但每次都使用不同的“输入”,直到 CSV 文件输入结束,但我不知道该怎么做。

这是我尝试过的:

VERSION BUILD=844 RECORDER=CR
URL GOTO=http://gizaedu.gov.eg/natig/3.aspx
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form1 ATTR=ID:TextBox1 CONTENT=10000
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Button1
SET EXTRACT NULL
'if this exist you extract the text(even if you know it)
'if doesn't exist should return error but we turned that off; Extract remains Null
TAG POS=1 TYPE=SMALL ATTR=TXT:Keyword EXTRACT=TXT
SET !VAR1 EVAL("var text=\"{{!EXTRACT}}\"; if(text==\"keyword\") text = \"jibber\"
'this one executes if the text is right, if not should give error but we turned that off
TAG POS=1 TYPE=DIV ATTR=TXT:{{!VAR1}}

我的主要目标是从 CSV 文件中输入多个值,并且每次在页面中搜索“关键字”,如果找到,则停下来让我“查看”页面,如果没有找到“关键字”我希望它一直持续到 CSV 输入结束。

我找到了这段代码,但我不知道该放在哪里以及如何使用它:

SET !DATASOURCE key22.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}

我已经尽力了,但这就是我想出的,我希望你能帮助我实现我的目标。

提前谢谢.. :)

编辑:感谢 Shugar,我已经完成了 %90,但我仍然不知道在哪里输入宏在看到它时会停止的关键字?这是我运行成功的最后一个脚本!:

VERSION BUILD=844 RECORDER=CR
SET !DATASOURCE C:\Users\SparkedLeads\Documents\iMacros\Datasources\01.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET !ERRORIGNORE YES
TAG POS=1 TYPE=SMALL ATTR=TXT:{{!COL1}} EXTRACT=TXT
SET !ERRORIGNORE NO
' press "OK" in the iMacros extract dialog after "viewing" the page if you want to continue playing the macro
' uncomment the line below if you want to break the macro when some keyword is found
SET E EVAL("'{{!EXTRACT}}' == '{{!COL1}}' ? MacroError('Keyword is found !') : '';")
URL GOTO=http://gizaedu.gov.eg/natig/3.aspx
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form1 ATTR=ID:TextBox1 CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Button1

没问题,我已经想通了:)

【问题讨论】:

    标签: automation imacros


    【解决方案1】:

    在“当前页面”以循环模式播放下面给出的宏。注意里面的cmets。

    SET !DATASOURCE key22.csv
    SET !LOOP 2
    SET !DATASOURCE_LINE {{!LOOP}}
    
    SET !ERRORIGNORE YES
    TAG POS=1 TYPE=SMALL ATTR=TXT:{{!COL1}} EXTRACT=TXT
    SET !ERRORIGNORE NO
    
    ' press "OK" in the iMacros extract dialog after "viewing" the page if you want to continue playing the macro
    ' uncomment the line below if you want to break the macro when some keyword is found
    'SET E EVAL("'{{!EXTRACT}}' == '{{!COL1}}' ? MacroError('Keyword is found !') : '';")
    

    【讨论】:

    • 非常感谢 Shugar 我已经做到了,但我不知道在哪里输入宏在看到它时会停止的“关键字”?
    猜你喜欢
    • 2016-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-21
    • 2016-04-30
    • 1970-01-01
    相关资源
    最近更新 更多