Results 1 to 3 of 3
  1. #1
    robotacha is offline Member
    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

    Unhappy 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.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default 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.

  3. #3
    robotacha is offline Member
    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

Similar Threads

  1. parse simple string with regex?
    By zardos in forum New To Java
    Replies: 1
    Last Post: 03-01-2011, 12:14 PM
  2. SIMPLE String problem
    By vince_enzwo in forum New To Java
    Replies: 15
    Last Post: 02-13-2011, 04:06 PM
  3. Replies: 10
    Last Post: 12-07-2010, 12:29 PM
  4. Simple string add or subtract using scanner
    By weezer562 in forum New To Java
    Replies: 12
    Last Post: 10-21-2010, 08:23 PM
  5. Replies: 13
    Last Post: 05-16-2010, 12:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •