Easy and Fast way to update {{!COLX}} values in macro

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: 57
Joined: Sat Jan 30, 2010 12:43 am

Easy and Fast way to update {{!COLX}} values in macro

Post by provoquestosito » Thu Jul 18, 2019 6:28 pm

Hi

I have imacros 8.9.7 with firefox 52 ESR and windows 7.

I search a fast and easy way to update the {{!COL1}} values in my macro.

This is an example of my macro code

Code: Select all

TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL16}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL17}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL18}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL19}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL20}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL21}}
If, for example, I had 1000 columns to specify in the code, is there a simpler and faster solution compared to writing them manually ?

I'm looking for a simple and quick solution to be able to write column variables quickly and be able to manage them unlimited.

Thanks
provoquestosito
Posts: 57
Joined: Sat Jan 30, 2010 12:43 am

Re: Easy and Fast way to update {{!COLX}} values in macro

Post by provoquestosito » Thu Jul 18, 2019 6:42 pm

For tag pos i find a solution like this

Code: Select all


SET Pos 0

ADD Pos 1
TAG POS={{Pos}} TYPE=TD ATTR=TXT:Type

ADD Pos 1
TAG POS={{Pos}} TYPE=TD ATTR=TXT:Type

ADD Pos 1
TAG POS={{Pos}} TYPE=TD ATTR=TXT:Type

ADD Pos 1
TAG POS={{Pos}} TYPE=TD ATTR=TXT:Type

For Pos from 1 to 4 it's very fast to copy and paste.

I'm searching a similar solution to update {{!COLX}} values

Thanks
chivracq
Posts: 8430
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Easy and Fast way to update {{!COLX}} values in macro

Post by chivracq » Thu Jul 18, 2019 6:51 pm

provoquestosito wrote:
Thu Jul 18, 2019 6:28 pm
Hi

I have

Code: Select all

imacros 8.9.7 with firefox 52 ESR and windows 7.
I search a fast and easy way to update the {{!COL1}} values in my macro.

This is an example of my macro code

Code: Select all

TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL16}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL17}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL18}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL19}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL20}}
TAG POS=1 TYPE=LABEL FORM=ID:post ATTR=TXT:{{!COL21}}
If, for example, I had 1000 columns to specify in the code, is there a simpler and faster solution compared to writing them manually ?

I'm looking for a simple and quick solution to be able to write column variables quickly and be able to manage them unlimited.

Thanks

Yep there is, hum, are actually, one in '.js' as you are on v8.9.7 for FF, where you can concatenate the '!COLn' as '!COL' + 'n' as a String, and a "more powerful" one, I would think, in pure '.iim' by simply "misusing" the '!DATASOURCE_DELIMITER' Command, and changing it temporarily to some "fake" Separator to extract a complete Row with just one single '{{!COL1}}' and using 'EVAL()' + 'split()', you re-split that whole Row into all Cols... 8)
(Index starts at "0" for 'split()'...)

I never tested though about "Speed" as you are talking about 1000 Cols. It's "instant" for about 20 Cols, I don't know for 1000 Cols...

And I also have an EnhReq about that, that you are 'encouraged' to support...!: :wink:
- Re: List of EnhReq's...!! [by @chivracq]
=> About Item_14, the "Super Built-in Var"...! :twisted:

provoquestosito wrote:
Thu Jul 18, 2019 6:42 pm
For tag pos i find a solution like this

Code: Select all


SET Pos 0

ADD Pos 1
TAG POS={{Pos}} TYPE=TD ATTR=TXT:Type

ADD Pos 1
TAG POS={{Pos}} TYPE=TD ATTR=TXT:Type

ADD Pos 1
TAG POS={{Pos}} TYPE=TD ATTR=TXT:Type

ADD Pos 1
TAG POS={{Pos}} TYPE=TD ATTR=TXT:Type

For Pos from 1 to 4 it's very fast to copy and paste.

I'm searching a similar solution to update {{!COLX}} values

Thanks

Yep, exactly...!, and you'll be using your 'Pos' on the Index for the 'split()[n]' + "ADD 1", only initializing your 'Pos' at "-1" for the 'ADD 1' to start at "0"... 8)
- (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: 57
Joined: Sat Jan 30, 2010 12:43 am

Re: Easy and Fast way to update {{!COLX}} values in macro

Post by provoquestosito » Sat Jul 20, 2019 3:41 pm

Hi @chivracq

Thanks for suggestion.

Can you provide me an example in pure iim (I prefer iim).

I do not know this command '!DATASOURCE_DELIMITER' .

If you can provide me an example i can know how create this feature in my macro.

This part i do not know well how i can i create
I would think, in pure '.iim' by simply "misusing" the '!DATASOURCE_DELIMITER' Command, and changing it temporarily to some "fake" Separator to extract a complete Row with just one single '{{!COL1}}' and using 'EVAL()' + 'split()', you re-split that whole Row into all Cols... 8)
(Index starts at "0" for 'split()'...)

I never tested though about "Speed" as you are talking about 1000 Cols. It's "instant" for about 20 Cols, I don't know for 1000 Cols...
Thanks
chivracq
Posts: 8430
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Easy and Fast way to update {{!COLX}} values in macro

Post by chivracq » Sat Jul 20, 2019 5:28 pm

provoquestosito wrote:
Sat Jul 20, 2019 3:41 pm
Hi @chivracq

Thanks for suggestion.

Can you provide me an example in pure iim (I prefer iim).

I do not know this command '!DATASOURCE_DELIMITER' .

If you can provide me an example i can know how create this feature in my macro.

This part i do not know well how i can i create
I would think, in pure '.iim' by simply "misusing" the '!DATASOURCE_DELIMITER' Command, and changing it temporarily to some "fake" Separator to extract a complete Row with just one single '{{!COL1}}' and using 'EVAL()' + 'split()', you re-split that whole Row into all Cols... 8)
(Index starts at "0" for 'split()'...)

I never tested though about "Speed" as you are talking about 1000 Cols. It's "instant" for about 20 Cols, I don't know for 1000 Cols...
Thanks

Ah...!?, OK... Well, it's not very complicated, and especially for you I would think, if you've been using iMacros for nearly 10 years... :o
But OK, here we go, and I even include some "Mechanism" to avoid the Index=0 and to sync the '!COLn' and the 'split()[n]'... 8)
And as I'm not sure about Speed for 1000 Cols, I retrieve one full Row only once and store it in a Var...

Code: Select all

SET Separator ##
SET !DATASOURCE_DELIMITER {{Separator}}
SET Full_Row {{Separator}}{{!COL1}}
SET Col_Index 0

ADD Col_Index 1
SET Col_n EVAL("var fr='{{Full_Row}}', n='{{Col_Index}}', s='{{Separator}}'; var z; z=fr.split(s); z[n];")
TAG POS={{Col_Index}} TYPE=LABEL FORM=ID:post ATTR=TXT:{{Col_n}}

ADD Col_Index 1
SET Col_n EVAL("var fr='{{Full_Row}}', n='{{Col_Index}}', s='{{Separator}}'; var z; z=fr.split(s); z[n];")
TAG POS={{Col_Index}} TYPE=LABEL FORM=ID:post ATTR=TXT:{{Col_n}}

'Etc...
... And you repeat the 3 Line Block as often as you want...

(Not tested of course...)
- (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...
Post Reply