Script not working properly, help please...

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
bestisme
Posts: 47
Joined: Sun Mar 23, 2014 7:37 am

Script not working properly, help please...

Post by bestisme » Sat Sep 06, 2014 7:30 am

Hello people, I am using the latest version IMacros for Firefox, and using javascript macro, but the problem is, that its not working properly.

Here is the code :

Code: Select all

for (i = 0; i < 50000; i++) {

var macro;
macro =  "CODE:";
macro +=  "VERSION BUILD=8810214 RECORDER=FX" + "\n"; 
macro +=  "TAB T=1" + "\n"; 
macro +=  "SET !EXTRACT_TEST_POPUP NO" + "\n"; 
macro +=  "SET !TIMEOUT_STEP 0" + "\n"; 
iimPlay(macro)

var verify;
verify =  "CODE:";
verify +=  "SET !EXTRACT_TEST_POPUP NO" + "\n"; 
verify +=  "SET !TIMEOUT_STEP 0" + "\n"; 
verify +=  "TAG POS=1 TYPE=DIV ATTR=TXT:Verification<SP>Code EXTRACT=TXT" + "\n"; 
iimPlay(verify)



var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="#EANF#")
{
var captchasolver;
captchasolver =  "CODE:";
captchasolver +=  "VERSION BUILD=8820413 RECORDER=FX" + "\n"; 
captchasolver +=  "TAB T=1" + "\n"; 
captchasolver +=  "SET !EXTRACT_TEST_POPUP NO" + "\n"; 
captchasolver +=  "ONDOWNLOAD FOLDER=d:\ FILE=captcha.jpg" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=IMG ATTR=HREF:*captcha* CONTENT=EVENT:SAVE_ELEMENT_SCREENSHOT" + "\n"; 
captchasolver +=  "TAB OPEN" + "\n"; 
captchasolver +=  "TAB T=2" + "\n"; 
captchasolver +=  "URL GOTO=http://www.9kw.eu/grafik/form.html" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT ATTR=NAME:apikey CONTENT=xxxxxxx" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT ATTR=NAME:prio CONTENT=0" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:selfsolve CONTENT=NO" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:confirm CONTENT=NO" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:case-sensitive CONTENT=NO" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ACTION:/index.cgi ATTR=NAME:selfsolve CONTENT=NO" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT ATTR=NAME:source CONTENT=imacros" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT ATTR=NAME:file-upload-01 CONTENT=D:\captcha.jpg" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT ATTR=TYPE:submit" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=* ATTR=* EXTRACT=TXT" + "\n"; 
captchasolver +=  "TAB CLOSE" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=NAME:captcha CONTENT={{!EXTRACT}}" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:NoFormName ATTR=NAME:button" + "\n"; 
captchasolver +=  "TAG POS=1 TYPE=A ATTR=TXT:Continue<SP>Battle" + "\n";

iimPlay(captchasolver)

}
else
{var bolt;
bolt =  "CODE:";
bolt +=  "SET !EXTRACT_TEST_POPUP NO" + "\n"; 
bolt +=  "SET !TIMEOUT_STEP 0" + "\n"; 
bolt +=  "TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:battle.php?c=* ATTR=NAME:move" + "\n"; 
iimPlay(bolt)}

//New Step

iimPlay(verify)
var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="#EANF#")
{
iimPlay(captchasolver)
}
else
{iimPlay(bolt)}

//New Step


iimPlay(verify);
var G_Extract= iimGetLastExtract(1);
if (G_Extract!=="#EANF#")
{
iimPlay(captchasolver)
}


}

Now, as you can see, first there is a for loop, a very simple one, runs the macro 50000 times, thats just to get it to run infinitely...

In the variable macro, I have stored basic important things like timeout_step and extract popup.

Then, there is a simple verify macro. It will check if there is the text Verification Code, and extract it.

Then, I check using iimgetlastextract, if the extract was #EANF#(i.e. verification code did not exist)

if verification code exists, it plays captcha sovler, and if it doesn't, it performs the move.


So, if you take a look at it, you will see that it will

1. Check if there is text "Verification COde" on the screen, and if it is there, plays the script "captcha solver"

2. If the text verification code does not exist, play the script bolt.

3. Repeat step 1 and 2

4. Repeat step 1 and restart.


The problem is, I brought the verification code on page, and played the script, it worked fine, it played the captchasolver script without playing bolt script.

When I played the script and left, when I came back, I saw that it continued playing bolt script even though Verification Code was on screen... why?

What am I doing wrong?


Edit :

Config Info :

Firefox version 32.0
IMACROS VERSION BUILD=8810214
Windows XP SP 2
Post Reply