Shaves
Shaves

Reputation: 930

how to identify an object property with iMacros

I writing an macro with vba (excel) and iMacros. When I record clicking in a field, this is the info I get:

TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:gwt-uid-1317

the issue I'm having is the number at the end of that string changes each time. I can click in it with :

TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:gwt-uid-*

but I need the number because the next 3 fields are based on that number. For instance, if it is 1317, the next number is 1326. If it is 1350, then the next number is 1359.

Is there a way to capture that number? Thanks for the help.....

Upvotes: 1

Views: 344

Answers (1)

chivracq
chivracq

Reputation: 699

Hum..., you should always mention your Environment/FCI (Full Config Info) when asking a Qt, not all (iMacros) Commands are implemented for all Browsers/Versions, but OK, this one will work for all Browsers:

=> Yep, easy with 'EXTRACT=HTM' on your Field + 'EVAL()' & 'match()' or I prefer 'split()' (x2) which I find easier to use than 'match()'.

That will give stg like:

SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:gwt-uid-* EXTRACT=HTM
SET gwt-uid_Nb EVAL("var s='{{!EXTRACT}}'; var y,z; y=s.split('gwt-uid-'); z=y[1].split(' '); z[0];")
PROMPT _{{gwt-uid_Nb}}_

=> Replace the 'Space' in the 2nd 'split()' with whatever unique Char/String comes after the 4 Digits in the 'EXTRACT=HTM'... (But avoid Double Quotes and Backslashes...!)

(Not tested as you didn't provide the URL of the Page...)

And you probably don't even need that ID-Number by using "Relative Positioning" for your next 3 Fields...

Upvotes: 1

Related Questions