How to compare !VAR1 and !VAR2 number

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

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 compare !VAR1 and !VAR2 number

by imacronewbie22 on Wed Dec 14, 2016 4:08 pm

Hi iMacros community,

I built some iMacro script to extract 2 numbers from website but I don't know how to compare it. I get numbers but don't know how to find what number is larger than other one. This is script:

VERSION BUILD=9030808 RECORDER=FX
TAB T=1

URL GOTO=http://example.com
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 EVAL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 EVAL

How can I compare !VAR1 and !VAR2 with iMacro?
I spent 4 days but I am stuck in place
Thank you
imacronewbie22
 
Posts: 10
Joined: Wed Dec 14, 2016 3:57 pm

Re: How to compare !VAR1 and !VAR2 number

by chivracq on Thu Dec 15, 2016 1:19 am

imacronewbie22 wrote:Hi iMacros community,

I built some iMacro script to extract 2 numbers from website but I don't know how to compare it. I get numbers but don't know how to find what number is larger than other one. This is script:

Code: Select all
VERSION BUILD=9030808 RECORDER=FX
TAB T=1

URL GOTO=http://example.com
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 EVAL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 EVAL


How can I compare !VAR1 and !VAR2 with iMacro?
I spent 4 days but I am stuck in place
Thank you

Thread approved because no Spam and Legit but it has nothing to do with the 'Scripting Interface'..., OK, no need to duplicate, it will be eventually moved to the correct Sub-Forum... :roll:

FCIM...! :mrgreen:
=> iMacros for FF v9.0.3, FF47/49/50...?, OS...?

"I spent 4 days but I am stuck in place"
=> Woaw...! What have you tried, where do you get stuck exactly...?
You'll need to use 'EVAL()' to compare your 2 Vars, but hum, your Post is vague with "example.com" and if you don't mention what you want to do then...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5201
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to compare !VAR1 and !VAR2 number

by imacronewbie22 on Thu Dec 15, 2016 3:39 am

Thank you for fast response and sorry for incomplete question.
iMacros for FF v9.0.3 Firefox 50.1.0 Windows 10
With my previous script I get two numbers !VAR1 and !VAR2
I just want to check is!VAR1 bigger number from !VAR2 and if yes to continue to work or if not to start another IMacro script.
imacronewbie22
 
Posts: 10
Joined: Wed Dec 14, 2016 3:57 pm

Re: How to compare !VAR1 and !VAR2 number

by chivracq on Thu Dec 15, 2016 4:14 am

imacronewbie22 wrote:Thank you for fast response and sorry for incomplete question.
Code: Select all
iMacros for FF v9.0.3 Firefox 50.1.0 Windows 10

With my previous script I get two numbers !VAR1 and !VAR2
I just want to check is!VAR1 bigger number from !VAR2 and if yes to continue to work or if not to start another IMacro script.

OK for FCI...

Well, "continue to work" is a bit vague again...! :roll: , but there are (mostly) 3 Options:
1- You split the Logic of your first Macro (Macro_1) into 2 Macros (Macro_1_1 and Macro_1_2) until you've extracted your 2 Numbers that you pass to a "Main' '.js' Script that will do the Comparison and will decide which further Macro to launch (Macro_1_2 or Macro_2).
This is the "Standard" Solution, the Forum is full of Examples...
For Option '1-', for all 3 '.iim' parts, you can either use Standalone '.iim' Scripts or on the fly built Macros in your '.js' Script, or any Mix between the 3, using 'iimPlay()' and/or 'iimPlayCode()'.

2- Depending on what "continue to work" implies, you split the Logic of your first Macro into 2 Macros until the Check on the 2 Numbers with 'EVAL()' which will spit out as a Conditional Result the Name of which further Macro to run (=> "Macro_1_2.iim" or "Macro_2.iim") using for example:
Code: Select all
'URL GOTO=imacros://run/?m=Macro_1_2.iim
'URL GOTO=imacros://run/?m=Macro_2.iim
URL GOTO=imacros://run/?m={{Next_Macro}}


3- Or you only spit out "Macro_2.iim" or an empty String for Macro_1 to "continue to work", using the same Syntax...

There is a 4th Option, but pfff, not enough Info to elaborate on it as it depends on what Macro_1_2 and Macro_2 will be doing and how close there are to each other...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5201
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to compare !VAR1 and !VAR2 number

by imacronewbie22 on Thu Dec 15, 2016 5:45 am

OK Thank you

Is something like this possible solution or not?

SET !VAR3 EVAL("var d=\"{{!VAR1}}\"; var s=\"{{!VAR2}}\" ; if (d>s){var x = \"keep going";} else {var x=\"stop";} x;")
imacronewbie22
 
Posts: 10
Joined: Wed Dec 14, 2016 3:57 pm

Re: How to compare !VAR1 and !VAR2 number

by chivracq on Thu Dec 15, 2016 1:16 pm

imacronewbie22 wrote:OK Thank you

Is something like this possible solution or not?

Code: Select all
SET !VAR3 EVAL("var d=\"{{!VAR1}}\"; var s=\"{{!VAR2}}\" ; if (d>s){var x = \"keep going";} else {var x=\"stop";} x;")

OK, if using 'EVAL()', you seem to be going for Option '2-' or '3-', and yep, that's the/a way to do a (Number) Comparison using 'EVAL()', but I don't see after that how you are going to reuse your "keep going" or "stop" Strings... :?
Hum, OK, I get it..., you actually go for Option '1-', and depending on which String the 'EVAL()' Statement returns, your '.js' Script will launch Macro_1_2 or Macro_2. Well, OK, that's a way to go, a little bit cumbersome as the 'IF' statement could be done directly in the '.js' Script, and you need another 'IF' Statement in the '.js' Script, so it's a bit "double".
The only "added Value" of your Approach is for Maintenance and for yourself to understand again what your Macro_1_1 (and your '.js' Script) are doing and what was their "purpose" and Workflow, but that Info could/should be included in a Comment as well, ah-ah...!

But nice to see that you are "progressing", ah-ah...! 8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5201
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to compare !VAR1 and !VAR2 number

by imacronewbie22 on Thu Dec 15, 2016 4:27 pm

You are right but I can't get solution that works. I tried several options but no luck. Do you know what I'm missing ?

VERSION BUILD=9030808 RECORDER=FX
TAB T=1

URL GOTO=http://example.com
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 EVAL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 EVAL

SET !VAR3 EVAL("var number1=\"{{!VAR1}}\"; var number2=\"{{!VAR2}}\"; if ( number1 < number2 ) {var x = \" {{!VAR1}} is bigger than {{!VAR2}}\";} else {var x=\"{{!VAR2}} is bigger than {{!VAR1}}\";} x;")
PROMPT {{!VAR3}}

number1 > number2 it shows VAR2 is bigger than VAR1
number1 < number2 it shows VAR1 is bigger than VAR2

No matter the numbers

or

SET !VAR3 EVAL("var X=\" {{!VAR1}} \"; var Y=\" {{!VAR2}} \"; if (X < Y){var x = \" statement 1 \";} else {var x=\" statement 2 \";} x;")
PROMPT {{!VAR3}}

or

SET !VAR3 EVAL("var d=\"{{!VAR1}}\"; var s=\"{{!VAR2}}\" ; if (d>s){var x = \"https://www.site1.com\";} else {var x=\"https://www.site2.com\";} x;")
URL GOTO={{!VAR3}}

Thank you
imacronewbie22
 
Posts: 10
Joined: Wed Dec 14, 2016 3:57 pm

Re: How to compare !VAR1 and !VAR2 number

by chivracq on Thu Dec 15, 2016 7:54 pm

imacronewbie22 wrote:You are right but I can't get solution that works. I tried several options but no luck. Do you know what I'm missing ?

Code: Select all
VERSION BUILD=9030808 RECORDER=FX
TAB T=1

URL GOTO=http://example.com
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 EVAL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 EVAL

SET !VAR3 EVAL("var number1=\"{{!VAR1}}\"; var number2=\"{{!VAR2}}\";  if ( number1 < number2 ) {var x = \" {{!VAR1}} is bigger than {{!VAR2}}\";} else {var x=\"{{!VAR2}} is bigger than {{!VAR1}}\";} x;")
PROMPT {{!VAR3}}


number1 > number2 it shows VAR2 is bigger than VAR1
number1 < number2 it shows VAR1 is bigger than VAR2

No matter the numbers

or
Code: Select all
SET !VAR3 EVAL("var X=\" {{!VAR1}} \"; var Y=\" {{!VAR2}} \"; if (X < Y){var x = \" statement 1 \";} else {var x=\" statement 2 \";} x;")
PROMPT {{!VAR3}}

or
Code: Select all
SET !VAR3 EVAL("var d=\"{{!VAR1}}\"; var s=\"{{!VAR2}}\" ; if (d>s){var x = \"https://www.site1.com\";} else {var x=\"https://www.site2.com\";} x;")
URL GOTO={{!VAR3}}

Thank you

Always follow ALL your Variables, not only '!VAR3'... => Use:
Code: Select all
PROMPT VAR1:<SP>_{{!VAR1}}_<BR>VAR2:<SP>_{{!VAR2}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_

The Underscores around all Vars, especially '!VAR1' and '!VAR2' are meant to make sure you don't get any leading/trailing Space(s) in your Extracts, which is probably what is happening, then iMacros/'EVAL()' treats those as Strings and will compare your 2 Vars alphabetically and not arithmetically.
In that case, ' 9 ' > ' 2 ' > ' 11 '...
=> Use 'trim()' or 'toNumber()' or 'parseInt()' or parseFloat()' to make sure to convert your Extracts to Numbers.
Or let iMacros convert them to Numbers with:
Code: Select all
ADD !VAR1 1
ADD !VAR2 1

If '!VAR1' = 9 and '!VAR2' = 23 and you end up with "91" and "231" then you know there is stg wrong...!

>>>

But hum, there is stg as well fundamentally wrong in your Script:
Code: Select all
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 EVAL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 EVAL
You are currently assigning the same String "EVAL" to both '!VAR1' and '!VAR2', ah-ah...! :shock:
=> Which means the 'IF' is always "FALSE" and the 'ELSE' always gets automatically executed...!

It should be:
Code: Select all
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
'>
SET !EXTRACT NULL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5201
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to compare !VAR1 and !VAR2 number

by imacronewbie22 on Fri Dec 16, 2016 5:31 am

Thank you so much. Your code works perfectly. You made my day very nice. Have a great weekend. This is awesome solution

Code: Select all
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
SET !EXTRACT_TEST_POPUP NO
URL GOTO=http://example.com


SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
'>
SET !EXTRACT NULL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}

SET !VAR3 EVAL("var number1=\"{{!VAR1}}\"; var number2=\"{{!VAR2}}\";  if ( number1 > number2 ) {var x = \" {{!VAR1}} is bigger than {{!VAR2}}\";} else {var x=\"{{!VAR2}} is bigger than {{!VAR1}}\";} x;")

PROMPT VAR1:<SP>_{{!VAR1}}_<BR>VAR2:<SP>_{{!VAR2}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_
imacronewbie22
 
Posts: 10
Joined: Wed Dec 14, 2016 3:57 pm

Re: How to compare !VAR1 and !VAR2 number

by chivracq on Sat Dec 17, 2016 12:55 pm

imacronewbie22 wrote:Thank you so much. Your code works perfectly. You made my day very nice. Have a great weekend. This is awesome solution

Code: Select all
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
SET !EXTRACT_TEST_POPUP NO
URL GOTO=http://example.com

SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
'>
SET !EXTRACT NULL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}

SET !VAR3 EVAL("var number1=\"{{!VAR1}}\"; var number2=\"{{!VAR2}}\";  if ( number1 > number2 ) {var x = \" {{!VAR1}} is bigger than {{!VAR2}}\";} else {var x=\"{{!VAR2}} is bigger than {{!VAR1}}\";} x;")

PROMPT VAR1:<SP>_{{!VAR1}}_<BR>VAR2:<SP>_{{!VAR2}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_

Ah...!, OK, good to hear...! :D

The Reason/Mistake was so obvious that I didn't even see it directly, ah-ah...! :oops:

But remember the Technique to follow all your Variables with 'PROMPT' (or 'alert()' in '.js' Scripts) like I did with
Code: Select all
PROMPT VAR1:<SP>_{{!VAR1}}_<BR>VAR2:<SP>_{{!VAR2}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_

... and when seeing that "VAR1=EVAL" and "VAR2=EVAL" instead of the Extracts/Numbers you were expecting, you would have found the Solution by yourself, ah-ah... :idea:

And good luck for implementing the rest of your Scenario... 8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5201
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to compare !VAR1 and !VAR2 number

by imacronewbie22 on Sat Dec 17, 2016 4:31 pm

Thank you again. Script works like a charm.

Code: Select all
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
'>
SET !EXTRACT NULL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}

SET !VAR3 EVAL("var d=\"{{!VAR1}}\"; var s=\"{{!VAR2}}\" ; if (d>s){var x = \"{{!URLCURRENT}}\";} else {var x=\"http:example.com\";} x;")
URL GOTO={{!VAR3}}
BACK


When i put this to check i get correct result
Code: Select all
PROMPT VAR1:<SP>_{{!VAR1}}_<BR>VAR2:<SP>_{{!VAR2}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_


VAR1: _5_
VAR2: _78_

VAR3: _http:example.com_
imacronewbie22
 
Posts: 10
Joined: Wed Dec 14, 2016 3:57 pm

Re: How to compare !VAR1 and !VAR2 number

by chivracq on Sat Dec 17, 2016 10:08 pm

imacronewbie22 wrote:Thank you again. Script works like a charm.

Code: Select all
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
'>
SET !EXTRACT NULL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}

SET !VAR3 EVAL("var d=\"{{!VAR1}}\"; var s=\"{{!VAR2}}\" ; if (d>s){var x = \"{{!URLCURRENT}}\";} else {var x=\"http:example.com\";} x;")
URL GOTO={{!VAR3}}
BACK


When i put this to check i get correct result
Code: Select all
PROMPT VAR1:<SP>_{{!VAR1}}_<BR>VAR2:<SP>_{{!VAR2}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_


VAR1: _5_
VAR2: _78_

VAR3: _http:example.com_

OK, good to hear...! :D

Today is Lesson_2 for better "Best Practice":
=> Use Comments and give your Vars meaningful Names...!

So your Script could become stg like this:
Code: Select all
'Extract 1st Number:
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET Nb_1 {{!EXTRACT}}
'>
'Extract 2nd Number:
SET !EXTRACT NULL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET Nb_2 {{!EXTRACT}}

'Compute 'URL_to_go' based on Nb_1 > or < Nb_2:
SET URL_1 {{!URLCURRENT}}
SET URL_2 http:example.com
SET URL_to_go EVAL("var n1='{{Nb_1}}', n2='{{Nb_2}}'; var u1='{{URL_1}}', u2='{{URL_2}}'; var x; if(n1>n2){x=u1;} else{x=u2;} x;")
URL GOTO={{URL_to_go}}

'Debug:
'PROMPT Nb_1:<SP>_{{Nb_1}}_<BR>Nb_2:<SP>_{{Nb_2}}_<BR><BR>URL_go_to:<SP>_{{URL_go_to}}_
BACK
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5201
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: How to compare !VAR1 and !VAR2 number

by imacronewbie22 on Sun Dec 18, 2016 9:54 am

Thank you. This solution is faster than previous.
imacronewbie22
 
Posts: 10
Joined: Wed Dec 14, 2016 3:57 pm

Re: How to compare !VAR1 and !VAR2 number

by imacronewbie22 on Mon Dec 26, 2016 2:21 pm

Hi chivracq,

Happy Holidays, I noticed that script has an error but I can't find what. Can you check what is the problem. No matter that Nb_1 is <Nb_2, it does same as when Nb_1 is > Nb_2. Sometimes it works OK, but most of the times not. Is it usual, or I accidentally made some mistake?
This part often reads wrong.
Code: Select all
SET Button EVAL("var n1='{{Nb_1}}', n2='{{Nb_2}}'; if(n1>n2){x=1;} else{x=0;} x;")]

example Nb_1=5 Nb_2=100 it shows as if 5 is bigger than 100. It doesn't happen every time, but often enough.


Code: Select all
'Extract 1st Number:
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET Nb_1 {{!EXTRACT}}
'>
'Extract 2nd Number:
SET !EXTRACT NULL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET Nb_2 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=R1 TYPE=BUTTON ATTR=CLASS:main&&TXT:* EXTRACT = HTM
SET !VAR1 EVAL("var s = \"{{!EXTRACT}}\"; s = s.split(' ')[1]; s=s.replace('id=', ''); s=s.replace('place', '');s;")
SET Button EVAL("var n1='{{Nb_1}}', n2='{{Nb_2}}'; if(n1>n2){x=1;} else{x=0;} x;")
SET !VAR5 EVAL("var randomNumber=Math.floor(Math.random()*6 + 3); randomNumber;")
WAIT SECONDS={{!VAR5}}
TAG POS={{Button}} TYPE=BUTTON ATTR=ID:{{!VAR1}}
SET !VAR5 EVAL("var randomNumber=Math.floor(Math.random()*10 + 5); randomNumber;")
WAIT SECONDS={{!VAR5}}


Thank you
imacronewbie22
 
Posts: 10
Joined: Wed Dec 14, 2016 3:57 pm

Re: How to compare !VAR1 and !VAR2 number

by chivracq on Mon Dec 26, 2016 6:08 pm

imacronewbie22 wrote:Hi chivracq,

Happy Holidays, I noticed that script has an error but I can't find what. Can you check what is the problem. No matter that Nb_1 is <Nb_2, it does same as when Nb_1 is > Nb_2. Sometimes it works OK, but most of the times not. Is it usual, or I accidentally made some mistake?
This part often reads wrong.
Code: Select all
SET Button EVAL("var n1='{{Nb_1}}', n2='{{Nb_2}}'; if(n1>n2){x=1;} else{x=0;} x;")]

example Nb_1=5 Nb_2=100 it shows as if 5 is bigger than 100. It doesn't happen every time, but often enough.

Code: Select all
'Extract 1st Number:
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET Nb_1 {{!EXTRACT}}
'>
'Extract 2nd Number:
SET !EXTRACT NULL
TAG POS=2 TYPE=TD ATTR=CLASS:text<SP>center&&TXT:* EXTRACT=TXT
SET Nb_2 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=R1 TYPE=BUTTON ATTR=CLASS:main&&TXT:* EXTRACT = HTM
SET !VAR1 EVAL("var s = \"{{!EXTRACT}}\"; s = s.split(' ')[1]; s=s.replace('id=', ''); s=s.replace('place', '');s;")
SET Button EVAL("var n1='{{Nb_1}}', n2='{{Nb_2}}'; if(n1>n2){x=1;} else{x=0;} x;")
SET !VAR5 EVAL("var randomNumber=Math.floor(Math.random()*6 + 3); randomNumber;")
WAIT SECONDS={{!VAR5}}
TAG POS={{Button}} TYPE=BUTTON ATTR=ID:{{!VAR1}}
SET !VAR5 EVAL("var randomNumber=Math.floor(Math.random()*10 + 5); randomNumber;")
WAIT SECONDS={{!VAR5}}


Thank you

Well, then, probably related to what I had mentioned in some previous Post, before the "euh, but there is stg fundamentally wrong in your Script" part... Alphabetically, 5>11.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5201
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Next

Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 1 guest

Website Monitoring