Aaron Roth
Aaron Roth

Reputation: 1

Imacros Help - If Statement

Hey I created this imacros statement for soundcloud. It doesn't seem to be fully functional. The problem I am having is for the if statement. If d

VERSION BUILD=6011206 RECORDER=CR
SET !LOOP 5
TAG POS={{!LOOP}} TYPE=A ATTR=class:userBadgeListItem__heading<sp>sc-type-small<sp>sc-link-dark<sp>sc-truncate
TAB T=2
WAIT SECONDS=1
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=DIV ATTR=CLASS:infoStats__value<SP>sc-font-tabular-light EXTRACT=TXT
SET !CLIPBOARD {{!EXTRACT}}
SET !VAR1 15
WAIT SECONDS=1
SET !VAR2 {{!CLIPBOARD}}
WAIT SECONDS=1
SET !VAR4 {{!URLCURRENT}}
WAIT SECONDS=1
SET !VAR3 EVAL("var d=\"{{!VAR1}}\"; var s=\"{{!VAR2}}\" ; if (d<s){var x = \"{{!VAR4}}\";} else {var x=\"https://GOOGLE.com\";} x;") 
WAIT SECONDS=4
URL GOTO={{!VAR3}}
WAIT SECONDS=1
SET !ERRORIGNORE YES
TAG POS=1 TYPE=BUTTON ATTR=Class:sc-button-follow<SP>sc-button<SP>sc-button-medium<SP>sc-button-responsive<SP>sc-button-cta
WAIT SECONDS=1
TAB CLOSE 
TAB T=1

Upvotes: 0

Views: 174

Answers (1)

Poyke
Poyke

Reputation: 655

You have a space between the IF and the condition, delete it and the eval itself will work - as long as the previous TAG works (I cant test it since I don't have the html code for the page but the line itsel works). Should be:

SET !VAR3 EVAL("var d=\"{{!VAR1}}\"; var s=\"{{!VAR2}}\" ; if(d<s){var x = \"{{!VAR4}}\";} else {var x=\"https://GOOGLE.com\";} x;") 

Upvotes: 2

Related Questions