Results 1 to 3 of 3
- 06-08-2012, 04:14 PM #1
Member
- Join Date
- Jun 2012
- Posts
- 2
- Rep Power
- 0
Simple IF string contains or startswith
Hello,
Not sure if im in the right place, but Im a complete novice with Java.
can someone help me with this (not so apparently) simple request.
I need code along the lines of;
Java Code:var str= windows.content.getelementbyID"lblMsg".text ; if(str.search("Congratulations!") != -1) { iimplay macrohere.iim else iimplay macro2.imm
basically, I want to search the "lblmsg" for the word congratulations. If it does, I want it to run imacro1 if not, then run imacro2.
Can anyone please help? :(
ive also tried this, which works for EXACT matches, but the "lblmsg" contains the word "you've" and I dont know how to write the ' in Java :|
Java Code:iimPlay("CODE:SET !ERRORIGNORE YES"); for (i = 0; i <= 99998; i++) { if (window.content.document.getElementById("lblMsg").text == 'You've lost'){ iimPlay("Loss.iim"); }else { iimPlay("win.iim"); } }
All help is appreciated.
Thanks in advance,
Mike.
- 06-08-2012, 04:18 PM #2
Re: Simple IF string contains or startswith
Try a javascript forum. This one is for java.
If you don't understand my response, don't ignore it, ask a question.
- 06-08-2012, 04:24 PM #3
Member
- Join Date
- Jun 2012
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
parse simple string with regex?
By zardos in forum New To JavaReplies: 1Last Post: 03-01-2011, 12:14 PM -
SIMPLE String problem
By vince_enzwo in forum New To JavaReplies: 15Last Post: 02-13-2011, 04:06 PM -
Error: "The method startsWith(String, String) is undefined for the type StringUtils"
By shihad_s in forum New To JavaReplies: 10Last Post: 12-07-2010, 12:29 PM -
Simple string add or subtract using scanner
By weezer562 in forum New To JavaReplies: 12Last Post: 10-21-2010, 08:23 PM -
Strings made by scanner don't work with startsWith() method
By samza in forum New To JavaReplies: 13Last Post: 05-16-2010, 12:09 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks