Imacros Javascript iim function to compare value If or Else if

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
provoquestosito
Posts: 54
Joined: Sat Jan 30, 2010 12:43 am

Imacros Javascript iim function to compare value If or Else if

Post by provoquestosito » Sat Dec 29, 2018 1:37 am

My configuration is OS: windows 7 ultimate Estension: imacros 8.9.7 Browser: Firefox 56

I have a variabile with my ip address example

var1 = 123.123.123.123

I have a csv file with all bad ip address to compare with my ip (var1)

list of bad ip to compare with var1:

badip.csv
111.111.111.111
112.112.112.112
113.113.113.113
114.114.114.114
115.115.115.115
116.116.116.116
117.117.117.117
118.118.118.118
119.119.119.119
120.120.120.120

Now I need with imacros (iim or js) to compare my ip addres (var1) with all badip saved in csv, and only after comprare my ip address (var1) with all bad ip saved in csv if my ip address (var1) is NOT present in badip.csv list go on mysite.com.

I need to compare my ip address (var1) with all badip and only if my ip address (var1) is NOT present in badip.csv list the macro continue loading mysite.com.

If my ip address (var1) is present in badip.csv the macro must not continue or stop.

Thanks for suggestion.
chivracq
Posts: 8144
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Imacros Javascript iim function to compare value If or Else if

Post by chivracq » Sat Dec 29, 2018 2:59 am

provoquestosito wrote:
Sat Dec 29, 2018 1:37 am
My configuration is

Code: Select all

OS: windows 7 ultimate Estension: imacros 8.9.7 Browser: Firefox 56
I have a variabile with my ip address example

Code: Select all

    var1 = 123.123.123.123
I have a csv file with all bad ip address to compare with my ip (var1)

list of bad ip to compare with var1:

badip.csv

Code: Select all

    111.111.111.111
    112.112.112.112
    113.113.113.113
    114.114.114.114
    115.115.115.115
    116.116.116.116
    117.117.117.117
    118.118.118.118
    119.119.119.119
    120.120.120.120
Now I need with imacros (iim or js) to compare my ip addres (var1) with all badip saved in csv, and only after comprare my ip address (var1) with all bad ip saved in csv if my ip address (var1) is NOT present in badip.csv list go on mysite.com.

I need to compare my ip address (var1) with all badip and only if my ip address (var1) is NOT present in badip.csv list the macro continue loading mysite.com.

If my ip address (var1) is present in badip.csv the macro must not continue or stop.

Thanks for suggestion.
Yep, very same Qt/Principle like some other Thread just opened earlier a few hours ago, => and same Answer more or less... :wink:
Hum, except that in your Case, if you "only" have 10 Entries in your '.CSV', then the "Speed/Efficiency" Criteria I mentioned in the other Thread (for 20,000-1000,000 Entries) wouldn't play a Role in your Case and I don't see any Reason to avoid implementing that Functionality from a '.js' Script..., which is then pretty simple and has been posted several times already on the Forum... (not by me, as I always do all my Coding in pure '.iim'...) 8)
But if you ever "plan" on updating FF56 to some later Version, you'll then have to update iMacros as well from v8.9.7 to some v10.x for FF Version, and current Version v10.0.2 for FF doesn't support '.js' Scripts (anymore/yet), so you'd be forced to go for "my" '.iim' Solution... (or some 3rd Solution that I'll let you find by yourself, see below...). :|

=> :idea: Search the Forum or follow the other Thread, I won't be helping you more "precisely" as you acted a bit too arrogantly towards me "for my Taste" in your previous Thread, tja...! :roll:
But it takes me less than 10 Sec to find 3 different Implementations for your Scenario, you should be able to find at least one if you've been using iMacros (correct Spelling btw...!) since 2010, I would think... :shock:

+ Parallel Thread on SOF:
- Imacros Javascript iim function to compare value If or Else if
- (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...
provoquestosito
Posts: 54
Joined: Sat Jan 30, 2010 12:43 am

Re: Imacros Javascript iim function to compare value If or Else if

Post by provoquestosito » Thu Jan 17, 2019 1:02 am

Thanks i solved reading some example

Have a nice day
Post Reply