Loop in EVAL in Imacros for Firefox

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
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
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loop in EVAL in Imacros for Firefox

Post by chivracq » Tue Jun 05, 2018 5:43 pm

nathanjame wrote:Dear all,
I'm new with JavaScript, so can please help me with this macro?
I need to reload URL (in this case refresh same page) until I don't have word beginning with capitalized A, B or C.
I can't find the way to create loop inside EVAL.
Can somebody help me please?
Thank you!

Code: Select all

VERSION BUILD=7401110 RECORDER=FX
TAB T=1
URL GOTO=http://watchout4snakes.com/CreativityTools/RandomWord/RandomWord.aspx
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=SPAN ATTR=ID:tmpl_main_lblWord EXTRACT=TXT
SET !VAR1 EVAL("var re = /^[A || B || C]/gi; var str = \"{{!EXTRACT}}\"; while(str.search(re) == -1) {URL GOTO=http://watchout4snakes.com/CreativityTools/RandomWord/RandomWord.aspx}")
PROMPT {{!EXTRACT}}
Hum..., you would first need to follow up on your previous Thread(s) if you hope for (other) (Advanced) Users to help you (again), I would think... :roll:

+ (F)CIM...! :mrgreen: (Read my Sig...)
=> Applies to your previous Thread as well, Reason I had not reacted at that time... :idea:

(I would honestly be surprised if you are (still) using v7.40 for FF, unless you (re)installed that maybe 8 years old Version related to your previous Thread, but if you are indeed still using v7.40 or have been using iMacros since that Version, you should be able to answer most Threads on the Forum yourself by now, while your "Misconception" in this current one is a very Newbie one... and has probably been answered more than 100 times on the Forum already... :? )
- (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...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Loop in EVAL in Imacros for Firefox

Post by chivracq » Mon Jun 11, 2018 11:37 pm

Hum..., like I was a bit "afraid", no Follow-up in this current Thread again...

Posting a Post some New User had tried to post a few days ago and that I had disapproved as the User looked a bit "Fake"/Spammer and was mostly trying to advertize for their Web-Site, and I thought they would post their Reply again, without the Spam..., but they didn't...
=> So here is their Post (a bit edited) as it is still a bit relevant for the Thread...:
08/06/2018 - 14:47 Disapproved post “Re: Loop in EVAL in Imacros for Firefox”

I believe it is better you invert the situation here. Instead of writing a macro using EVAL with a loop inside, write a short javascript with a loop which calls a short macro.

You can run a javascript directly in iMacros for Firefox, just as you run a macro.
Cheers
(Original Content in the Quote edited by Moderation to comply with the Forum Rules... [Spam removed])
- (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...
Post Reply