Eric 15 Posted October 11, 2010 Report Share Posted October 11, 2010 Hi all, been quite a while since I touch my ubot I just found out that there is a new "contains" qualifier. So I would like to know how to use this new command, and what is the meaning of "container text" and "container list", any examples? It says that the contains qualifier will search for a specific text in the "container text" or "container list" and returns true. Thanks.. Quote Link to post Share on other sites
blazo 5 Posted October 11, 2010 Report Share Posted October 11, 2010 You can use it to test a lot of stuff example check if a variable has the value you want or if a value has been saved in a list I usually use it for checking if a variable has a value or not in it example .if contains #variable Search text (submission was successful)then create list or a table and save the results Quote Link to post Share on other sites
IRobot 43 Posted October 11, 2010 Report Share Posted October 11, 2010 "container text" : for example, a string such as "test me now", where you want to search for the text "me"."container list" : for example a list of items, where you want to search for a specific list item. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 Correct me if I am wrong but I do not believe that "Container List" works. At least it hasn't in my tests. I just ran a test on a list of 10 items and I was searching for a similar item in each. It did not find a single one. And it should have if I understood. Which leads me to believe that "Container List" means something totally different. Food for thought: IF "Container List" is for List then wouldn't it be awesome if it would return the $List Position. As it stand right now. I have to Load Next item into a variable and then do a "Contains" check to see if what I am searching for is in there. If a "Contains" check could return a $List position THEN for large list I could see that reducing CPU cycles. Just a thought. Quote Link to post Share on other sites
IRobot 43 Posted October 11, 2010 Report Share Posted October 11, 2010 Hi Buddy, I just added 5 items to a list and then did a if %list contains Search text.This worked Ok. Then I did a negative test, for something that wasn't a list item and this works as well. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 iRobot, Thanks for that. Try this. Open a new bot. Read a list from a file. THEN do a search using "Contains" and see if that works. I am thinking that if you are building a list then that will be different in memory rather than reading a list in from a file. Buddy Quote Link to post Share on other sites
IRobot 43 Posted October 11, 2010 Report Share Posted October 11, 2010 Buddy, I read 10 items from a text file, and the list contains works Ok. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 Thanks for checking. Hmmm I am wondering why it does not work. Can you share your code? Quote Link to post Share on other sites
IRobot 43 Posted October 11, 2010 Report Share Posted October 11, 2010 Can you share your code?No problem. Make sure you have a list.txt file in your My Documents folder, that contains 'peach' and doesn't contain 'spinach'. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 Check this out. This is what I have been trying to do. http://screencast.com/t/Zy8naDF1zO I did make a couple of minor tweaks but it still does not work. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 The file that I am loading into my list is a list of URLs and www.yahoo.com is one of them. I am trying to search for yahoo but no luck. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 Hmmmmm I don't like this. The list item has to be an exact to what you are comparing to. I want it to tell me that my search term is in that line. So its working and then again its not working. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 This is what I am trying to achieve but using the method I showed you before this one. In my opinion, this method requires more CPU cycles http://screencast.com/t/xdP9SraJ2W Quote Link to post Share on other sites
IRobot 43 Posted October 11, 2010 Report Share Posted October 11, 2010 I am trying to search for yahoo but no luck.Hey Buddy. Check this out:contains2.uboturl-list.txt Place the url-list.txt your My Documents folder. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 Yes, but just search on yahoo or bananaman and it will fail. I say it should work like the example I just posted. before you. Quote Link to post Share on other sites
IRobot 43 Posted October 11, 2010 Report Share Posted October 11, 2010 Yes, but just search on yahoo or bananaman and it will fail. I say it should work like the example I just posted. before you.Ok, I see what you're saying. Sorry, but it's still working Ok for me:contains3.ubot Quote Link to post Share on other sites
UBotBuddy 331 Posted October 11, 2010 Report Share Posted October 11, 2010 Yes, it will work this way. But your other code it won't if you use the same search criteria. Quote Link to post Share on other sites
UBotBuddy 331 Posted October 12, 2010 Report Share Posted October 12, 2010 For those of you that are interested here are two Bots that I am struggling with. Not that they do not work. They both work but each processes the "contains" qualifier differently. In example 1, the search criteria must EXACTLY match an item in the list. If it doesn't then the alert will not pop up. In example 2, the search criteria can be a partial of a item in the list. However, using the same logic from example 1 does not work. No matter how many times yp try it will not find your selection UNLESS you type in the whole item. However, in example 2 what I did was constructed a Loop whereby each list item is loaded into a variable using the Set node. Then it is checked using the Contains qualifier. Voila! It found the partial. In my opinion, example 1 should work. Why? If you happen to be using a large list then cycling through the entire list using Example 2 is a waste of resources. Granted, our computers are probably not going to show a considerable amount of sluggishness. So, is this a Bug? To be honest I have no clue. I do think it might be worth checking it out. Of course I cannot do that. LOL IF it is a bug then would it be possible to fix it in such a way that it could return the List's Position that it was found in? That my friends would be Kool! IF NOTHING ELSE comes from this. Then take this as an example of how to accomplish a problem from two different perspectives! Oh!No bots were hurt in the testing process here nor was my Start button. Thanks goes to iRobot for the data file that I started using.url-list.txtContains-Example-1.ubotContains-Example-2.ubot Quote Link to post Share on other sites
Seth Turin 223 Posted October 12, 2010 Report Share Posted October 12, 2010 the reason is that contains treats single pieces of text differently than it treats lists. in a piece of text, it will look to see if the text contains the thing you're looking for. in a list, it will look to see if the list contains an item that is the same as the text you're looking for. I think it would create too many problems to set it up as you described, and if you have a really long list, you might get a positive search result when you didn't really want it. 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.