imacros从DATASOURCE循环中的多个文件中获取 [英] imacros take from multi files in DATASOURCE loop

查看:61
本文介绍了imacros从DATASOURCE循环中的多个文件中获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有imacros firefox加载项,它从一个csv文件中获取数据.但是我需要告诉imacros从多个文件中获取数据作为循环 这是我的脚本取自1.csv 但我有2.csv& 3.csv和4.csv和更多..我需要它从循环中获取它们,例如,如果我运行play imacros将在完成重新启动后从1.csv中获取数据,但从2.csv ..etc中获取数据..具有相同的规则对于所有..文件也都是同一列相同的数据,但不能将它们合并为一个文件.csv

I have imacros firefox Add-ons that takes data from one csv file. But i need to tell imacros to take data from multi files as loop here my script is take from 1.csv but I've 2.csv & 3.csv & 4.csv and more.. i need it to take from them as loop like if i run play imacros will take data from 1.csv once they finish start again but from 2.csv ..etc like that.. with the same rule for all.. also the files all are the same columns same data but cannot merge them as one file.csv

SET !DATASOURCE /Users/almishal/Desktop/imacros/new/1.csv
SET !DATASOURCE_COLUMNS 18
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
TAB CLOSEALLOTHERS
TAG POS=1 TYPE=IMG ATTR=SRC:http://www.example.com/vb/sty1/buttons/newthread.gif
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:vbform ATTR=NAME:subject CONTENT={{!COL2}}
SET !VAR1 EVAL("'{{!COL4}}'.replace(/^965/gi,"")")
SET PRICE {{!COL5}}
SET !VAR3 EVAL("'price:<SP>{{PRICE}}<SP>dollar'.replace(/price:<SP>0+<SP>dollar/,"")")
TAG POS=1 TYPE=TEXTAREA FORM=NAME:vbform ATTR=ID:vB_Editor_001_textarea CONTENT=[CENTER]{{!COL3}}<BR>{{!VAR3}}<BR><SP>my<SP>number<SP>{{!VAR1}}<SP><BR><BR>{{!VAR2}}<BR>[/CENTER]
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:vbform ATTR=ID:vB_Editor_001_save
TAG POS=1 TYPE=AREA ATTR=HREF:http://www.example.com/vb/index.php
ONDIALOG POS=1 BUTTON=OK CONTENT=
TAG POS=1 TYPE=A ATTR=TXT:log<SP>out

推荐答案

借助

You can get the most elegant solution with the help of the JavaScript Scripting Interface. But here I suggest a one using only ‘iim’s. So, create e.g. ‘macro1.iim’ for ‘1.csv’, ‘macro2.iim’ for ‘2.csv’ etc. The code of the ‘macro1.iim’ will be as follows:

' number of lines in csv-files
SET linesInFile 1
SET !LOOP EVAL(2-{{linesInFile}})
SET !DATASOURCE /Users/almishal/Desktop/imacros/new/1.csv
SET !DATASOURCE_LINE EVAL({{!LOOP}}+{{linesInFile}}-1)
TAB CLOSEALLOTHERS
' ... (your code here)

' next macro to play
SET next "macro2"
SET S EVAL("('{{!LOOP}}' == 1) ? 'imacros://run/?m={{next}}.iim' : 'javascript:undefined;';")
URL GOTO={{S}}

我相信您已经理解了这个主意,并将对'macro2.iim'等进行必要的更正.(最后一个宏中将没有下一个要播放的宏"块.)链,您应该在常规(非循环)模式下仅运行"macro1.iim".另外请注意,我认为所有宏都位于它们的默认"iMacros"文件夹的根目录中.

I believe that you’ve caught the idea and will make necessary corrections to ‘macro2.iim’ etc. (There won’t be a ‘next macro to play’ block in the last macro.) In order to play this chain you should run only ‘macro1.iim’ in usual (NOT loop) mode. Also note that I supposed that all macros are in the root of the default ‘iMacros’ folder for them.

这篇关于imacros从DATASOURCE循环中的多个文件中获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆