easternfade 0 Posted January 27, 2010 Report Share Posted January 27, 2010 Gday.. I am trying to do the following in a sub:- check for various items on a page- if not present, return false, else return true I have tried to plug the sub into the qualifier part of an if statement, but it always seems to evaluate as true. I also tried setting a variable with the Sub as the input, but Ubot gets an Invalid Cast Exception. The video that's supposed to be on returning from subs is actually about error reporting, so I couldn't find any info there. Hope that makes sense - I can post screenshots. Any help greatly appreciated! Thanks Quote Link to post Share on other sites
bluegoat 24 Posted January 27, 2010 Report Share Posted January 27, 2010 This should do the trick... Quote Link to post Share on other sites
easternfade 0 Posted January 27, 2010 Author Report Share Posted January 27, 2010 This should do the trick... Thanks a lot for that! So then when I return #sub, do I just check the return value by using an If block in the main script? That's the bit I couldn't get right.. Quote Link to post Share on other sites
hannahmcintyre 2 Posted January 29, 2010 Report Share Posted January 29, 2010 Thanks a lot for that! So then when I return #sub, do I just check the return value by using an If block in the main script? That's the bit I couldn't get right..Yes, you need to run the sub and THEN have the if command see if whatever you want is true. 1 Quote Link to post Share on other sites
easternfade 0 Posted January 29, 2010 Author Report Share Posted January 29, 2010 Yes, you need to run the sub and THEN have the if command see if whatever you want is true. Thanks Hannah, I haven't had a chance to try the suggestions yet, but do you mean I should set a variable with the result from the sub, or put the Run Sub call directly in the If statement's qualifier block? Cheers.. Quote Link to post Share on other sites
easternfade 0 Posted January 29, 2010 Author Report Share Posted January 29, 2010 It's late and I am probably doing something dumb, but I am having an issue trying to get past the error in the attachment. I've also tried putting $return value straight into the if qualifier. The contents of the sub being called is exactly the same as the example bluegoat posted above. Any ideas? Thanks! 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.