Code simplification - class values increase by one

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
Brendo
Posts: 5
Joined: Thu Nov 29, 2018 7:29 pm

Code simplification - class values increase by one

Post by Brendo » Fri Jan 11, 2019 2:14 pm

Hello!

In my code there are numeric values of classes in order of magnification.
Is there a way to simplify the code so as not to copy strings thousands of times?

Example:

Code: Select all

'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_1_2 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_1_3 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_2_2 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_2_3 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_3_2 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_3_3 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'etc...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Code simplification - class values increase by one

Post by chivracq » Mon Jan 14, 2019 11:42 am

Brendo wrote:
Fri Jan 11, 2019 2:14 pm
Hello!

In my code there are numeric values of classes in order of magnification.
Is there a way to simplify the code so as not to copy strings thousands of times?

Example:

Code: Select all

'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_1_2 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_1_3 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_2_2 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_2_3 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_3_2 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'some code...
TAG POS=1 TYPE=TD ATTR=CLASS:row_3_3 EXTRACT=TXT  
SET !CLIPBOARD {{!EXTRACT}}
'etc...
CIM...! :mrgreen: (Read my Sig...)

Hum, being nice as I usually don't answer when FCI is not mentioned, and re-hum..., wondering btw why you opened your Thread in the 'iMacros for FF' Sub-Forum, but yep, simply code one Block and loop it, if you still haven't found the/a Solution by yourself...

=> Like that...: :idea:

Code: Select all

TAG POS=1 TYPE=TD ATTR=CLASS:row_{{!LOOP}}_2 EXTRACT=TXT
TAG POS=1 TYPE=TD ATTR=CLASS:row_{{!LOOP}}_3 EXTRACT=TXT  
=> Or like that...: :idea:

Code: Select all

TAG POS={{!LOOP}} TYPE=TD ATTR=CLASS:row_*_2 EXTRACT=TXT
TAG POS={{!LOOP}} TYPE=TD ATTR=CLASS:row_*_3 EXTRACT=TXT  
(But this is very "basic" Functionality for iMacros, you should have a look at the 'Command Reference' in the Wiki for a list of all Commands, and at the Demo-Macros... :idea: )
- (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...
Brendo
Posts: 5
Joined: Thu Nov 29, 2018 7:29 pm

Re: Code simplification - class values increase by one

Post by Brendo » Tue May 14, 2019 8:25 am

Thanks for the help! Your option helped me. Sorry for post a topic in the wrong thread :oops:
Post Reply