How to extract the clocktimer and put a random time ?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

How to extract the clocktimer and put a random time ?

by gUSTAVO on Mon Aug 07, 2017 4:25 am

I am not a programmer at all and I am having difficulty understanding and correcting this code I made

When I excute the script it runs perfectly until the time to extract the clock and wait the time necessary to repeat the same process

And I get the following error

TypeError: window.document.querySelector(...) is null, line 42 (Error code: -991)

Windows 7 English, Firefox 47, Imacros 8.9.7
can you help ?

I am not a programmer, I just ask for help, because I found the script on the internet. It is working everything right, but when it comes time to extract the clock and wait for the count extracted from the clock it ignores and goes to the next command that is to click on the button.

Please help me to correct this code

Code: Select all
var t0='SET !TIMEOUT_STEP 0\n', strings = "" ;
var bit = '338bpyc69ooEUtWvQ64b4VgigAUKgE87mi';

var Faucethub = 0 // Withdrawal para Faucethub, 1 - on, 0 - off.
var FaucetSystem = 0 // Withdrawal para Faucethub, 1 - on, 0 - off.

var surf = 0 // PTCWall Surf, 1 - on., 0 - off.

var Tabs = {
   _browser: function () {
      var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
         .getService(Components.interfaces.nsIWindowMediator);
      return wm.getMostRecentWindow("navigator:browser").gBrowser;
   }(),
   go: function (tabIndex) {
      this._browser.selectedTab = this._browser.tabContainer.childNodes[tabIndex - 1];
   }
};

var loadFile = function (fileName) {
    var fileDescriptor = imns.FIO.openNode(fileName);
    var text = imns.FIO.readTextFile(fileDescriptor);
    return {
        text: text,
        strings: text.replace(/ /gi, "").split("\r\n")
    };
};

   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/ref/338bpyc69ooEUtWvQ64b4VgigAUKgE87mi'); weit(2);
   var balance = getBalance();
   if (!balance) {
      avtorizacia();
   }
for (;;) {
   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(1.5);
   iimPlayCode(t0+'TAG POS=1 TYPE=SPAN ATTR=ID:clock EXTRACT=HREF');
   var clock = iimGetLastExtract().match(/\d+/);
   if (Number(clock) > 10) {
      weit((Number(clock)*30)+10);
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(2);
      }
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(5);
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:Claim'); weit(2);
   window.scrollBy(0,100); weit(1);
   iimPlayCode(`
   SET !ENCRYPTION NO
   PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1 
   TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
   SET !SINGLESTEP {{!VAR1}}
   SET !SINGLESTEP NO
   `); weit(1);
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2);
   if (Number(surf)>=1){ptcwall()};
   var balance = getBalance();
   
   if (Number(balance) > 10000) {
      if (Number (Faucethub) >=1){
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/account');
      window.document.querySelector('button[class="btn btn-sm btn-primary btn-block"][data-toggle="modal"][data-target=".bs-withdraw-modal-lg"]').click(); weit(3);
      window.document.querySelector('input[type="radio"][name="withdraw"][value="FaucetHub.io"][required=""]').click(); weit(1);
   }   iimPlayCode(`
      SET !ENCRYPTION NO
      PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1
      TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
      WAIT SECONDS = 2`); weit(1);
      window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2)
   }

   if (Number(balance) > 10000) {
      if (Number (FaucetSystem) >=1){
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/account'); weit(2);
      window.document.querySelector('button[class="btn btn-sm btn-primary btn-block"][data-toggle="modal"][data-target=".bs-withdraw-modal-lg"]').click(); weit(3);
      window.document.querySelector('input[type="radio"][name="withdraw"][value="FaucetSystem.com"][required=""]').click(); weit(1);
   }   iimPlayCode(`WAIT SECONDS = 2
      SET !ENCRYPTION NO
      PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1
      TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
      WAIT SECONDS = 2`); weit(1);
      window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2)
   }
   iimDisplay('Seu Saldo e = '+(Number(balance)/100000000).toFixed(8)+' BTC');
   
}

         /***-= Verificando seu Saldo =-***/
function getBalance() {
    iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:"panel-body" EXTRACT=TXT');
    var balance = +iimGetExtract().replace(/,/gi, "").match(/\d+/g);
    if (balance !== "#EANF#") {
        return balance;
    }
    return false;
}
   
         /***-= Login =-***/
function avtorizacia() {
   window.document.querySelector('input[type="text"][name="address"]').value=bit;
   iimPlayCode(`
   TAG POS=1 TYPE=A ATTR=TXT:Entrar
   SET !ENCRYPTION NO
   PROMPT "Resolva o Captch (Click em Ok para Continuar):" !VAR1 
   TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
   TAG POS=1 TYPE=BUTTON FORM=ACTION:/ ATTR=ID:button
   `); weit(2);
}

function ptcwall() {
   iimPlayCode('URL GOTO=bitlucky.io/offerwall');
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:PTCWall"');
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:Open<SP>PTCWall<SP>in<SP>new<SP>tab');
   iimPlayCode(t0+'TAG POS=1 TYPE=BUTTON ATTR=TXT:Close');
   for(sqku=1; sqku<=50; sqku++){ iimDisplay('Estou Resolvendo '+sqku+' Aguarde');
   iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:ad&&STYLE:"" EXTRACT=HTM');
      if(iimGetExtract().indexOf('EANF')>0 || iimGetExtract().indexOf('onclick')<0) break;
      var claim=iimGetExtract().replace(/&amp;/g,'&').match(/window.*?\);/);
      iimPlayCode('TAG POS=1 TYPE=SPAN ATTR=ONCLICK:'+claim); weit(1);
      if(iimPlayCode(t0+'TAG POS=1 TYPE=H2 ATTR=TXT:Warning')>0){window.close();return;}
      var timerId = window.setInterval(function() { onClick=window.focus();}, 2000);
   for(skz=1; skz<=3000; skz++){
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=ID:vnumbers&&STYLE:"" EXTRACT=HTM'); var down=iimGetLastExtract();
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=ID:vnumbers&&STYLE:float:* EXTRACT=HTM'); var picture=iimGetLastExtract();
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:errorbox EXTRACT=HTM'); var error=iimGetLastExtract();
      if(down.indexOf('down picture')>0 || picture.indexOf('down picture')>0 || error.indexOf('Advertisement')>0 || error.indexOf('advertisement')>0) break;}
      if(error.indexOf('Advertisement')>0 || error.indexOf('advertisement')>0){ Tabs.go(2); iimPlayCode('REFRESH'); Tabs.go(3);}
      window.setTimeout(function() { window.clearInterval(timerId);}, 100);
      weit(1.5);
      iimPlayCode('ONDOWNLOAD FOLDER=C:\\Perevernut\\ FILE=b.png WAIT=YES\nTAG POS=1 TYPE=IMG ATTR=SRC:modules.php?* CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT');

   var shablon=['be6821c681026e048e86b1308dbb8311','15821c7d43fd9f53a96041603437c4ab','ad5f4d5f8ef29e5d116daa4ecf61853b','2267fd54340d2113d31f47e1a0e81185','2253674278966e65a1f776c8570bf9c6','755093054fa517d3adc008c6892b84b5','6aa801993ebdd5b64b4d65c3b5f7a9d1','830511874dc03cdd0d23f360cf035825','5af11f12e88f81cdd2d6d9dce4454789','64d9969214e7146e52771498a9173bda'];
   crop();
   hashfile();
   try {
   for (i=0; i<strings.length; i++) {
      for (j=0; j<shablon.length; j++) {
         if (strings[i]==shablon[j]) {
            var numer=i+1;
            iimPlayCode('TAG POS=1 TYPE=AREA ATTR=ONCLICK:endprogress('+numer+');&&HREF:javascript:void(0);&&COORDS:*&&SHAPE:rect');
            var timerId = window.setInterval(function() { onClick=window.focus();}, 2000); weit(10); break; //Achei o Captch weit(10);
            }
         }
      }
   } catch(e) {weit(0.5);};
   strings = "";
   window.close();}
   Tabs.go(1);
    iimPlayCode(t0+'TAB CLOSEALLOTHERS');
}

          /***-= Captch =-***/
function crop(){ iimDisplay('Estou Resolvendo '+sqku+' Captcha');
    var Cc=Components.classes, Ci=Components.interfaces, args=['C:\\Perevernut\\crop.vbs'];
    var proc=Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
    var file=Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
    file.initWithPath('C:\\Windows\\System32\\wscript.exe');
    proc.init(file); proc.run(false, args, args.length); weit(3);}

          /***-= Resoluçao do Arquivo Hash =-***/
function hashfile() { iimDisplay("Estou Resolvendo " + sqku + " a soma do Arquivo Hash");
    var Cc = Components.classes, Ci = Components.interfaces, args = ["C:\\Perevernut\\hashfile.vbs"];
        var proc = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
        var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
        file.initWithPath("C:\\Windows\\System32\\wscript.exe");
        proc.init(file); proc.run(false, args, args.length); weit(10);
        try {
         strings = loadFile("C:\\Perevernut\\out.txt").strings;
      } catch(e) {};
iimPlayCode("FILEDELETE NAME=C:\\Perevernut\\out.txt\nFILEDELETE NAME=C:\\Perevernut\\b.png");}

         /***-= Executando Tarefa =-***/
function weit(s) {iimPlayCode("WAIT SECONDS=" + s);}


most likely

Code: Select all
for (;;) {
   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(1.5);
   iimPlayCode(t0+'TAG POS=1 TYPE=SPAN ATTR=ID:clock EXTRACT=HREF');
   var clock = iimGetLastExtract().match(/\d+/);
   if (Number(clock) > 10) {
      weit((Number(clock)*30)+10);
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(2);
      }
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(5);
Last edited by gUSTAVO on Tue Aug 08, 2017 1:11 pm, edited 1 time in total.
gUSTAVO
 
Posts: 5
Joined: Mon Aug 07, 2017 2:21 am

Re: Please help me to correct this code

by chivracq on Tue Aug 08, 2017 10:43 am

gUSTAVO wrote:
Code: Select all
Windows 7 English, Firefox 47, Imacros 8.9.7

I am not a programmer at all and I am having difficulty understanding and correcting this code I made

When I excute the script it runs perfectly until the time to extract the clock and wait the time necessary to repeat the same process

And I get the following error

Code: Select all
TypeError: window.document.querySelector(...) is null, line 42 (Error code: -991)


Code: Select all
Windows 7 English, Firefox 47, Imacros 8.9.7

can you help ?

I am not a programmer, I just ask for help, because I found the script on the internet. It is working everything right, but when it comes time to extract the clock and wait for the count extracted from the clock it ignores and goes to the next command that is to click on the button.

Please help me to correct this code

Code: Select all
var t0='SET !TIMEOUT_STEP 0\n', strings = "" ;
var bit = '338bpyc69ooEUtWvQ64b4VgigAUKgE87mi';

var Faucethub = 0 // Withdrawal para Faucethub, 1 - on, 0 - off.
var FaucetSystem = 0 // Withdrawal para Faucethub, 1 - on, 0 - off.

var surf = 0 // PTCWall Surf, 1 - on., 0 - off.

var Tabs = {
   _browser: function () {
      var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
         .getService(Components.interfaces.nsIWindowMediator);
      return wm.getMostRecentWindow("navigator:browser").gBrowser;
   }(),
   go: function (tabIndex) {
      this._browser.selectedTab = this._browser.tabContainer.childNodes[tabIndex - 1];
   }
};

var loadFile = function (fileName) {
    var fileDescriptor = imns.FIO.openNode(fileName);
    var text = imns.FIO.readTextFile(fileDescriptor);
    return {
        text: text,
        strings: text.replace(/ /gi, "").split("\r\n")
    };
};

   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/ref/338bpyc69ooEUtWvQ64b4VgigAUKgE87mi'); weit(2);
   var balance = getBalance();
   if (!balance) {
      avtorizacia();
   }
for (;;) {
   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(1.5);
   iimPlayCode(t0+'TAG POS=1 TYPE=SPAN ATTR=ID:clock EXTRACT=HREF');
   var clock = iimGetLastExtract().match(/\d+/);
   if (Number(clock) > 10) {
      weit((Number(clock)*30)+10);
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(2);
      }
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(5);
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:Claim'); weit(2);
   window.scrollBy(0,100); weit(1);
   iimPlayCode(`
   SET !ENCRYPTION NO
   PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1 
   TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
   SET !SINGLESTEP {{!VAR1}}
   SET !SINGLESTEP NO
   `); weit(1);
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2);
   if (Number(surf)>=1){ptcwall()};
   var balance = getBalance();
   
   if (Number(balance) > 10000) {
      if (Number (Faucethub) >=1){
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/account');
      window.document.querySelector('button[class="btn btn-sm btn-primary btn-block"][data-toggle="modal"][data-target=".bs-withdraw-modal-lg"]').click(); weit(3);
      window.document.querySelector('input[type="radio"][name="withdraw"][value="FaucetHub.io"][required=""]').click(); weit(1);
   }   iimPlayCode(`
      SET !ENCRYPTION NO
      PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1
      TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
      WAIT SECONDS = 2`); weit(1);
      window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2)
   }

   if (Number(balance) > 10000) {
      if (Number (FaucetSystem) >=1){
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/account'); weit(2);
      window.document.querySelector('button[class="btn btn-sm btn-primary btn-block"][data-toggle="modal"][data-target=".bs-withdraw-modal-lg"]').click(); weit(3);
      window.document.querySelector('input[type="radio"][name="withdraw"][value="FaucetSystem.com"][required=""]').click(); weit(1);
   }   iimPlayCode(`WAIT SECONDS = 2
      SET !ENCRYPTION NO
      PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1
      TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
      WAIT SECONDS = 2`); weit(1);
      window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2)
   }
   iimDisplay('Seu Saldo e = '+(Number(balance)/100000000).toFixed(8)+' BTC');
   
}

         /***-= Verificando seu Saldo =-***/
function getBalance() {
    iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:"panel-body" EXTRACT=TXT');
    var balance = +iimGetExtract().replace(/,/gi, "").match(/\d+/g);
    if (balance !== "#EANF#") {
        return balance;
    }
    return false;
}
   
         /***-= Login =-***/
function avtorizacia() {
   window.document.querySelector('input[type="text"][name="address"]').value=bit;
   iimPlayCode(`
   TAG POS=1 TYPE=A ATTR=TXT:Entrar
   SET !ENCRYPTION NO
   PROMPT "Resolva o Captch (Click em Ok para Continuar):" !VAR1 
   TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
   TAG POS=1 TYPE=BUTTON FORM=ACTION:/ ATTR=ID:button
   `); weit(2);
}

function ptcwall() {
   iimPlayCode('URL GOTO=bitlucky.io/offerwall');
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:PTCWall"');
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:Open<SP>PTCWall<SP>in<SP>new<SP>tab');
   iimPlayCode(t0+'TAG POS=1 TYPE=BUTTON ATTR=TXT:Close');
   for(sqku=1; sqku<=50; sqku++){ iimDisplay('Estou Resolvendo '+sqku+' Aguarde');
   iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:ad&&STYLE:"" EXTRACT=HTM');
      if(iimGetExtract().indexOf('EANF')>0 || iimGetExtract().indexOf('onclick')<0) break;
      var claim=iimGetExtract().replace(/&amp;/g,'&').match(/window.*?\);/);
      iimPlayCode('TAG POS=1 TYPE=SPAN ATTR=ONCLICK:'+claim); weit(1);
      if(iimPlayCode(t0+'TAG POS=1 TYPE=H2 ATTR=TXT:Warning')>0){window.close();return;}
      var timerId = window.setInterval(function() { onClick=window.focus();}, 2000);
   for(skz=1; skz<=3000; skz++){
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=ID:vnumbers&&STYLE:"" EXTRACT=HTM'); var down=iimGetLastExtract();
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=ID:vnumbers&&STYLE:float:* EXTRACT=HTM'); var picture=iimGetLastExtract();
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:errorbox EXTRACT=HTM'); var error=iimGetLastExtract();
      if(down.indexOf('down picture')>0 || picture.indexOf('down picture')>0 || error.indexOf('Advertisement')>0 || error.indexOf('advertisement')>0) break;}
      if(error.indexOf('Advertisement')>0 || error.indexOf('advertisement')>0){ Tabs.go(2); iimPlayCode('REFRESH'); Tabs.go(3);}
      window.setTimeout(function() { window.clearInterval(timerId);}, 100);
      weit(1.5);
      iimPlayCode('ONDOWNLOAD FOLDER=C:\\Perevernut\\ FILE=b.png WAIT=YES\nTAG POS=1 TYPE=IMG ATTR=SRC:modules.php?* CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT');

   var shablon=['be6821c681026e048e86b1308dbb8311','15821c7d43fd9f53a96041603437c4ab','ad5f4d5f8ef29e5d116daa4ecf61853b','2267fd54340d2113d31f47e1a0e81185','2253674278966e65a1f776c8570bf9c6','755093054fa517d3adc008c6892b84b5','6aa801993ebdd5b64b4d65c3b5f7a9d1','830511874dc03cdd0d23f360cf035825','5af11f12e88f81cdd2d6d9dce4454789','64d9969214e7146e52771498a9173bda'];
   crop();
   hashfile();
   try {
   for (i=0; i<strings.length; i++) {
      for (j=0; j<shablon.length; j++) {
         if (strings[i]==shablon[j]) {
            var numer=i+1;
            iimPlayCode('TAG POS=1 TYPE=AREA ATTR=ONCLICK:endprogress('+numer+');&&HREF:javascript:void(0);&&COORDS:*&&SHAPE:rect');
            var timerId = window.setInterval(function() { onClick=window.focus();}, 2000); weit(10); break; //Achei o Captch weit(10);
            }
         }
      }
   } catch(e) {weit(0.5);};
   strings = "";
   window.close();}
   Tabs.go(1);
    iimPlayCode(t0+'TAB CLOSEALLOTHERS');
}

          /***-= Captch =-***/
function crop(){ iimDisplay('Estou Resolvendo '+sqku+' Captcha');
    var Cc=Components.classes, Ci=Components.interfaces, args=['C:\\Perevernut\\crop.vbs'];
    var proc=Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
    var file=Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
    file.initWithPath('C:\\Windows\\System32\\wscript.exe');
    proc.init(file); proc.run(false, args, args.length); weit(3);}

          /***-= Resoluçao do Arquivo Hash =-***/
function hashfile() { iimDisplay("Estou Resolvendo " + sqku + " a soma do Arquivo Hash");
    var Cc = Components.classes, Ci = Components.interfaces, args = ["C:\\Perevernut\\hashfile.vbs"];
        var proc = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
        var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
        file.initWithPath("C:\\Windows\\System32\\wscript.exe");
        proc.init(file); proc.run(false, args, args.length); weit(10);
        try {
         strings = loadFile("C:\\Perevernut\\out.txt").strings;
      } catch(e) {};
iimPlayCode("FILEDELETE NAME=C:\\Perevernut\\out.txt\nFILEDELETE NAME=C:\\Perevernut\\b.png");}

         /***-= Executando Tarefa =-***/
function weit(s) {iimPlayCode("WAIT SECONDS=" + s);}


The error is in this line

Code: Select all
for (;;) {
   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(1.5);
   iimPlayCode(t0+'TAG POS=1 TYPE=SPAN ATTR=ID:clock EXTRACT=HREF');
   var clock = iimGetLastExtract().match(/\d+/);
   if (Number(clock) > 10) {
      weit((Number(clock)*30)+10);
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(2);
      }
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(5);

Ah OK...!, FCI added, good... Yep, sorry, I don't even read if FCI is not mentioned..., or only to quickly scan for hidden Spam...
And you've indeed improved a bit the "Quality" of the Post, good-good... (It's btw always a bit "dangerous" to "silently" edit some Post, I usually don't go checking a same Thread/Post several times...)

OK, good..., you are on v8.9.7, I thought the 'window.document.querySelector()' kind of Syntax is not supported anymore on v9.0.3...
And v8.9.7 for FF still works on FF54 btw, in case you were "afraid" to update FF as I see that you are still at FF47, even there are a few "big" Changes in FF51 + FF52/53 about Add-ons Handling and Secure Logins, but OK, it still works correctly on FF54...

But hum, sorry, there is still one "blocking" "Thing" for me to have a look at your Case, and that's your Thread Title which needs to be Descriptive about its Content, "Please help me to correct this code" is completely useless, try searching the Forum using those Keywords to find similar Threads..., well, good luck, ah-ah...!
Yeah sorry, but I only help Users using the Forum "a bit correctly" and really get stuck after they've tried their best, and a Descriptive Thread Title belongs to my "Criteria" (+ FCI mentioned like you've already found out now, ah-ah...!) + neat Follow-up and Sharing their Solution, in case you were wondering... All those "Criteria" sound logical to me, try to think a bit logical as well, I guess that will speed up the whole Process...

And hum, about your "I am not a programmer at all...", woaf-woaf-woaf...!, your Script is already "high Level" and very complex, I'm not a JavaScript Guru at all and I don't use any '.js' Scripts at all (I do myself all my Scripts in pure '.iim') and I certainly don't use this complex 'window.document.querySelector()' Syntax/etc..., so I don't promise anything... But I still haven't had a "real" look at your Script, so..., you never know..., or some other Advanced User(s) might jump into the Thread...
But if you didn't write this Script yourself, it might maybe help if you posted a Ref where you got it from and check directly with the Writer of this Script...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6479
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Please help me to correct this code

by gUSTAVO on Tue Aug 08, 2017 1:13 pm

chivracq wrote:
gUSTAVO wrote:
Code: Select all
Windows 7 English, Firefox 47, Imacros 8.9.7

I am not a programmer at all and I am having difficulty understanding and correcting this code I made

When I excute the script it runs perfectly until the time to extract the clock and wait the time necessary to repeat the same process

And I get the following error

Code: Select all
TypeError: window.document.querySelector(...) is null, line 42 (Error code: -991)


Code: Select all
Windows 7 English, Firefox 47, Imacros 8.9.7

can you help ?

I am not a programmer, I just ask for help, because I found the script on the internet. It is working everything right, but when it comes time to extract the clock and wait for the count extracted from the clock it ignores and goes to the next command that is to click on the button.

Please help me to correct this code

Code: Select all
var t0='SET !TIMEOUT_STEP 0\n', strings = "" ;
var bit = '338bpyc69ooEUtWvQ64b4VgigAUKgE87mi';

var Faucethub = 0 // Withdrawal para Faucethub, 1 - on, 0 - off.
var FaucetSystem = 0 // Withdrawal para Faucethub, 1 - on, 0 - off.

var surf = 0 // PTCWall Surf, 1 - on., 0 - off.

var Tabs = {
   _browser: function () {
      var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
         .getService(Components.interfaces.nsIWindowMediator);
      return wm.getMostRecentWindow("navigator:browser").gBrowser;
   }(),
   go: function (tabIndex) {
      this._browser.selectedTab = this._browser.tabContainer.childNodes[tabIndex - 1];
   }
};

var loadFile = function (fileName) {
    var fileDescriptor = imns.FIO.openNode(fileName);
    var text = imns.FIO.readTextFile(fileDescriptor);
    return {
        text: text,
        strings: text.replace(/ /gi, "").split("\r\n")
    };
};

   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/ref/338bpyc69ooEUtWvQ64b4VgigAUKgE87mi'); weit(2);
   var balance = getBalance();
   if (!balance) {
      avtorizacia();
   }
for (;;) {
   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(1.5);
   iimPlayCode(t0+'TAG POS=1 TYPE=SPAN ATTR=ID:clock EXTRACT=HREF');
   var clock = iimGetLastExtract().match(/\d+/);
   if (Number(clock) > 10) {
      weit((Number(clock)*30)+10);
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(2);
      }
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(5);
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:Claim'); weit(2);
   window.scrollBy(0,100); weit(1);
   iimPlayCode(`
   SET !ENCRYPTION NO
   PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1 
   TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
   SET !SINGLESTEP {{!VAR1}}
   SET !SINGLESTEP NO
   `); weit(1);
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2);
   if (Number(surf)>=1){ptcwall()};
   var balance = getBalance();
   
   if (Number(balance) > 10000) {
      if (Number (Faucethub) >=1){
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/account');
      window.document.querySelector('button[class="btn btn-sm btn-primary btn-block"][data-toggle="modal"][data-target=".bs-withdraw-modal-lg"]').click(); weit(3);
      window.document.querySelector('input[type="radio"][name="withdraw"][value="FaucetHub.io"][required=""]').click(); weit(1);
   }   iimPlayCode(`
      SET !ENCRYPTION NO
      PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1
      TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
      WAIT SECONDS = 2`); weit(1);
      window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2)
   }

   if (Number(balance) > 10000) {
      if (Number (FaucetSystem) >=1){
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/account'); weit(2);
      window.document.querySelector('button[class="btn btn-sm btn-primary btn-block"][data-toggle="modal"][data-target=".bs-withdraw-modal-lg"]').click(); weit(3);
      window.document.querySelector('input[type="radio"][name="withdraw"][value="FaucetSystem.com"][required=""]').click(); weit(1);
   }   iimPlayCode(`WAIT SECONDS = 2
      SET !ENCRYPTION NO
      PROMPT "Resolva o  Captcha (Assim que Terminar Click em Ok):" !VAR1
      TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
      WAIT SECONDS = 2`); weit(1);
      window.document.querySelector('button[type="submit"][id="button"]').click(); weit(2)
   }
   iimDisplay('Seu Saldo e = '+(Number(balance)/100000000).toFixed(8)+' BTC');
   
}

         /***-= Verificando seu Saldo =-***/
function getBalance() {
    iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:"panel-body" EXTRACT=TXT');
    var balance = +iimGetExtract().replace(/,/gi, "").match(/\d+/g);
    if (balance !== "#EANF#") {
        return balance;
    }
    return false;
}
   
         /***-= Login =-***/
function avtorizacia() {
   window.document.querySelector('input[type="text"][name="address"]').value=bit;
   iimPlayCode(`
   TAG POS=1 TYPE=A ATTR=TXT:Entrar
   SET !ENCRYPTION NO
   PROMPT "Resolva o Captch (Click em Ok para Continuar):" !VAR1 
   TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:adcopy_response CONTENT={{!VAR1}}
   TAG POS=1 TYPE=BUTTON FORM=ACTION:/ ATTR=ID:button
   `); weit(2);
}

function ptcwall() {
   iimPlayCode('URL GOTO=bitlucky.io/offerwall');
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:PTCWall"');
   iimPlayCode('TAG POS=1 TYPE=A ATTR=TXT:Open<SP>PTCWall<SP>in<SP>new<SP>tab');
   iimPlayCode(t0+'TAG POS=1 TYPE=BUTTON ATTR=TXT:Close');
   for(sqku=1; sqku<=50; sqku++){ iimDisplay('Estou Resolvendo '+sqku+' Aguarde');
   iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:ad&&STYLE:"" EXTRACT=HTM');
      if(iimGetExtract().indexOf('EANF')>0 || iimGetExtract().indexOf('onclick')<0) break;
      var claim=iimGetExtract().replace(/&amp;/g,'&').match(/window.*?\);/);
      iimPlayCode('TAG POS=1 TYPE=SPAN ATTR=ONCLICK:'+claim); weit(1);
      if(iimPlayCode(t0+'TAG POS=1 TYPE=H2 ATTR=TXT:Warning')>0){window.close();return;}
      var timerId = window.setInterval(function() { onClick=window.focus();}, 2000);
   for(skz=1; skz<=3000; skz++){
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=ID:vnumbers&&STYLE:"" EXTRACT=HTM'); var down=iimGetLastExtract();
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=ID:vnumbers&&STYLE:float:* EXTRACT=HTM'); var picture=iimGetLastExtract();
      iimPlayCode(t0+'TAG POS=1 TYPE=DIV ATTR=CLASS:errorbox EXTRACT=HTM'); var error=iimGetLastExtract();
      if(down.indexOf('down picture')>0 || picture.indexOf('down picture')>0 || error.indexOf('Advertisement')>0 || error.indexOf('advertisement')>0) break;}
      if(error.indexOf('Advertisement')>0 || error.indexOf('advertisement')>0){ Tabs.go(2); iimPlayCode('REFRESH'); Tabs.go(3);}
      window.setTimeout(function() { window.clearInterval(timerId);}, 100);
      weit(1.5);
      iimPlayCode('ONDOWNLOAD FOLDER=C:\\Perevernut\\ FILE=b.png WAIT=YES\nTAG POS=1 TYPE=IMG ATTR=SRC:modules.php?* CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT');

   var shablon=['be6821c681026e048e86b1308dbb8311','15821c7d43fd9f53a96041603437c4ab','ad5f4d5f8ef29e5d116daa4ecf61853b','2267fd54340d2113d31f47e1a0e81185','2253674278966e65a1f776c8570bf9c6','755093054fa517d3adc008c6892b84b5','6aa801993ebdd5b64b4d65c3b5f7a9d1','830511874dc03cdd0d23f360cf035825','5af11f12e88f81cdd2d6d9dce4454789','64d9969214e7146e52771498a9173bda'];
   crop();
   hashfile();
   try {
   for (i=0; i<strings.length; i++) {
      for (j=0; j<shablon.length; j++) {
         if (strings[i]==shablon[j]) {
            var numer=i+1;
            iimPlayCode('TAG POS=1 TYPE=AREA ATTR=ONCLICK:endprogress('+numer+');&&HREF:javascript:void(0);&&COORDS:*&&SHAPE:rect');
            var timerId = window.setInterval(function() { onClick=window.focus();}, 2000); weit(10); break; //Achei o Captch weit(10);
            }
         }
      }
   } catch(e) {weit(0.5);};
   strings = "";
   window.close();}
   Tabs.go(1);
    iimPlayCode(t0+'TAB CLOSEALLOTHERS');
}

          /***-= Captch =-***/
function crop(){ iimDisplay('Estou Resolvendo '+sqku+' Captcha');
    var Cc=Components.classes, Ci=Components.interfaces, args=['C:\\Perevernut\\crop.vbs'];
    var proc=Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
    var file=Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
    file.initWithPath('C:\\Windows\\System32\\wscript.exe');
    proc.init(file); proc.run(false, args, args.length); weit(3);}

          /***-= Resoluçao do Arquivo Hash =-***/
function hashfile() { iimDisplay("Estou Resolvendo " + sqku + " a soma do Arquivo Hash");
    var Cc = Components.classes, Ci = Components.interfaces, args = ["C:\\Perevernut\\hashfile.vbs"];
        var proc = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
        var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
        file.initWithPath("C:\\Windows\\System32\\wscript.exe");
        proc.init(file); proc.run(false, args, args.length); weit(10);
        try {
         strings = loadFile("C:\\Perevernut\\out.txt").strings;
      } catch(e) {};
iimPlayCode("FILEDELETE NAME=C:\\Perevernut\\out.txt\nFILEDELETE NAME=C:\\Perevernut\\b.png");}

         /***-= Executando Tarefa =-***/
function weit(s) {iimPlayCode("WAIT SECONDS=" + s);}


The error is in this line

Code: Select all
for (;;) {
   iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(1.5);
   iimPlayCode(t0+'TAG POS=1 TYPE=SPAN ATTR=ID:clock EXTRACT=HREF');
   var clock = iimGetLastExtract().match(/\d+/);
   if (Number(clock) > 10) {
      weit((Number(clock)*30)+10);
      iimPlayCode('TAB CLOSEALLOTHERS\nURL GOTO=bitlucky.io/faucet'); weit(2);
      }
   window.document.querySelector('button[type="submit"][id="button"]').click(); weit(5);

Ah OK...!, FCI added, good... Yep, sorry, I don't even read if FCI is not mentioned..., or only to quickly scan for hidden Spam...
And you've indeed improved a bit the "Quality" of the Post, good-good... (It's btw always a bit "dangerous" to "silently" edit some Post, I usually don't go checking a same Thread/Post several times...)

OK, good..., you are on v8.9.7, I thought the 'window.document.querySelector()' kind of Syntax is not supported anymore on v9.0.3...
And v8.9.7 for FF still works on FF54 btw, in case you were "afraid" to update FF as I see that you are still at FF47, even there are a few "big" Changes in FF51 + FF52/53 about Add-ons Handling and Secure Logins, but OK, it still works correctly on FF54...

But hum, sorry, there is still one "blocking" "Thing" for me to have a look at your Case, and that's your Thread Title which needs to be Descriptive about its Content, "Please help me to correct this code" is completely useless, try searching the Forum using those Keywords to find similar Threads..., well, good luck, ah-ah...!
Yeah sorry, but I only help Users using the Forum "a bit correctly" and really get stuck after they've tried their best, and a Descriptive Thread Title belongs to my "Criteria" (+ FCI mentioned like you've already found out now, ah-ah...!) + neat Follow-up and Sharing their Solution, in case you were wondering... All those "Criteria" sound logical to me, try to think a bit logical as well, I guess that will speed up the whole Process...

And hum, about your "I am not a programmer at all...", woaf-woaf-woaf...!, your Script is already "high Level" and very complex, I'm not a JavaScript Guru at all and I don't use any '.js' Scripts at all (I do myself all my Scripts in pure '.iim') and I certainly don't use this complex 'window.document.querySelector()' Syntax/etc..., so I don't promise anything... But I still haven't had a "real" look at your Script, so..., you never know..., or some other Advanced User(s) might jump into the Thread...
But if you didn't write this Script yourself, it might maybe help if you posted a Ref where you got it from and check directly with the Writer of this Script...

Ok thank you so much God bless you
gUSTAVO
 
Posts: 5
Joined: Mon Aug 07, 2017 2:21 am


Return to General Support & Discussions

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests

-->