i want to ask if i want to scrape data from this web page
i have macro
Code: Select all
TAG POS=1 TYPE=LI ATTR=TXT:Luas<SP>tanah<SP>:<SP>400<SP>m
if i just want to extract the number "400"
how is the script?
sorry my english not good,i am newbie in imacros script
(Read my Sig...)
Yeah, well..., same Principle like explained in this Thread for the original User, use 'split()' on " : " for example for the first 'split()', and then on the Space " " or " m" for the 2nd 'split()', or if you always get " m" at the end of the Extract, you could use 'replace()' instead..., what you prefer...
(Only be aware that you need to use "real" Spaces for 'split()' and/or 'replace()', I'm not sure it will work with "<SP>"...)
There is supposed to be a "short way" in your Case which is more of a "Trick", as you only want to keep the Number part in your String, using 'parseInt()', but I did some quick Testing in v8.8.2 for FF + v8.9.7 for FF, and I didn't get it to work as expected in both Versions, all I get is "NaN" in all Cases... (with 'parseInt()' + 'parseFloat()' + 'Number()' + "*1", with "<SP>" or real Spaces or even without any Spaces at all...), but even if it worked, I guess iMacros would get "confused" if by any chance some extra Number might be present in your Extract like in "Luas2 tanah..." or "...400 m2" for example..., then the 'split()' Method will be more "reliable" anyway...
- (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...