Reverze 0 Posted January 28, 2013 Report Share Posted January 28, 2013 I have a new challenge that already cost me about 3 hours and I can't figure it out I have this code: <td style="padding:4px;background-color:#203e42">just some text*</td>I need to make a IF condition that needs to look if there is a star behind the text or not (the text is different every time).I need to use outerhtml because the backgroundcolor also need to exists.I already tried the following and more but without success: if($exists(<outerhtml=w"<td style=\"padding:4px;background-color:#203e42\">*\*</td>">)) { then { alert("Star") } if($exists(<outerhtml=w"<td style=\"padding:4px;background-color:#203e42\">*"*"</td>">)) {then {alert("Star")} if($exists(<outerhtml=w"<td style=\"padding:4px;background-color:#203e42\">*'*'</td>">)) {then {alert("Star")}Is it possible to do this with only a $exists? Quote Link to post Share on other sites
VaultBoss 310 Posted January 28, 2013 Report Share Posted January 28, 2013 You should first scrape the data you want to a variableand test the variable for whatever you need it to have after that. Quote Link to post Share on other sites
Reverze 0 Posted January 28, 2013 Author Report Share Posted January 28, 2013 I don't understand why it's not possible with a single $exists.I searched the forums and read this topic http://www.ubotstudio.com/forum/index.php?/topic/6026-wildcard-not-working-correctly/?p=34047There they say you can escape characters like * with [*]. Is that not working anymore in the newer releases of ubot? Quote Link to post Share on other sites
Reverze 0 Posted January 28, 2013 Author Report Share Posted January 28, 2013 I've got it to work with the same method you explained me yesterday, but still I think it should be possible with a single $exists The version that works now is: set(#Star, $scrape attribute(<outerhtml=w"<td style=\"padding:4px;background-color:#203e42\">*</td>">,"innertext"), "Global") set(#Star, $find regular expression(#Star, "\\*"), "Global") set(#Star, $trim(#Star), "Global") if($comparison(#Star, "=", "*")) { then { alert("Star") } Thanks for your time again VaultBoss! Quote Link to post Share on other sites
blumi40 222 Posted January 29, 2013 Report Share Posted January 29, 2013 if($contains($scrape attribute(<outerhtml=w"<td style=\"padding:4px;background-color:#203e42\">*</td>">,"innertext"), "*")) { then { alert("Star") } else { alert("No Star") }} 1 Quote Link to post Share on other sites
VaultBoss 310 Posted February 20, 2013 Report Share Posted February 20, 2013 For some reason, $exists seems to fail working in certain instances, but Blumi's workaround does. Thanks mate... 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.