Need help making a simple counting script

Find a consultant or advertise your services here
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
Post Reply
Matt Whitt
Posts: 1
Joined: Thu Mar 20, 2014 5:38 pm

Need help making a simple counting script

Post by Matt Whitt » Thu Mar 20, 2014 5:45 pm

Basically I need to run an imacro script to see how many times a word appears on a page, Ive seen another post on this and I tried the script and I get errors on line 10.

Basically I dont know how to set the VAR2 to make it count the words. i guess.

SET !EXTRACT_TEST_POPUP NO
URL GOTO=(the URL i need)
SET !VAR1 (word I need found)
TAG POS=1 TYPE=HTML ATTR=* EXTRACT=TXT

this is the part i dont understand.

' Use EVAL with a regular expression to count the number of occurrences of the target word
SET !VAR2 EVAL("var pageText = \"{{!EXTRACT}}\"; var matches = pageText.match(/{{!VAR1}}/gi); matches.length - 1;")
PROMPT "\"{{!VAR1}}\" occurs {{!VAR2}} time(s)"

thats the script i found on the other page..

can someone take out whats not needed, and help me fill in the blanks.

Please and thanks.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Need help making a simple counting script

Post by chivracq » Fri Mar 21, 2014 10:03 am

This is not the correct Sub-Forum if you are looking for a "free" Answer...

(And you'll need to mention your Configuration with Versions (iMacros + Browser + OS).)
- (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...
billhood
Posts: 1
Joined: Thu Apr 02, 2015 10:28 am

Re: Need help making a simple counting script

Post by billhood » Thu Apr 02, 2015 10:32 am

post on this and I tried the script and I get errors on line 10.
Nawaz
Post Reply