Results 1 to 12 of 12
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Need help with an if statement

  1. #1
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Need help with an if statement

    I am using the robot class to make a bot that does a task for me. Every once and a while there is a problem (not with the bot, with the task I am doing) and I need the bot to recognize that and click on something else other than what is programmed in the loop. I am not sure how to write an if statement that can say something like "if there is no follow button on the screen blah blah blah". Please help me out.

    Thanks

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

    Default Re: Need help with an if statement

    Are there variables whose values you can test for the desired condition to be true or false?
    Are there methods you can call to get values that can be tested?


    What is/are the condition(s) that you want to test? How can you get the data to test that/those conditions?
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: Need help with an if statement

    It's a we page that says account suspended on it. That's why I'm not sure how to go about creating this.

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

    Default Re: Need help with an if statement

    Are you asking: How would a program detect if that page is being displayed on the screen/monitor? I assume you mean that a browser has loaded and is displaying a web page.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: Need help with an if statement

    Yes that's exactly what I mean. The thing is the bot is clicking all the time and I have to differentiate between if it's going to the right place or if the account is suspended and the bot should do something else

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

    Default Re: Need help with an if statement

    So you need to capture the screen and scan the image to see what is being shown.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: Need help with an if statement

    Sorry I literally just started coding with java this week. Could you elaborate on that please? How would I do that?

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

    Default Re: Need help with an if statement

    The Robot class has a method that will capture the screen in an image.
    The BufferedImage class has methods that will return the color of a pixel.
    Scan through the pixels in the image for what you want to recognize.
    If you don't understand my response, don't ignore it, ask a question.

  9. #9
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: Need help with an if statement

    Ok thank you very much for your help? I will post back if I run into trouble

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

    Default Re: Need help with an if statement

    Good luck.
    If you don't understand my response, don't ignore it, ask a question.

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Need help with an if statement

    Quote Originally Posted by Joethemonkey101 View Post
    Yes that's exactly what I mean. The thing is the bot is clicking all the time and I have to differentiate between if it's going to the right place or if the account is suspended and the bot should do something else
    Just to put things in their proper perspective, you want forum members to help you with a bot that does stuff that leads to accounts being suspended?

    There are already more than enough spammers around, thank you.

    db
    quad64bit likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  12. #12
    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Default Re: Need help with an if statement

    Quote Originally Posted by DarrylBurke View Post
    Just to put things in their proper perspective, you want forum members to help you with a bot that does stuff that leads to accounts being suspended?

    There are already more than enough spammers around, thank you.

    db
    It's complicated but no the bot doesn't get accounts suspended

Similar Threads

  1. Replies: 2
    Last Post: 03-26-2012, 04:27 PM
  2. Mod and If Statement
    By Valerie1067 in forum New To Java
    Replies: 8
    Last Post: 03-25-2012, 08:00 AM
  3. Help with If and Else statement
    By Aionia in forum New To Java
    Replies: 18
    Last Post: 03-13-2011, 07:50 AM
  4. if statement help please!!
    By soc86 in forum New To Java
    Replies: 5
    Last Post: 12-02-2008, 02:56 PM
  5. Statement or Prepared Statement ?
    By paty in forum JDBC
    Replies: 3
    Last Post: 08-01-2007, 04:45 PM

Posting Permissions

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