Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Thanked 0 Times in 0 Posts

    Searching Script

    Hey guys, I know very little java I took AP computer science in high school and have since forgotten most of it. I'm trying to write a code that :
    What I'm trying to do is have a script that loads a website such as

    and searches for a couple strings of words then if the strings aren't found
    it searches the next one, =000002, If it finds the strings that are required
    it would save the link or keep the page open and stop searching.
    I'm honestly not sure where to start so I came looking for a little bit of a
    shove in the right direction. Anybody with any ideas would be really


  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,841 Times in 4,802 Posts
    This is the javaSCRIPT forum. You can't do what you want in JavaScript (you can't load data from another site with JS), so I suspect you really do mean you want to use JAVA. About the only thing the two languages share are the first four letters of their names.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Regular Coder
    Join Date
    Sep 2011
    Thanked 14 Times in 14 Posts
    are you trying to implement pattern search?

  • #4
    Senior Coder
    Join Date
    Dec 2010
    Thanked 570 Times in 563 Posts
    I think you might want to install the add-on "Greasemonkey" for Firefox and start learning to use userscripts. You can do those kind of things with Greasemonkey easily.

    Example for a userscript
    // ==UserScript==
    // @name           Test for CF
    // @namespace      http://userscripts.org/users
    // @description    Test for CF
    // @include        http://www.anywebsite.com/showthread.php?t=*
    // ==/UserScript==
    // The header tells Greasemonkey on which pages it should run
    // The code below will run as soon as the page has been loaded, no need for onload here
    // customize wordlist here
    var wordlist = ["word1", "word2"];
    var found = true;
    var source = document.body.innerText;
    for(i=0; i<wordlist.length; i++) {
       if(source.indexOf(wordlist[i]) == -1) {
          // one of the words was not found
          found = false;
    if(!found) {
       // if at least one of the words was not found, go to next page
       // first extract the number
       var theHref = window.location.href;
       var theNextNumber = Number(theHref.substring(theHref.length-6))+1;
       theNextNumber = '000000' + theNextNumber;
       window.location.href = theHref.substring(0, theHref.length-6)+theNextNumber.substring(theNextNumber.length-6);


    Posting Permissions

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