Eval if tag, else move on

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
Fuledbyramen
Posts: 16
Joined: Sun Jan 31, 2016 12:12 am

Eval if tag, else move on

Post by Fuledbyramen » Mon Feb 08, 2016 11:57 pm

Hey! Got another problem Im trying to work through, I dont know any javascript so this is a bit tough for me and Im sure I havent really gone about it all that right but heres the pertinent info first

VERSION BUILD=8961227 RECORDER=FX
Windows 7
Firefox 44.0.1
The demo macros do work

So Im trying to make something that will unfollow and follow certain people on instagram, Id like to make it so that if the profile that is visited is not followed currently, to wait 30 seconds, follow it, then wait another 30 and move on to the next step, but if it is already followed, to simply move on to the next profile, not wait around for a full minute

So what I have so far looks something like

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE Yes
SET !TIMEOUT_PAGE 1

URL GOTO=https://www.instagram.com/instagram/  
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR1 EVAL("if (\"{{!EXTRACT}}\" == Follow\"\")
{Wait seconds = 30} {TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow"} {Wait seconds = 30}"
else wait seconds = 0;")
and then there would just be another piece of code like that just with another account name
Obviously I dont understand the syntax very well or how to go about it so any help is welcome! Thank you
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Eval if tag, else move on

Post by chivracq » Tue Feb 09, 2016 1:55 am

Fuledbyramen wrote:Hey! Got another problem Im trying to work through, I dont know any javascript so this is a bit tough for me and Im sure I havent really gone about it all that right but heres the pertinent info first

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
Windows 7
Firefox 44.0.1
The demo macros do work
So Im trying to make something that will unfollow and follow certain people on instagram, Id like to make it so that if the profile that is visited is not followed currently, to wait 30 seconds, follow it, then wait another 30 and move on to the next step, but if it is already followed, to simply move on to the next profile, not wait around for a full minute

So what I have so far looks something like

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE Yes
SET !TIMEOUT_PAGE 1

URL GOTO=https://www.instagram.com/instagram/  
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR1 EVAL("if (\"{{!EXTRACT}}\" == Follow\"\")
{Wait seconds = 30} {TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow"} {Wait seconds = 30}"
else wait seconds = 0;")
and then there would just be another piece of code like that just with another account name
Obviously I dont understand the syntax very well or how to go about it so any help is welcome! Thank you
Yep, the "normal" way to implement some Conditional Behaviour in your Macros is to use a '.js' Script...

That said, however, it is possible to achieve some Conditional Behaviour in pure '.iim'... (and that's the way all my Macros work, I don't use any '.js' Scripts). Have a look at this Thread where I've explained some of "my" Techniques and where I maintain a List of relevant Threads with Examples:
- Decision Making using iMacros/Possible Workarounds
The "Drawback" is that I am probably the only one on this Forum using this Method, so you'll need to understand it to use it, as I won't be writing all your Scripts, ah-ah...!, and you need for nearly each Step to come up with a "Creative" Solution, I guess that's why I nearly always find a Solution for most of the "interesting" Threads on the Forum... 8)

But in your Case, you'll need
1- a "Conditional WAIT" (search my Posts on those Search Keywords, I've already produced several Examples, and a few Threads are probably linked to as well in the List I mentioned about the Thread I referred you to...) and
2- a "Conditional Click" on the 'Follow' Button by spitting out a 0 / 1 to use with "POS=n" (using 'EVAL()', explained in the Thread I mentioned), as POS=1 will click on your 'Follow' Button and POS=0 won't do anything...
Last edited by chivracq on Mon Feb 17, 2020 12:55 pm, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Fuledbyramen
Posts: 16
Joined: Sun Jan 31, 2016 12:12 am

Re: Eval if tag, else move on

Post by Fuledbyramen » Tue Feb 09, 2016 8:23 am

As always thank you for your quick and helpful replies Chivracq!

So i searched up some of your old posts and things and a few of them helped me find the syntax so that my code will run now! but it wont do what I need it to do...
So this is the code I made so far

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE Yes
SET !TIMEOUT_PAGE 1

URL GOTO=https://www.instagram.com/instagram/  
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL

SET !VAR3 Follow
SET !VAR4 Following

SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR3}}\") {VAR7= 30;} else null; ")
SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR4}}\") {VAR7= 0;} else null; ")

wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow   
wait seconds = {{!VAR7}}
So I want it to set the wait time to 30 if it says Follow and wait time to 0 if it says Following
Dont need to change the button position because it wont find anything to click and will time out in a second
The problem is that when it runs, it seems to ignore the if statement and just changes the Variable 7 to the last Eval, so if I put the first one second itll change the wait time to 30 seconds, and if I leave this as is it will always have the wait time be 0

Not sure what Im doing wrong, obviously it isnt reading the if or else statements, not sure if null even works as an else statement, any further advisement would be great! feels like its very close but it just isnt quite there.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Eval if tag, else move on

Post by chivracq » Tue Feb 09, 2016 10:23 am

Fuledbyramen wrote:As always thank you for your quick and helpful replies Chivracq!

So i searched up some of your old posts and things and a few of them helped me find the syntax so that my code will run now! but it wont do what I need it to do...
So this is the code I made so far

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE Yes
SET !TIMEOUT_PAGE 1

URL GOTO=https://www.instagram.com/instagram/  
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL

SET !VAR3 Follow
SET !VAR4 Following

SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR3}}\") {VAR7= 30;} else null; ")
SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR4}}\") {VAR7= 0;} else null; ")

wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow   
wait seconds = {{!VAR7}}
So I want it to set the wait time to 30 if it says Follow and wait time to 0 if it says Following
Dont need to change the button position because it wont find anything to click and will time out in a second
The problem is that when it runs, it seems to ignore the if statement and just changes the Variable 7 to the last Eval, so if I put the first one second itll change the wait time to 30 seconds, and if I leave this as is it will always have the wait time be 0

Not sure what Im doing wrong, obviously it isnt reading the if or else statements, not sure if null even works as an else statement, any further advisement would be great! feels like its very close but it just isnt quite there.
Getting close indeed, but you are doing a few things wrong...

1- '!TIMEOUT_PAGE' set to 1, sounds indeed like a good ("Creative"!) Idea, but I find it "dangerous"...:
You have an 'URL GOTO' loading your 'Instagram' Page after it, and you only allow 1 sec for the Page to load and you go straight away after the Extract within 1/6th of a Second, so the chances are you are going to get many '#EANF#''s because the Page didn't have enough time to load... It might work sometimes if you have a very quick Connection, but your Script won't be very "reliable"...
=> It is still a good Idea, but you should better allow for a "decent" '!TIMEOUT_PAGE' for the 'URL GOTO' and set it only after to a much shorter Value. And maybe, instead of playing with '!TIMEOUT_PAGE', you should rather play with '!TIMEOUT_STEP' (=> set to 1 or 0).

2- Not sure either if setting your '!VAR7' to "null" for a 'WAIT' Statement will work...
When you are not sure... => You test...!!
And this mini Script:

Code: Select all

WAIT SECONDS=null
will yield the following RuntimeError:
BadParameter: expected SECONDS=<number> as parameter 1, line 4 (Error code: -911)
=> It doesn't work...!

But

Code: Select all

WAIT SECONDS=30
and

Code: Select all

WAIT SECONDS=0
both do work...

3- You have 2 'EVAL()' Statements in a row to set the same '!VAR7' and you check 2 different things... You need to combine them together: if (Not) Found => =30, else =0.

4- Use 'PROMPT' to follow and debug the Vars that you use...:

Code: Select all

PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_
Last edited by chivracq on Mon Feb 17, 2020 1:26 pm, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Fuledbyramen
Posts: 16
Joined: Sun Jan 31, 2016 12:12 am

Re: Eval if tag, else move on

Post by Fuledbyramen » Tue Feb 09, 2016 8:51 pm

Okay so I added the else statement and your prompt and while the macro will still run without giving an error, it isnt correctly using the if else statements

Currently the code is

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE Yes
SET !TIMEOUT_PAGE 10

URL GOTO=https://www.instagram.com/instagram/ 
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL

SET !VAR3 Follow
SET !VAR4 Following

SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR3}}\") {VAR7= 30;} else {VAR7= 0;}; ")

wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow   
wait seconds = {{!VAR7}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_
It extracts all variables and they are defined, its just that it always defines it as the first if variable, even if the if statement wasnt fulfilled, it wont change it to the else variable, any idea on whats wrong with the code?
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Eval if tag, else move on

Post by chivracq » Wed Feb 10, 2016 2:34 am

Fuledbyramen wrote:Okay so I added the else statement and your prompt and while the macro will still run without giving an error, it isnt correctly using the if else statements

Currently the code is

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE Yes
SET !TIMEOUT_PAGE 10

URL GOTO=https://www.instagram.com/instagram/ 
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL

SET !VAR3 Follow
SET !VAR4 Following

SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR3}}\") {VAR7= 30;} else {VAR7= 0;}; ")

wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow   
wait seconds = {{!VAR7}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_
It extracts all variables and they are defined, its just that it always defines it as the first if variable, even if the if statement wasnt fulfilled, it wont change it to the else variable, any idea on whats wrong with the code?
Ah-ah, very funny...! (Sorry, no offense...)

Yep, your '!VAR7' says:
If 'My_Sexy_Undefined_Var_Out_of_the_Blue' == 'My_Sexy_Undefined_Var_Out_of_the_Green' => !VAR7 = 30.
=> Yep, normal, if 'Undefined'=='Undefined', this will always be True, no need to check the 'else'...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Fuledbyramen
Posts: 16
Joined: Sun Jan 31, 2016 12:12 am

Re: Eval if tag, else move on

Post by Fuledbyramen » Wed Feb 10, 2016 8:08 am

I am confused what you mean?
Both my sexy variables, VAR0 and VAR3 and defined before the if statement are they not? The prompt you gave me listed them as defined, VAR0 is either follow or following and VAR3 is follow like needed

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE No
SET !TIMEOUT_PAGE 10

URL GOTO=https://www.instagram.com/instagram/
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL

SET !VAR3 Follow
SET !VAR4 Following

SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR3}}\") {VAR7= 30;} else {VAR7= 0;}; ")

wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
wait seconds = {{!VAR7}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Eval if tag, else move on

Post by chivracq » Wed Feb 10, 2016 11:09 am

Fuledbyramen wrote:I am confused what you mean?
Both my sexy variables, VAR0 and VAR3 and defined before the if statement are they not? The prompt you gave me listed them as defined, VAR0 is either follow or following and VAR3 is follow like needed

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE No
SET !TIMEOUT_PAGE 10

URL GOTO=https://www.instagram.com/instagram/ 
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
[b]SET !VAR0 {{!EXTRACT}}[/b]
SET !EXTRACT NULL

[b]SET !VAR3 Follow[/b]
SET !VAR4 Following

SET !VAR7 EVAL("if (\"{{[b]VAR0[/b]}}\" == \"{{[b]VAR3[/b]}}\") {VAR7= 30;} else {VAR7= 0;}; ")

wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow   
wait seconds = {{!VAR7}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_
Yep indeed, before the 'EVAL()' Statement you define '!VAR0' and '!VAR3' (+ '!VAR4'), perfect..., but then in the 'EVAL()' Statement, you want to use 'VAR0' and 'VAR3'... The missing 'Exclamation Mark' for both makes a big-big-big difference...! :idea:

(I did omit deliberately the Exclamation Marks for Built-in Vars in the PROMPT for their Name (not their Value) because iMacros sees them in a PROMPT as Input Vars and not as Text...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Fuledbyramen
Posts: 16
Joined: Sun Jan 31, 2016 12:12 am

Re: Eval if tag, else move on

Post by Fuledbyramen » Wed Feb 10, 2016 6:36 pm

It works now!

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 10

URL GOTO=https://www.instagram.com/instagram/ 
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL

SET !VAR3 Follow
SET !VAR4 Following

SET !VAR7 EVAL("('{{!VAR0}}' == '{{!VAR3}}') ? 30 : 0;")

wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow   
wait seconds = {{!VAR7}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_

Thank you for all the help as always Chivracq :)
Learned a lot trying to figure this one out
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Eval if tag, else move on

Post by chivracq » Wed Feb 10, 2016 7:25 pm

Fuledbyramen wrote:It works now!

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 10

URL GOTO=https://www.instagram.com/instagram/ 
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL

SET !VAR3 Follow
SET !VAR4 Following

SET !VAR7 EVAL("('{{!VAR0}}' == '{{!VAR3}}') ? 30 : 0;")

wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow   
wait seconds = {{!VAR7}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_
Thank you for all the help as always Chivracq :)
Learned a lot trying to figure this one out
Well-well-well..., very good...!! :D

Yep, I hope you don't get frustrated about the "slow Process" before you finally got your Script running, but it's indeed more useful for yourself if you manage to get it to work by yourself rather than if I had written it for you, which would have taken me about 1 min, I guess...

You are using this interesting simplified Syntax in your 'EVAL()' that I might start using from time to time as well, especially for "easy" 'EVAL()' Statements, but I'm afraid that Syntax might be more difficult to follow and debug for more "complex" Statements...

Here is how I would have written your Macro myself...:

Code: Select all

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 10
FILTER TYPE=IMAGES STATUS=OFF

URL GOTO=https://www.instagram.com/instagram/

'Extract "Follow"/"Following":
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT

'Set Conditional WAIT (Follow = 30 sec / (Already) Following = 0 sec):
SET WAIT_Time EVAL("var s='{{!EXTRACT}}'; var x; if(s=='Follow'){x=30;} else{x=0;}; x;")
'>
'Debug Vars:
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR><BR>WAIT_Time:<SP>_{{WAIT_Time}}_

SET !TIMEOUT_STEP 0
WAIT SECONDS={{WAIT_Time}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow   
WAIT SECONDS={{WAIT_Time}}
(Not tested...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Fuledbyramen
Posts: 16
Joined: Sun Jan 31, 2016 12:12 am

Re: Eval if tag, else move on

Post by Fuledbyramen » Wed Feb 10, 2016 8:42 pm

Tested and it works!

I didnt think about defining them within the actual Eval itself, is there a big difference or just simple preference?

and what does the x have to do alone by itself at the end?

but yes I know why you were doing that hahaha, it did help and I learned quite a bit just looking around for an answer, thank you
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Eval if tag, else move on

Post by chivracq » Wed Feb 10, 2016 9:23 pm

Fuledbyramen wrote:Tested and it works!

I didnt think about defining them within the actual Eval itself, is there a big difference or just simple preference?

and what does the x have to do alone by itself at the end?

but yes I know why you were doing that hahaha, it did help and I learned quite a bit just looking around for an answer, thank you
Glad that it works as well, there are always different ways to write the same 'EVAL()' Statement...

No difference at all, just a preference indeed... I always try to declare all Vars/Values that I will be using in an 'EVAL()' Statement at the beginning, easily visible and with just 1 or 2 Letter Vars, it doesn't really make a difference I guess when you have a short EVAL like in your case, but I have EVAL's with more than 100 Conditions that cannot be debugged at one glance like yours, like that I know which Vars to include in my PROMPT to follow without having to scroll horizontally for 20 Screens... And if I need to modify some Value for a Var, I declare it at the complete beginning of my Script for easy access without having to search for it/them as it could be reused several times in the same Script and/or same EVAL...

The "x;" at the end of the 'EVAL()' Statement is to make sure which Var/Value the EVAL will be returning. It is sometimes not needed indeed, but very often it is, like that I know that's never the Pb if I don't get the expected Result...
And I sometimes use some Temp Results with 'y' + 'z' in the same EVAL for some Temp Calcultations / String Manipulations if it gets a bit complex and/or if those Temp Results might be used more than once in the EVAL...

And if you ever need it (that's why I enclosed the '{{!EXTRACT}}' between '_' (Underscore) in the PROMPT), the 'trim()' JavaScript Command is a "weird" Command that cannot be combined with any other JavaScript Commands in the same EVAL and needs its own Temp EVAL.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Remyelin
Posts: 1
Joined: Sun Mar 12, 2023 6:35 am

Re: Eval if tag, else move on

Post by Remyelin » Sun Mar 12, 2023 6:42 am

Hello there,

Instagram changes its website with slight differences. Unfollow button appears after clicking the Following button in the popup window. So those codes don't work. Could you help me out?
Post Reply