Sunday 15 June 2014

csv - Inner loops for column 2 in imacros -


I'm having trouble filling out the form. I have two columns, both have data, I created a loop for it , But I want an internal loop for column 2, as before, select this column from 1 to row 2, and then select data from column 2 to column 2. / P>

For example, I have 10 entries in my column and 20 entries in column 2

  • External Loop column 1
  • Inner loop column 2
  • Repeat

Here is the code:

  VERSION build = 10022823 tab T = 1 set DATASOURCE F: !! \ Tgif.csv SET Loop 2 Set DATASOURCE_LINE {! {Loop}} URL Goto = {! {Col1}} Size X = 1392 Y = 863 WAIT seconds = 2.797 DS Chair and Managing Director = Click X = 589 Y = 396 Content = WAIT Second = 2 DS CMD = Key Material = {{col2}!} Seconds = 5 tag POS = 1 type = button: form submit = action: /ajax/updatestatus.php? Av = 100009092062416 ATTR = TXT: post WAIT seconds = 5  

more complex iMacro For scripts (such as looping and forwarding), you can use iMacr to run javascript scripts Firefox add-ons In addition, in general, it would be almost always better to use this tag for better control Is that which targets more specific element attributes (such as classes, id, etc.) rather than the situation The literacy.

What you want to do is like if it is firstField and secondField arrays to be done through the nested loop, then you can do something like:

 For  (Var I = 0, alength = firstField.length; I & lt; alength; i ++) {// First select the column (; j & lt; blength; on j = 0, blength = secondField.length J + For the iMacro code, you can use: to play {// cell in the second column, with the same first column # selection}}  

to javascript:

  iimPlay ("code:" + m): share If I remember // for Mac, for windows, you can take "CODE" out correctly. Or it can be on the other side!  

I'm improving this, so the included part is not working yet (and some features have not been fully added) ... but I have a Javascript library Working with IMacros you can see it here:

If you want, you can use the code segment or just use Javascript with iMacros how to use. To use it, now, you can only copy your own code inside the iMacroLibrary.js document, then you can add your own code after you can define everything in the library after the "Define unsafewindow" section So that 'a single line, saving place can be saved. After that, you can use CSS selectors to select elements on the page and interact with them. You can also import and export CSV data as well.

  var year = $ M ('.in yearinput'); Var make = # M ('Manniput'); // or var year = $ M ('select', 1); // First dropdown (selection) element = $ M ('select', 2); // Second dropdown (selection) element year. Click (); Year. Remove ('TXT'). Extract ('TXTALL'); // as soon as Make.extractAll ()  

to export or import CSV data:

  exportcsv = function (csvarray, filename); Importcsv = function (file_name, line_num, fields_num);  

The old version of the library (before I started it again ...!) Is committed #: 8b6045ecf9559fa7c9e13492d69af067c86a61b5

This is a little messy from the end It is the place where I had put some code for testing, but you can see how it can be implemented. Just for reference!

P.S. Although for automation, I am playing with Python Library Splitter, and in some ways it is really easy to use in comparison to iMacros. It is also easy to write code. I have started changing some of my old iMacros to Python because of that; There is definitely more power and flexibility. IMacros is great for simple tasks which can be easily / quickly entered, for my web scrapping in the opinion, beautiful soup is very useful too. Also, I have also heard of Selenium for web automation, although I have not done it yet, just throwing out some other options, in case of buses. I am sure that I already know him!


No comments:

Post a Comment