Forum rulesBefore 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:

Hi, At the moment I am writing java code that reads from a CSV file that includes different URL's of webpages on which I want to run a macros code.The macros code obviously varies slightly according to the information in the CSV. After the CSV file is filled with the appropriate information one double click on the program I wrote, writes all the necessary iMacros code for me and saves. I then need to run it. I am very satisfied with this current framework even though it may not be the most efficient it allows me the flexibility I need.

Now in the iMacros code the java program is writing I want to extract numbers from the webpages and then I want to make decisions based on which range the numbers saved in VAR1,VAR2,VAR3 fall in.

What I've read so far seems to indicate this cannot be done using simple iMacros and any decision making needs to be done by my java code. Is this right?

If so what is the best way to work around this? Reading the data manually from the website and inserting it in the CSV is one option, but I'd like to avoid that scenario. I'd like the decision making to be done after the java code has been executed, hence at the iMacros level after the data has been extracted.

Late Reply and I guess/hope you'll have found a workable Solution for you in the meantime, but I didn't check the Forum that much between Xmas and NYE..., but I'll give you my Feedback anyway...:

I do use 2 Techniques in .iim Macros to force some kind of basic Conditional Processing in my Macros:- The first one is to cleverly (sounds like I'm giving myself already some compliments...! ) use/misuse Relative Positioning by first tagging some informative Text Element and if that Text is found, I then R-tag the next Action Button, which means that my Macro will actually click on the Button only if the given Text is found.

- The other Technique I use is to apply some EVAL Statement on generally some Extracted Data but you can apply it to any Variable and to spit out a '0' or a '1' or some tailored Text that I will later on reuse for "TAG POS={{!VAR1}}" or "CONTENT={{!VAR2}}.If !VAR1=0, then "TAG POS=0" won't do anything...

Oh!, actually, I didn't even need to use EVAL in this Example where I want to spit out a '1' only for 30 Liters but another trick with "-29"..., but you get the Principle...

But for more complex Conditional Processing, you'll need to handle the Logic from a .js Script, but I already come quite far in .iim Macros only, as I'm not a Javascript Guru, I try to avoid Javascript...

- (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...

chivracq wrote:Concerning your main Question about the unresponsive Script Warnings with iimPlay(), I haven't run into it yet, because I still only use .iim Scripts in which I have developed high Skills to until now always succeed to manage to handle the Conditional Behaviour using EVAL, Relative Positioning and very short !TIMEOUT, though converting my 10.000+ Lines of Code to smaller .iim Macros run from .js Scripts is my next big Project, but that would require a major Rewrite of the complete Workflow, so I haven't started yet...

That's very interesting. I had heard a few years ago of people using iMacros iim files with conditional behavior, and without wrapping in a js file. How are you doing it?

I already explained some of my Methods in this Thread:Decision Making using iMacros/Possible WorkaroundsI gave a few Examples, maybe not the best ones, or I have some more and maybe better, we can continue that Discussion in the other Thread if you want, in order not to "pollute" your original Question in this current Thread, or I will make it into a HowTo one day..., but basically, I play (cleverly!) with EVAL, !ERRORIGNORE, Relative Positioning based on some Text Info, and !TIMEOUT and !TIMEOUT_STEP... And I use EVAL often to spit out a "1" or a "0" to use for TAG POS=1/0, knowing that POS=0 won't do anything... or some String that I will reuse for URL or ID or CONTENT, being valid or not...

- (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...

basically, I play (cleverly!) with EVAL, !ERRORIGNORE, Relative Positioning based on some Text Info, and !TIMEOUT and !TIMEOUT_STEP... And I use EVAL often to spit out a "1" or a "0" to use for TAG POS=1/0, knowing that POS=0 won't do anything... or some String that I will reuse for URL or ID or CONTENT, being valid or not...

I'm sorry this is off topic, but I just wanted to say thanks to chivracq for this idea, it's brilliant! Now I know how to rewrite some older, awful written macros of mine. Also if you'd have some other tips, I'd really appreciate it!

Edit: OMG this is really fu***ng brilliant!!! Using this method I've rewritten 3 very long and hard to read macros and now the code is simply beautiful! Thanks again!!

Yes, this is indeed off Topic, that's why I mentioned in my previous Msg to continue the Discussion on that Subject in the other (dedicated) Thread... where I will post my Reply... But glad to hear you are already happy, Petr...!

petr wrote:This is extremely useful! If you've got other tips on this subject, I'm all eyes )

OK, you've managed to locate the "dedicated" Thread...!

But anyway, glad to hear that you like my Method... And yes, I do have many other Examples as, as I mentioned before, all the Conditional Behaviour contained in my 10.000+ Lines of Code is entirely done using that Technique in .iim Code, as I don't use (yet) .js Macros...

One Example I quite like is the following:(I need to switch on the Light in some Game between 20h-08h by pressing a Switch On/Off Button on the Page. Then I use:)

Last edited by chivracq on Mon Mar 30, 2015 3:39 pm, edited 1 time in total.

- (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...

chivracq wrote:But for more complex Conditional Processing, you'll need to handle the Logic from a .js Script, but I already come quite far in .iim Macros only, as I'm not a Javascript Guru, I try to avoid Javascript...

Thanks for the great tips. Creative. I think you'd do well in javascript given your ingenuity working with iim script. The one thing that bugs me about javascript for iMacros is the apparent inability to include other js files so that I can put all my utility functions in a separate file, for example. But I'm a novice at javascript so maybe there's something I'm missing.

chivracq wrote:But for more complex Conditional Processing, you'll need to handle the Logic from a .js Script, but I already come quite far in .iim Macros only, as I'm not a Javascript Guru, I try to avoid Javascript...

Thanks for the great tips. Creative. I think you'd do well in javascript given your ingenuity working with iim script. The one thing that bugs me about javascript for iMacros is the apparent inability to include other js files so that I can put all my utility functions in a separate file, for example. But I'm a novice at javascript so maybe there's something I'm missing.

Okay..., thanks for the appreciation and the compliment (more, more!!!), I will have very soon to go diving into JavaScript as, as I mentioned it earlier to you, my next big Project is indeed to (partially) convert my .iim Macros into .js Scripts as I have a lot of redundant Code and that's a pain in the @ss to maintain, each time I want to modify/improve stg... I used to be a Senior Programmer (in PowerBuilder from Sybase) and I've already experimented with most Programming Languages, so I think I will manage as well with JavaScript but it's always a bit frustrating to start all over again like a new born baby when you tackle a new Language...

About including your Functions in some external Library, there are a few Threads on the Forum about that Subject, I think I remember reading..., among others, one about using jQuerry, so if it's possible with jQuerry, it must be possible with your own Library, I would think...

- (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...

As I'm often referring to this current Thread for Users starting new Threads where these Techniques can be used, I'm adding a Section (that I will keep maintaining) where I mention other Threads that can serve as extra Examples...

+Adding a direct Link to this (original) Current Thread as it's been included (copied) to the 'Howto' Sub-Forum by TechSupport as a useful Thread, for me to be able to locate a bit easily the original Thread when I want to edit it to add some other Links to interesting Threads:- Decision Making using iMacros/Possible Workarounds(Hum, no wonder I was having some difficulties to locate the original Thread, I had not realized the Thread Title had been modified, ah-ah...!)

Last edited by chivracq on Sat Oct 07, 2017 2:58 am, edited 3 times in total.

- (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...

- (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...

Sharoun wrote:, SOrry my bad chivracq, good on ya mate I agree with petr, i know this is a dead thread (OLD thread) but the tips mentioned here are gold

Thread is not dead, I keep adding from time to time relevant Threads with "good Examples" to my earlier Post in this current Thread and I mentioned in my last Post all Keywords that can be used to find all more recent Threads about "Conditional whatever...!" on the Forum:

Hum, Quote from previous User was from a fake User who only registered on the Forum to be able to post some Spam... Post and User will be deleted, one day...!

Last edited by chivracq on Sat Oct 07, 2017 2:49 am, edited 1 time in total.

- (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...