Fruchtwein 0 Posted June 22, 2016 Report Share Posted June 22, 2016 Hi, I work now many hours on this, but couldn't figure out the correct solution.Maybe someone could help me please? I want my bot to read out CSV file and receive email, password and country from it. So far that works and I have three lists in the end with the correct data.Now I want to start a loop, where the bot checks the country list and do different things depending on the entry at this certain position. In my code example he should go to the Amazon country webpage and put in the correct login data, than close the browser and check the next item in the list for the country and so on. I hope you get, what I want to do My code to load and read out the CSV file: create table from file("C:\\Users\\Martin\\Desktop\\Login.csv",&mytable) set(#counterLogin,0,"Global") loop($table total rows(&mytable)) { add item to list(%Login,$table cell(&mytable,#counterLogin,0),"Don\'t Delete","Global") increment(#counterLogin) } remove from list(%Login,0) create table from file("C:\\Users\\Martin\\Desktop\\Login.csv",&mytable) set(#counterPW,0,"Global") loop($table total rows(&mytable)) { add item to list(%Pass,$table cell(&mytable,#counterPW,1),"Don\'t Delete","Global") increment(#counterPW) } remove from list(%Pass,0) create table from file("C:\\Users\\Martin\\Desktop\\Login.csv",&mytable) set(#counterLand,0,"Global") loop($table total rows(&mytable)) { add item to list(%Land,$table cell(&mytable,#counterLand,2),"Don\'t Delete","Global") increment(#counterLand) } remove from list(%Land,0) My loop code (and I think here is the mistake): set list position(%Login,0) set list position(%PW,0) set list position(%Land,0) loop($list total(%Login)) { if($comparison($next list item(%Land),"= Equals","DE")) { then { plugin command("ExBrowser.dll", "ExBrowser CleanUp") plugin command("ExBrowser.dll", "ExBrowser Launcher", "Chrome", "", "") login DEU() wait for browser event("DOM Ready","") plugin command("ExBrowser.dll", "ExBrowser Close") } else { } } if($comparison($next list item(%Land),"= Equals","UK")) { then { plugin command("ExBrowser.dll", "ExBrowser CleanUp") plugin command("ExBrowser.dll", "ExBrowser Launcher", "Chrome", "", "") login UK() wait for browser event("DOM Ready","") plugin command("ExBrowser.dll", "ExBrowser Close") } else { } } if($comparison($next list item(%Land),"= Equals","ES")) { then { alert("ES!") } else { } } if($comparison($next list item(%Land),"= Equals","FR")) { then { alert("FR!") } else { } } if($comparison($next list item(%Land),"= Equals","IT")) { then { alert("IT!") } else { } } } At the moment I only get an error message. If I put in the data in the CSV in the order as I put the code it works out, but than there is no real checking for the country column in the CSV? Thank you very much!Fruchtwein Quote Link to post Share on other sites
pash 504 Posted June 22, 2016 Report Share Posted June 22, 2016 (edited) try clear all data create table from file("D:\\Ubot Plugin Development\\Sample\\Advanced Data Text File\\test.csv",&mytable) add list to list(%Login,$plugin function("TableCommands.dll", "$list from table", &mytable, "Column", 0),"Delete","Global") add list to list(%Pass,$plugin function("TableCommands.dll", "$list from table", &mytable, "Column", 1),"Delete","Global") add list to list(%Land,$plugin function("TableCommands.dll", "$list from table", &mytable, "Column", 2),"Delete","Global") divider set list position(%Login,1) set list position(%Pass,1) set list position(%Land,1) loop($subtract($list total(%Login),1)) { set(#Login,$next list item(%Login),"Global") set(#PW,$next list item(%Pass),"Global") set(#Land,$next list item(%Land),"Global") if($comparison(#Land,"= Equals","DE")) { then { alert("DE") } else if($comparison(#Land,"= Equals","UK")) { alert("UK") } else if($comparison(#Land,"= Equals","ES")) { alert("ES") } else { } } } Edited June 22, 2016 by pash Quote Link to post Share on other sites
Fruchtwein 0 Posted June 22, 2016 Author Report Share Posted June 22, 2016 Ciao pash, thanks for your (fast!) help. I now get an error message: "You have exceeded the range of the list." Quote Link to post Share on other sites
pash 504 Posted June 22, 2016 Report Share Posted June 22, 2016 Ciao pash, thanks for your (fast!) help. I now get an error message: "You have exceeded the range of the list."i edit code. try copy new. Quote Link to post Share on other sites
Fruchtwein 0 Posted June 22, 2016 Author Report Share Posted June 22, 2016 (edited) i edit code. try copy new. Sorry, still the same. If I cick continue it shows up the alerts in correct order as it is put into the CSV file. (Edit) Also I figured out sometimes the same country is multiple times in the CSV, than it doesn't recognize it. (/Edit) Edited June 22, 2016 by Fruchtwein Quote Link to post Share on other sites
pash 504 Posted June 22, 2016 Report Share Posted June 22, 2016 edit code 2. Note.I have no "ExBrowser" so I can not test.Please wait for an answer from "Dan". Quote Link to post Share on other sites
Fruchtwein 0 Posted June 22, 2016 Author Report Share Posted June 22, 2016 edit code 2. Note.I have no "ExBrowser" so I can not test.Please wait for an answer from "Dan". Thanks again.Now the first message appears and when I press ok for that "alert" the same problem pops up. I put alert(#Login) alert(#PW) into your code, to check if he uses the right data from CSV file and for the first one he did, than the #PW comes out empty (in my CSV, it is always the same - but won't be in general). I don't have to use ExBrowser, I feel more comfortable with it, but for the testing reason we can use the standard ubot browser. Thanks so much for time and help! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.