How to delete point in extract imacros

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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
akunsyamsul
Posts: 1
Joined: Thu Oct 20, 2016 9:05 am

How to delete point in extract imacros

Post by akunsyamsul » Wed Jul 18, 2018 9:49 am

Hi, I need help

How to delete point in extract from imacros ? Example : 3.045 => 3045 (How to Delete this point ?)
I've tried deleting using a script like this can not too

Code: Select all

'ADD !EXTRACT {{!URLCURRENT}}
'WAIT SECONDS=5
TAG POS=1 TYPE=DIV ATTR=TXT:*
SET !TIMEOUT_STEP 0
TAG POS=2 TYPE=STRONG ATTR=CLASS:* EXTRACT=TXT
WAIT SECONDS=1
'SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/./g, \'\');")
PROMPT {{!EXTRACT}}

SAVEAS TYPE=EXTRACT FOLDER=* FILE=ScrapeNumber.csv
WAIT SECONDS=0.5
I'm at a loss and try run script this and not working :lol: :lol:

Code: Select all

'ADD !EXTRACT {{!URLCURRENT}}
'WAIT SECONDS=5
TAG POS=1 TYPE=DIV ATTR=TXT:*
SET !TIMEOUT_STEP 0
TAG POS=2 TYPE=STRONG ATTR=CLASS:* EXTRACT=TXT
WAIT SECONDS=1
'SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/9./g, \'9\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/0./g, \'0\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/1./g, \'1\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/2./g, \'2\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/3./g, \'3\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/4./g, \'4\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/5./g, \'5\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/6./g, \'6\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/7./g, \'7\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/8./g, \'8\');")
PROMPT {{!EXTRACT}}


SAVEAS TYPE=EXTRACT FOLDER=* FILE=ScrapeNumber.csv
WAIT SECONDS=0.5
chivracq
Posts: 8416
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to delete point in extract imacros

Post by chivracq » Wed Jul 18, 2018 12:41 pm

akunsyamsul wrote:Hi, I need help

How to delete point in extract from imacros ? Example : 3.045 => 3045 (How to Delete this point ?)
I've tried deleting using a script like this can not too

Code: Select all

'ADD !EXTRACT {{!URLCURRENT}}
'WAIT SECONDS=5
TAG POS=1 TYPE=DIV ATTR=TXT:*
SET !TIMEOUT_STEP 0
TAG POS=2 TYPE=STRONG ATTR=CLASS:* EXTRACT=TXT
WAIT SECONDS=1
'SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/./g, \'\');")
PROMPT {{!EXTRACT}}

SAVEAS TYPE=EXTRACT FOLDER=* FILE=ScrapeNumber.csv
WAIT SECONDS=0.5
I'm at a loss and try run script this and not working :lol: :lol:

Code: Select all

'ADD !EXTRACT {{!URLCURRENT}}
'WAIT SECONDS=5
TAG POS=1 TYPE=DIV ATTR=TXT:*
SET !TIMEOUT_STEP 0
TAG POS=2 TYPE=STRONG ATTR=CLASS:* EXTRACT=TXT
WAIT SECONDS=1
'SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/9./g, \'9\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/0./g, \'0\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/1./g, \'1\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/2./g, \'2\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/3./g, \'3\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/4./g, \'4\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/5./g, \'5\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/6./g, \'6\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/7./g, \'7\');")
PROMPT {{!EXTRACT}}
SET !EXTRACT EVAL("\'{{!EXTRACT}}\'.replace(/8./g, \'8\');")
PROMPT {{!EXTRACT}}

SAVEAS TYPE=EXTRACT FOLDER=* FILE=ScrapeNumber.csv
WAIT SECONDS=0.5
You could add a Question Mark to your Thread Title, you are asking a Qt and not sharing a 'How-To'... :idea:

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

But yep indeed, 'EVAL()' and 'replace()' will be the way, and you correctly use 'PROMPT' to follow your Vars and debug your Script...

I notice you are using Single Quotes inside the 'EVAL()' that you are escaping... Not correct...!
=> This will be correct: \"{{!EXTRACT}}\", and this one as well: '{{!EXTRACT}}', but not a Combination of Escape + Single Quotes...
And it's probably/possibly the same thing inside the 'replace()' as well...

I don't use Global 'replace()', but if you simply need to remove just 1 Dot, then this simple 'replace()' would "do the job":

Code: Select all

SET !EXTRACT EVAL("var s='{{!EXTRACT}}'; var z=s.replace('.',''); z;")
And if you "really" need the Global 'replace()' as you seem to be doing several 'EXTRACT''s, then I prefer this Syntax:

Code: Select all

SET !EXTRACT EVAL("var s='{{!EXTRACT}}'; var z=s.split('.').join(''); z;")
- (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