Page 1 of 1

Same position, different attributes

Posted: Tue Nov 28, 2017 9:17 am
by BarryTheBaptist
Hello,

I'm looking for some help due to certain extraction from a website.
When I try to extract this info I receive this code TAG POS=1 TYPE=A ATTR=TXT:12578455 and this number changes constantly, auto generated based on task, after clicking on it, it basically, disappears until new task is created.
Is there any solution that macros would be able to click on it no matter what ID is. Please advise.

Thanks!

Re: Same position, different attributes

Posted: Tue Nov 28, 2017 10:04 am
by chivracq
BarryTheBaptist wrote:Hello,

I'm looking for some help due to certain extraction from a website.
When I try to extract this info I receive this code TAG POS=1 TYPE=A ATTR=TXT:12578455 and this number changes constantly, auto generated based on task, after clicking on it, it basically, disappears until new task is created.
Is there any solution that macros would be able to click on it no matter what ID is. Please advise.

Thanks!

CIM...! :mrgreen: (Read my Sig...)

Hum, "info" is a bit vague in"extract this info", and a bit contradictory with "would be able to click on it", so it's not clear if you want to extract that Link or to click on it... :?
But in order to tag your Link to extract whatever "Info" you want from it, or to click on it, you can use a Wildcard on the 'TXT' Attribute (and you then might have to adjust the 'POS=n' Parameter), maybe combined with "Relative Positioning" to try to keep the 'POS=n' as low as possible, hopefully/ideally as "POS=R1"... (And this sounds like the Sol you need from your Case Description...)
Or identify and use some other Attribute(s) for that Link rather than only the 'TXT' Attibute, => Class / ID / HREF for example, maybe combined with Wildcards if any part might be Dynamic...

Re: Same position, different attributes

Posted: Tue Nov 28, 2017 10:25 am
by BarryTheBaptist
Thank you for the reply and sorry I'm new to imacros. I'm trying to click on it. Function of this macro would be just to refresh the website until mentioned tasks appear and click on it but as I mentioned I'm having trouble with prerecording it since for every new task, there's a different, randomly generated ID.

Re: Same position, different attributes

Posted: Tue Nov 28, 2017 2:35 pm
by chivracq
BarryTheBaptist wrote:Thank you for the reply and sorry I'm new to imacros. I'm trying to click on it. Function of this macro would be just to refresh the website until mentioned tasks appear and click on it but as I mentioned I'm having trouble with prerecording it since for every new task, there's a different, randomly generated ID.

Yeah, but sorry, you missed the "CIM" part for me to follow up... :idea:

Re: Same position, different attributes

Posted: Tue Nov 28, 2017 4:44 pm
by BarryTheBaptist
My bad...

iMacros for Firefox 9.0.3
Firefox 55.0.2
Windows 10 64x

This is a recording of already accepted tasks, for upcoming ones, ID is unknown....
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
REFRESH
wait seconds=5
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS
TAG POS=1 TYPE=A ATTR=TXT:12578455
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:12578287
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:12577697
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS

Re: Same position, different attributes

Posted: Tue Nov 28, 2017 5:49 pm
by chivracq
BarryTheBaptist wrote:My bad...

Code: Select all
iMacros for Firefox 9.0.3
Firefox 55.0.2
Windows 10 64x


This is a recording of already accepted tasks, for upcoming ones, ID is unknown....
Code: Select all
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
REFRESH
wait seconds=5
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS
TAG POS=1 TYPE=A ATTR=TXT:12578455
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:12578287
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:12577697
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS

OK, FCI mentioned, now we can "talk"... (Sorry but I usually don't even read the Qt if that Info is not mentioned, and certainly don't answer..., or only once for first time Posters...)

And Script is posted, that's even better, now I have a better Idea, even if I could have a look myself at the Page would even be better...

So, then yep..., like I said, you need to use a Wildcard for the changing part...
Try this one already...:
Code: Select all
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:1257*
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS

... But you might have to adapt the 'POS=n' for the Link like I already said...

And if that doesn't work exactly like you want, then like I already mentioned as well..., you can use Relative Positioning by first tagging some HTML Field, some Text Header or Label that won't change and which is located close to your Link(s) to use as Anchor (and which I think needs to be located in the same Frame like your Link)...:
Code: Select all
FRAME F=0
TAG POS=1 TYPE=DIV/SPAN - I don't know, tag the Field you want to use as Anchor for Relative Positioning...
TAG POS=R1 TYPE=A ATTR=TXT:1257*
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS

Re: Same position, different attributes

Posted: Wed Nov 29, 2017 1:21 pm
by BarryTheBaptist
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:1257*
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS

This one did the trick.

Thank you soooooo much!!

Re: Same position, different attributes

Posted: Wed Nov 29, 2017 2:50 pm
by chivracq
BarryTheBaptist wrote:
Code: Select all
FRAME F=0
TAG POS=1 TYPE=A ATTR=TXT:1257*
FRAME NAME="_TOP_MENU"
TAG POS=1 TYPE=FONT ATTR=TXT:PENDING<SP>ORDERS


This one did the trick.

Thank you soooooo much!!

Ah OK, was a bit of a "lucky" Spear in the Water to catch a Fish, always difficult without being to "play" with the Page myself... 8)

Be aware that the "1257*" Range for your Links will probably one day be exhausted and you'll have to switch to "1258*" or remove the last Digit like in "125*"... Using Relative Positioning would probably have been more "reliable"... :idea: