nuestra 0 Posted September 17, 2010 Report Share Posted September 17, 2010 I need to fill 3 text fields. Data must be taken from a txt file. My txt file is like this : field1:field2:field3fielda1:fielda2:fielda3fieldb1:fieldb2:fieldb3fieldc1:fieldc2:fieldc3 But all 3 values must be taken from same line each time. Any suggestions ? Quote Link to post Share on other sites
JohnB 255 Posted September 17, 2010 Report Share Posted September 17, 2010 I think your best bet would be to put the data in a csv file, create table from file and loop through the table one row at a time. John Quote Link to post Share on other sites
nuestra 0 Posted September 17, 2010 Author Report Share Posted September 17, 2010 I think your best bet would be to put the data in a csv file, create table from file and loop through the table one row at a time. John I am giving it a shot now. Thanks for the tip Quote Link to post Share on other sites
JohnB 255 Posted September 17, 2010 Report Share Posted September 17, 2010 No problem. If you need help with the code let me know. John Quote Link to post Share on other sites
pftg4 102 Posted September 17, 2010 Report Share Posted September 17, 2010 ok try this list form file <list test> your txt fileLOOP list total testlist from text next list item test : as delimiter <list test 1>nav to sitefill form 1 next list item <list test 1>fill form 2 next list item <list test 1>fill form 3 next list item <list test 1> Pftg4 Quote Link to post Share on other sites
nuestra 0 Posted September 17, 2010 Author Report Share Posted September 17, 2010 No problem. If you need help with the code let me know. John I just couldnt figure out how to use it. So i just make 4 diffirent list. And used "add to list" and 'list from file" And "change choosen attribute" "next list item" I hope Ubot will not mix up list However i still want to know to take data data from a delimited list or csv file Quote Link to post Share on other sites
Super Dave 26 Posted September 18, 2010 Report Share Posted September 18, 2010 I need to fill 3 text fields. Data must be taken from a txt file. My txt file is like this : field1:field2:field3fielda1:fielda2:fielda3fieldb1:fieldb2:fieldb3fieldc1:fieldc2:fieldc3 But all 3 values must be taken from same line each time. Any suggestions ? Just two lists, and a loop. input: #input-file clearList %input-file addToList(%input-file, listFromFile(#input-file)) loop(listTotal(%input-file) { set #this-loop-line = nextListItem(%input-file) clearList %this-loop-line-parts addToList(%this-loop-line-parts, listFromText(#this-loop-line, ":")) set #field1 = listItem(%this-loop-line-parts, 0) set #field2 = listItem(%this-loop-line-parts, 1) set #field3 = listItem(%this-loop-line-parts, 2) // Do Stuff } 1 Quote Link to post Share on other sites
bestmacros 60 Posted January 24, 2013 Report Share Posted January 24, 2013 it is a shame we don't have build-in basic javascript string methods like split() and slice() - it would make it much more easy to work with strings. 1 Quote Link to post Share on other sites
unurohack 1 Posted October 4, 2014 Report Share Posted October 4, 2014 (edited) Think logically before you start working! clear list(%list) add list to list(%list, $list from file(#Load file), "Delete", "Global") loop($list total(%list)) { set(#test, $next list item(%list), "Global") alert("Item 1: {$substring(#test, 0, $find index(#test, ":"))} Item 2: {$replace($substring(#test, $find index(#test, ":"), $subtract($text length(#test), $find index(#test, ":"))), ":", "")}") } Edited October 4, 2014 by unurohack Quote Link to post Share on other sites
UBotBuddy 331 Posted October 4, 2014 Report Share Posted October 4, 2014 Ignore the length of this bots code. My point with this bot was to show an example of using the Delimiter of the line feed combined with Regex to build three different Lists from the original list of Test Data. clear list(%items1) clear list(%items2) clear list(%items3) add list to list(%MainList, $list from text("field1:field2:field3 fielda1:fielda2:fielda3 fieldb1:fieldb2:fieldb3 fieldc1:fieldc2:fieldc3", " "), "Delete", "Global") loop($list total(%MainList)) { set(#var, $next list item(%MainList), "Global") add item to list(%items1, $replace regular expression(#var, "(.\{1,\}).\{1,\}).\{1,\})", "$1"), "Delete", "Global") add item to list(%items2, $replace regular expression(#var, "(.\{1,\}).\{1,\}).\{1,\})", "$2"), "Delete", "Global") add item to list(%items3, $replace regular expression(#var, "(.\{1,\}).\{1,\}).\{1,\})", "$3"), "Delete", "Global") } clear list(%MainList) Quote Link to post Share on other sites
arunner26 51 Posted October 4, 2014 Report Share Posted October 4, 2014 JohnB,I tried clicking on your "Make a KILLING on eBay" link and it timed out and didn't display the page.I want to make a killing! Quote Link to post Share on other sites
UBotBuddy 331 Posted October 4, 2014 Report Share Posted October 4, 2014 I think that is a dead link. Buddy Quote Link to post Share on other sites
Black Automation 20 Posted October 12, 2014 Report Share Posted October 12, 2014 add list to list(%info, $list from file("{$special folder("Application")}\\yourfilehere.txt"), "Delete", "Global") set(#randomlist, $random list item(%info), "Global") set(#temp, $replace regular expression(#randomlist, ";.*", $nothing), "Global") set(#firstpart, $replace regular expression(#temp, ":.*", $nothing), "Global") set(#secondpart, $replace regular expression(#temp, ".*:", $nothing), "Global")Lets say yourfilehere.txt has the following: firstemail@yahoo.com:pass1 secondemail@yahoo.com:pass2 thirdemail@yahoo.com:pass3The top code will read the file, create a list using the yourfilehere.txt.Then pick a random LIST line.. Then turn "firstemail@yahoo.com" into #firstpartand pass1 to #secondpart I know this is an old thread, but seeing how it got bumped, figured id show an easy example. 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.