how to extract the certain word in id ?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
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
a2515125
Posts: 114
Joined: Tue Dec 06, 2016 3:37 am

how to extract the certain word in id ?

Post by a2515125 » Tue Oct 10, 2017 3:24 am

imacro 8.9.7/windows10/FF50.1


hey,

I have trouble of extracting the certain word inside the id
I only can extract "rc.u_0_24" by my code but I want to extract "u_0_24" Only
how can I get rid of "rc." because they are packed as one....Orz

it is sad that we can not use * to replace variable inside" " in event mode


i think there are three ways to achieve it but dont know how to use regular expression correctly

1. extract u_0_24 from "rc.u_0_24"
2. replace "rc.u_0_24" as "rc\\.u_0_24"
3. clean "rc."

need a help at this part.....Orzzz

Code: Select all


SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=CLASS:_1cx1<SP>_4qr4<SP>_4aay<SP>_4ab3<SP>_2qma EXTRACT=HTM

SET !VAR2 EVAL ("var s='{{!EXTRACT}}'; var z=s.split('\"'); z[11];")
'PROMPT {{!EXTRACT}}
PROMPT {{!VAR2}}

Image
Image
Last edited by a2515125 on Thu Oct 12, 2017 1:57 am, edited 2 times in total.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to extract the certain word in id

Post by chivracq » Thu Oct 12, 2017 12:51 am

a2515125 wrote:

Code: Select all

imacro 8.9.1/windows10/FF50.1
hey,

I have trouble of extracting the certain word inside the id
I only can extract "rc.u_0_24" by my code but I want to extract "u_0_24" Only
how can I get rid of "rc." because they are packed as one....Orz

it is sad that we can not use * to replace variable inside" " in event mode

i think there are three ways to achieve it but dont know how to use regular expression correctly

1. extract u_0_24 from "rc.u_0_24"
2. replace "rc.u_0_24" as "rc\\.u_0_24"
3. clean "rc."

need a help at this part.....Orzzz

imacro 8.9.1/windows10/FF50.1

Code: Select all

SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=CLASS:_1cx1<SP>_4qr4<SP>_4aay<SP>_4ab3<SP>_2qma EXTRACT=HTM

SET !VAR2 EVAL ("var s='{{!EXTRACT}}'; var z=s.split('\"'); z[11];")
'PROMPT {{!EXTRACT}}
PROMPT {{!VAR2}}
Image
Image
Hum..., pretty sure FCI was not mentioned when I had checked the Thread after you had started it, it's always a bit "dangerous" to silently edit your Post later to add some missing Info, chances are I won't notice it, FCI is the first thing I check to decide if I read or not..., and you may post it a bit more "visible" at the complete beginning of your Post like I do in my Quote, rather than lost "somewhere" in the middle of your Post... (then I would already have replied 2 days earlier...)
But OK... hum, v8.9.1 is no Standard Version, you can better use v8.9.7 I would think..., which works on your FF50... and still until at least FF v55.0.3, which is the FCI I use myself...)

But, yep, to isolate your String, yep, 'split()' is the way, but you need a Double 'split()', for before and after your String, but that should be a 'piece of cake" if you understand a bit how 'split()' works, and I've already posted dozens of Examples on the Forum... :idea:
You can use more than 1 Char in the 'split()'... => Try using a longer String than only your '\"' on the Double Quote which forces you to keep the 12th Result for the 1st 'split()', stg that will be a bit more unique than only one single Double Quote... :idea:

Hum, and your Thread Title could use a "?", you are not sharing a 'HowTo'...! (One more Reason why I didn't reply then...) :roll:
Last edited by chivracq on Thu Oct 12, 2017 2:10 am, edited 1 time in total.
- (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...
a2515125
Posts: 114
Joined: Tue Dec 06, 2016 3:37 am

Re: how to extract the certain word in id ?

Post by a2515125 » Thu Oct 12, 2017 2:02 am

thanks to mention that...
i will remember to put FCI at the very beginning of my post

yes I use imacros v8.9.7 and FF v50.1
the reason i use FF v 50.1 is beacause I need multifox v3.2.3 working as well
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to extract the certain word in id ?

Post by chivracq » Thu Oct 12, 2017 2:31 am

a2515125 wrote:thanks to mention that...
i will remember to put FCI at the very beginning of my post

yes I use imacros v8.9.7 and FF v50.1
the reason i use FF v 50.1 is beacause I need multifox v3.2.3 working as well
OK, "?" in the Thread Title, good...!

OK for your FCI, so you are on v8.9.7 and not v8.9.1, OK, that's more "Standard", afaik, there is no "Reason" to use v8.9.1...
(v8.8.2 + v8.8.7 + v8.9.7 + v9.0.3 are the 4 Versions that should be used, each with their own (Compatibility) "Reason"..)

And yep, nothing wrong with FF50, TechSupport now even recommends to use FF49 (together with v8.9.7), from some recent Thread in the 'News and Announcements' Sub-Forum because of FF56 breaking v9.0.3... I still haven't tried/tested if v8.9.7 still works on FF56, but if I can't get it to work (a bit properly like FF v55.0.3) and that I need to roll FF back, I will then probably go back to FF51 myself as some Command that I really use(d) ('FILTER') got broken from FF52 or FF53... :roll:

But OK, did you "progress" / find the Solution to isolate your String with a Double 'split()'...?
- (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...
a2515125
Posts: 114
Joined: Tue Dec 06, 2016 3:37 am

Re: how to extract the certain word in id ?

Post by a2515125 » Thu Oct 12, 2017 9:05 am

NO :((

still struggling with regular expression.....
especially have no idea about double split...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to extract the certain word in id ?

Post by chivracq » Thu Oct 12, 2017 1:27 pm

a2515125 wrote:NO :((

still struggling with regular expression.....
especially have no idea about double split...
Beh...!, the "Purpose" of the Double 'split()' is to avoid using 'REGEXP' which I find myself also very difficult to use while 'split()' is 10 times easier...

But I don't understand why you are struggling with what I call Double 'split()'... Your original Script already contains one (correct) 'split()' Statement... You simply need another one to cut your String on the other Side, that's all...!

And if you search the Forum a bit, check a few of my recent Posts, I think I probably use a Double 'split()' in 8 out of 10 (mini-)Scripts I write, you'll find oooooooodles of Examples...! :wink:
It's so easy that I don't want to write that Line for you, ah-ah...! :twisted:

This current Thread is actually very-very-very similar to some previous Thread of yours where you directly tried to use Double 'split()', then you already know what it is... (OK, even if I guess you finally went for some other Solution in that Thread provided by some other Advanced User who jumped into the Thread...) Which means as well, I've already used Double 'split()' for some previous-previous Thread(s) of yours...
- (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...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to extract the certain word in id ?

Post by chivracq » Mon Oct 16, 2017 3:37 pm

And...?, any Progress in this one...?, as last Post is now already from 4 days ago...

Don't worry, if you are still stuck, I will give you the/a Solution, even if there is nothing very difficult in what you want to do, you should be able to find the Solution by yourself, as you keep needing the same Functionality/Technique in most of your (previous) Threads, you should have it "under control" by now, I would think... :o
- (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...
a2515125
Posts: 114
Joined: Tue Dec 06, 2016 3:37 am

Re: how to extract the certain word in id ?

Post by a2515125 » Sat Nov 04, 2017 7:29 am

the answer is here finally...........thanks
------------------------------------------------------
sorry i am a not very working hard student last week. haha :idea:
I am surprised and impressed that you still follow up my question...thanks for that ^^

I was using the stupid way to try..............all its possibility
put all u_0_24/u_0_25/u_0_23/u_0_26 to try, it works most of time

but when I put some wait like couple of hours, it changes it patterns after every hours that beyond my guess such as u_2f_a/u_2f_x/u_*_*
that really pushes me to figure out the ultimate split method ......... :lol:

Code: Select all

SET !ERRORIGNORE YES
TAG POS=1 TYPE=DIV ATTR=CLASS:_4lmd<SP>_36bx<SP>_4-u2<SP>_4-u8 EXTRACT=HTM
SET !VAR1 EVAL ("var s='{{!EXTRACT}}'; var x,y,z; z=s.split('id=\"rc.');y= z[1].split('\" class=\"_4lmd');y[0];")
PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to extract the certain word in id ?

Post by chivracq » Sat Nov 04, 2017 5:49 pm

a2515125 wrote:the answer is here finally...........thanks
------------------------------------------------------
sorry i am a not very working hard student last week. haha :idea:
I am surprised and impressed that you still follow up my question...thanks for that ^^

I was using the stupid way to try..............all its possibility
put all u_0_24/u_0_25/u_0_23/u_0_26 to try, it works most of time

but when I put some wait like couple of hours, it changes it patterns after every hours that beyond my guess such as u_2f_a/u_2f_x/u_*_*
that really pushes me to figure out the ultimate split method ......... :lol:

Code: Select all

SET !ERRORIGNORE YES
TAG POS=1 TYPE=DIV ATTR=CLASS:_4lmd<SP>_36bx<SP>_4-u2<SP>_4-u8 EXTRACT=HTM
SET !VAR1 EVAL ("var s='{{!EXTRACT}}'; var x,y,z; z=s.split('id=\"rc.');y= z[1].split('\" class=\"_4lmd');y[0];")
PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}
Ah...!, some Follow-up..., good...!

Yep, exactly what I meant, now you should have understood how the "Technique" works... The 2nd 'split()' could eventually be a bit simplified, to cut only on the 2nd Double Quote, without the whole 'class' part:

Code: Select all

SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('id=\"rc.'); y= x[1].split('\"'); z=y[0]; z;")
But don't worry, your Solution is good enough... :D

Hum, be only a bit careful with the extra Space you've included directly after "EVAL", there is one Browser (I don't remember which one...) which doesn't accept that extra Space...
- (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...
Post Reply