webpro 31 Posted December 22, 2013 Report Share Posted December 22, 2013 I'm trying to remove from a list an id ex:22221131 which is added into a command.But it's not working as it needs a position (under REMOVE FROM LIST)As the ID and the Position will never be same, what could be the code ? In other words, i want to pick up a random user/id to comment to and remove him from the list to make sure i don't double comment on it.While at it, we should have the option to remove from list when using $random list item clear list(%commenting) add list to list(%commenting, $scrape attribute(<outerhtml=w"<textarea class=\"item_input new_comment_input list_comment_text\" name=\"comment_text\" id=\"*_comment_text\" placeholder=\"Leave a Comment..\" image_id=\"*\"></textarea>">, "image_id"), "Delete", "Global") loop($list total(%commenting)) { set(#commentingid, $random list item(%commenting), "Global") type text(<id="{#commentingid}_comment_text">, #commenting, "Standard") remove from list(%commenting, #commentingid) Quote Link to post Share on other sites
Edward_2 85 Posted December 22, 2013 Report Share Posted December 22, 2013 Maybe "Set" List position in a variable after set(#commentingid, $random list item(%commenting), "Global") Then remove from list(%commenting, #commentingid), The list position set in the Var Hope it helps. Quote Link to post Share on other sites
Pete 121 Posted December 22, 2013 Report Share Posted December 22, 2013 navigate("http://m.bing.com/", "Wait")clear list(%temp)add list to list(%temp, $list from text("123423453456", $new line), "Delete", "Global")loop(3) { set(#listitem, $random list item(%temp), "Global") change attribute(<name="q">, "value", #listitem) remove from list(%temp, $list position(%temp)) wait(5)} Quote Link to post Share on other sites
webpro 31 Posted December 22, 2013 Author Report Share Posted December 22, 2013 Thanks guys Quote Link to post Share on other sites
webpro 31 Posted December 22, 2013 Author Report Share Posted December 22, 2013 What should i use for the loop ?I tried $list total but it gives me the same IDS more than once even tho it's removed ?EDITED:Odd, seems like the wrong IDS are removed too ??? So what's suppose to be removed stays in the list and something else is removed for sure as the list gets smaller and smaller what the heck lol ! loop($list total(%commenting)) { set(#commentingid, $random list item(%commenting), "Global") type text(<id="{#commentingid}_comment_text">, #commenting, "Standard") wait($rand(3, 6)) change attribute(<name="q">, "value", #commentingid) remove from list(%commenting, $list position(%commenting)) } Quote Link to post Share on other sites
samcro 2 Posted December 22, 2013 Report Share Posted December 22, 2013 What should i use for the loop ?I tried $list total but it gives me the same IDS more than once even tho it's removed ?EDITED:Odd, seems like the wrong IDS are removed too ??? So what's suppose to be removed stays in the list and something else is removed for sure as the list gets smaller and smaller what the heck lol ! loop($list total(%commenting)) { set(#commentingid, $random list item(%commenting), "Global") type text(<id="{#commentingid}_comment_text">, #commenting, "Standard") wait($rand(3, 6)) change attribute(<name="q">, "value", #commentingid) remove from list(%commenting, $list position(%commenting)) } I think you may have a small error in the code. Based on what Edward_2 posted above, I believe the last line should look like this: remove from list(%commenting, #commentingid) Currently the code above shows this (highlighted in red), which might be the culprit: remove from list(%commenting, $list position(%commenting)) Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted December 22, 2013 Report Share Posted December 22, 2013 Use this from Filemanagement plugin plugin command("File Management.dll", "remove all from list", %commenting, #commentingid) TC Quote Link to post Share on other sites
webpro 31 Posted January 5, 2014 Author Report Share Posted January 5, 2014 Both of you guys are right !I got the file management plugin so i will use this from now on and i did have an error in my code.I had 2 commenting which the old dumb a$$ musician of me, didn't see the difference at first LOLGood ol' engrish and me stie Thanks a lot guys !Next song's on me hehehehe 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.