cptnmacro 0 Posted August 2, 2011 Report Share Posted August 2, 2011 I have a script that pulls credentials from one list and items to post from another. Both lists are created from local files. The credentials list may only have 5 items in the list, whereas the items to post list may have 50 or more. Regardless of whether I select random item, or next list item, I can never post more than the total number of items in the credentials list. I want the bot to continue to select an item from the credentials list until it has finished with the items list. Make sense? Quote Link to post Share on other sites
JohnB 255 Posted August 2, 2011 Report Share Posted August 2, 2011 Yes it does. You will need to use the list total of the items list as the number of cycles in the loop. You could then do something like: In the credentials list, add an if statement..."IF--->list position = $list totalThen--->set position =0 (to restart the list). There are other ways of handling this as well, but i think that's one of the simplest ways to do it. In order for this to work you will need to set #position to 0 and use $list item (for the credentials list)...you will NOT want to use this method on the items list as it will start at the beginning when the list total of the credentials list is reached. Therefore you could use $next list item or random list item on the items list. John 1 Quote Link to post Share on other sites
cptnmacro 0 Posted August 2, 2011 Author Report Share Posted August 2, 2011 Yes it does. You will need to use the list total of the items list as the number of cycles in the loop. You could then do something like: In the credentials list, add an if statement..."IF--->list position = $list totalThen--->set position =0 (to restart the list). There are other ways of handling this as well, but i think that's one of the simplest ways to do it. In order for this to work you will need to set #position to 0 and use $list item (for the credentials list)...you will NOT want to use this method on the items list as it will start at the beginning when the list total of the credentials list is reached. Therefore you could use $next list item or random list item on the items list. John Thank you master Yoda. Is there anyway to remove the posted items from the csv file after they have been processed? I'm currently writing a log file, but I would like to remove the posted items from the file, or write a value back to the original csv to mark them as done? Quote Link to post Share on other sites
JohnB 255 Posted August 2, 2011 Report Share Posted August 2, 2011 What you could do is something like this: If the data from the csv file is in a table, for example, that has 3 columns of data (columns 0,1 and 2), you could use the $set table cell command to add "Completed" to column 3 (which is column#4 since they are 0 based). If the data is being pulled from a list you can use the $remove list item command after using it. But by doing that you will need to both decrement the list position and increment it after removing an item. (because the next list item would by assuming the position of the one you just removed) John 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.