Help on removing comma in numbers and saving

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Help on removing comma in numbers and saving

by felix1212 on Wed Sep 13, 2017 3:44 am

Hi, I'm completely new to iMarcos and I'm trying to use it to extract some numbers from a webpage. Somehow I'm making it to work, but since those numbers are formatted with commas, I need to remove them in order to read them to database.

Below code somehow worked to remove those commas, but a new issue of it is that once I save to the csv, iMacros doesn't translate the [EXTRACT] into comma. It just puts something like 123[EXTRACT]456[EXTRACT]789[EXTRACT] exactly into the csv.

Am I using a wrong way to remove commas from extraction? Or I'm missing something in the extraction saving? Struggling about this for days and I couldn't solve. Can experts here help? Thank you very much.

Those prompts are for me to keep track of results. The date adding action is used to add a date for the extraction in which it shouldn't be related to my problems.

Code: Select all
SET !EXTRACT NULL
ADD !EXTRACT {{!NOW:mm/dd/yyyy}}

TAG POS=8 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=16 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=24 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=40 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=32 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=48 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=56 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=64 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")

PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}

SET !EXTRACT {{!VAR1}}

PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}

TAG POS=1 TYPE=A ATTR=TXT:Log<SP>Out

SAVEAS TYPE=EXTRACT FOLDER=\\SERVER\d$\IMPORT\ FILE=result.csv
felix1212
 
Posts: 7
Joined: Wed Sep 13, 2017 3:30 am

Re: Help on removing comma in numbers and saving

by chivracq on Wed Sep 13, 2017 5:56 am

felix1212 wrote:Hi, I'm completely new to iMarcos and I'm trying to use it to extract some numbers from a webpage. Somehow I'm making it to work, but since those numbers are formatted with commas, I need to remove them in order to read them to database.

Below code somehow worked to remove those commas, but a new issue of it is that once I save to the csv, iMacros doesn't translate the [EXTRACT] into comma. It just puts something like 123[EXTRACT]456[EXTRACT]789[EXTRACT] exactly into the csv.

Am I using a wrong way to remove commas from extraction? Or I'm missing something in the extraction saving? Struggling about this for days and I couldn't solve. Can experts here help? Thank you very much.

Those prompts are for me to keep track of results. The date adding action is used to add a date for the extraction in which it shouldn't be related to my problems.

Code: Select all
SET !EXTRACT NULL
ADD !EXTRACT {{!NOW:mm/dd/yyyy}}

TAG POS=8 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=16 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=24 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=40 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=32 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=48 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=56 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=64 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")

PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}

SET !EXTRACT {{!VAR1}}

PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}

TAG POS=1 TYPE=A ATTR=TXT:Log<SP>Out

SAVEAS TYPE=EXTRACT FOLDER=\\SERVER\d$\IMPORT\ FILE=result.csv

CIM...! :mrgreen: (Mention your FCI for me to have a look, read my Sig...)
- (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...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Help on removing comma in numbers and saving

by felix1212 on Wed Sep 13, 2017 9:05 am

Thanks for reply and sorry I missed some important information.

iMarco: V12.0.501.1208
iMarco Browser
OS: Windows Server 2012 R2

chivracq wrote:
felix1212 wrote:Hi, I'm completely new to iMarcos and I'm trying to use it to extract some numbers from a webpage. Somehow I'm making it to work, but since those numbers are formatted with commas, I need to remove them in order to read them to database.

Below code somehow worked to remove those commas, but a new issue of it is that once I save to the csv, iMacros doesn't translate the [EXTRACT] into comma. It just puts something like 123[EXTRACT]456[EXTRACT]789[EXTRACT] exactly into the csv.

Am I using a wrong way to remove commas from extraction? Or I'm missing something in the extraction saving? Struggling about this for days and I couldn't solve. Can experts here help? Thank you very much.

Those prompts are for me to keep track of results. The date adding action is used to add a date for the extraction in which it shouldn't be related to my problems.

Code: Select all
SET !EXTRACT NULL
ADD !EXTRACT {{!NOW:mm/dd/yyyy}}

TAG POS=8 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=16 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=24 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=40 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=32 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=48 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=56 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

TAG POS=64 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
PROMPT {{!EXTRACT}}

SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")
SET !VAR1 EVAL("var s=\"{{!VAR1}}\"; s.replace(\"\\,\", \"\");")

PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}

SET !EXTRACT {{!VAR1}}

PROMPT {{!EXTRACT}}
PROMPT {{!VAR1}}

TAG POS=1 TYPE=A ATTR=TXT:Log<SP>Out

SAVEAS TYPE=EXTRACT FOLDER=\\SERVER\d$\IMPORT\ FILE=result.csv

CIM...! :mrgreen: (Mention your FCI for me to have a look, read my Sig...)
felix1212
 
Posts: 7
Joined: Wed Sep 13, 2017 3:30 am

Re: Help on removing comma in numbers and saving

by chivracq on Wed Sep 13, 2017 11:19 am

felix1212 wrote:Thanks for reply and sorry I missed some important information.

Code: Select all
iMarco: V12.0.501.1208
iMarco Browser
OS: Windows Server 2012 R2

OK for FCI...

Hum, you manage to squeeze 2 Typos each time in "iMacros"... :roll:
If you include so many Typos in Commands in your Script, Runtime Engines are very "stupid" and your Script will never compile...! :idea:

OK, I had a look at your Script, even if you don't post the URL of the Site or what you get in the 'EXTRACT', but first your 8x 'EVAL()' + 'replace()' looks a bit cumbersome. You have the "Global" 'replace()' for that... Hum..., unless you only want to remove the first 8x Commas indeed...

If, like me, you don't like the Syntax for a Global 'replace()' and I understand you want to remove all Commas, then I prefer the following Syntax/Trick instead of your 8x 'EVAL()' + 'replace()':
Code: Select all
SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var z=s.split(',').join(''); z;")
PROMPT Original<SP>EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>VAR1:<BR>_{{!VAR1}}_


I'm a bit surprised as well by your "123[EXTRACT]456[EXTRACT]789[EXTRACT]" in the '.csv' for the 'SAVEAS'...

But iMB v12 has just been released recently, about 2 weeks ago, and the 'EXTRACT' Mechanism has been a bit "revamped" and seems to incorporate already one Bug in the 'EXTRACT' Mechanism from v9.0.3 for FF (about "#EANF#" now being replaced by "NULL", it's possible that that Mechanism is further even buggier, oops...! I don't know, I've never installed iMB... You could try on some other Browwser (FF/CR/IE) if you get the same Results...
(IE might not be conclusive if using iMacros for IE v12 as it will probably use the same Engine... And if using FF, rather use v8.9.7 (than v9.0.3) which still works on FF v55.0.3.)
- (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...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Help on removing comma in numbers and saving

by felix1212 on Wed Sep 13, 2017 7:42 pm

Thanks for your reply! I'm sorry for my typo.

I tried to switch iMB to v10, and also switch to IE10, and results are the same.
felix1212
 
Posts: 7
Joined: Wed Sep 13, 2017 3:30 am

Re: Help on removing comma in numbers and saving

by chivracq on Wed Sep 13, 2017 8:11 pm

felix1212 wrote:Thanks for your reply! I'm sorry for my typo.

I tried to switch iMB to v10, and also switch to IE10, and results are the same.

Well, then I don't know, you would need to post the URL of your Site or upload some 'HTML Saveas' of the Page and/or what you get exactly in the '!EXTRACT' or in each 'EXTRACT'...

What you can do as well is to handle each 'EVAL()' one by one after each 'EXTRACT', store each Result in some Temp Vars and reconstruct the Content of '!EXTRACT' at the end of all Extracts before doing the 'SAVEAS'...
- (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...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Help on removing comma in numbers and saving

by felix1212 on Thu Sep 14, 2017 12:05 am

chivracq wrote:
felix1212 wrote:Thanks for your reply! I'm sorry for my typo.

I tried to switch iMB to v10, and also switch to IE10, and results are the same.

Well, then I don't know, you would need to post the URL of your Site or upload some 'HTML Saveas' of the Page and/or what you get exactly in the '!EXTRACT' or in each 'EXTRACT'...

What you can do as well is to handle each 'EVAL()' one by one after each 'EXTRACT', store each Result in some Temp Vars and reconstruct the Content of '!EXTRACT' at the end of all Extracts before doing the 'SAVEAS'...


The site is an internal web interface of an appliance and I tried to save as complete HTML. I also attached the result csv file as well. Please take a look.

I did try this before as you can see from my code I shared in my question post. Since there was one I don't wanna remove the comma(which is the date field I added at the beginning. If I do so, it will mess up with the first data I'm reading in), I tried to remove all commas for all data and reconstruct the !EXTRACT from setting the !EXTRACT to the !VAR1 I use to hold my correct answer. Still, it shows the exact thing with those [EXTRACTS] in the csv.
Attachments
WebPage.zip
(220.17 KIB) Downloaded 31 times
felix1212
 
Posts: 7
Joined: Wed Sep 13, 2017 3:30 am

Re: Help on removing comma in numbers and saving

by chivracq on Thu Sep 14, 2017 5:48 am

felix1212 wrote:The site is an internal web interface of an appliance and I tried to save as complete HTML. I also attached the result csv file as well. Please take a look.

I did try this before as you can see from my code I shared in my question post. Since there was one I don't wanna remove the comma(which is the date field I added at the beginning. If I do so, it will mess up with the first data I'm reading in), I tried to remove all commas for all data and reconstruct the !EXTRACT from setting the !EXTRACT to the !VAR1 I use to hold my correct answer. Still, it shows the exact thing with those [EXTRACTS] in the csv.

Ah OK, perfect with the '.zip' Attachment, now I understand much better, ah-ah...! :D

And hum, I see indeed those '[EXTRACT]''s in your '.csv' from after "09/08/2017", strange...:
Code: Select all
09/07/2017,52029,70813,10898,6691,6849,122,25,147427
09/08/2017,47165,61253,6840,5949,5517,75,2,126801
09/14/2017[EXTRACT]116945[EXTRACT]24827[EXTRACT]23930[EXTRACT]5241[EXTRACT]7736[EXTRACT]911[EXTRACT]111[EXTRACT]179701


Thanks to the 'HTML Saveas', I was able to do a bit of Testing, and your cumbersome 8x 'replace()' Syntax does the "job" indeed, but OK, I prefer mine, ah-ah...! :twisted:

But if I run your Script, the Data then gets saved "correctly" for me:
Code: Select all
"09/14/2017","115553","24656","23838","5188","7589","894","111","177829"
I'm using iMacros for FF (v8.8.2) which tends to add Double Quotes around the Data...

I improved btw a bit the "Quality" (= Reliability + Readability) of your Script...:
Code: Select all
VERSION BUILD=8820413 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
TAB T=1
'URL GOTO=file:///D:/TEMP/iMacros/Temp/_Forum%20Cases/Felix1212/SEA%20-%20asiampx002%20-%20Volume%20lines%20report%20for%20today.htm

SET !EXTRACT {{!NOW:mm/dd/yyyy}}

'Extract all Totals:
TAG POS=1 TYPE=DIV ATTR=TXT:Legitimate
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Bulk<SP>messages
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Blocked<SP>connections
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Spam<SP>medium
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Spam<SP>high
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Other
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Viruses
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Total
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT

'Clean Data to remove all Commas in the extracted Numbers:
SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var z=s.split(',').join(''); z;")
PROMPT Original<SP>EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>VAR1:<BR>_{{!VAR1}}_

SET !EXTRACT {{!VAR1}}
'SAVEAS TYPE=EXTRACT FOLDER=\\SERVER\d$\IMPORT\ FILE=result.csv
SAVEAS TYPE=EXTRACT FOLDER=* FILE=_Felix1212_EXTRACT_1.csv

'TAG POS=1 TYPE=A ATTR=TXT:Log<SP>Out
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64.)

And this Script gives the same Results of course in the 'SAVEAS'...!

But OK, your Pb is now that the '[EXTRACT]''s do not get converted to Commas for you in your 'SAVEAS' and you can see that it works for me on FF... And it used to work for you as well until 2017/09/08... So, stg must have changed since...!

Well, iMB and iMacros for IE use the Data Separator Setting from the Regional Settings on Windows Environments, so it's possible that you are using some "exotic" Language for your 'Windows Server 2012 R2' OS (some recent Update maybe...?) and/or that that Setting was modified recently.
=> Check that Setting in your Regional Settings.
Try setting it (temporarily) to a Semi-Colon for example, if it's already/still a Comma, run your Script with the Semi-Colon to check that it is taken into account, and reset it then manually to the Comma.

I don't know about iMB v12.0 which is very recent and nobody has reported a similar Issue on the Forum, but if you tested with some previous v10 Versions for iMB and iMacros for IE, that Mechanism works in v10, and it was working for you until recently as well...

I don't know for iMB (that I have never used), but check as well which Language and Character Encoding are being used by your Browser, in case there is some "Incompatibility" to read/convert the Comma from the Regional Settings.

And you could try running your Script on FF or CR of course...
(On FF, you can even use the '!DATASOURCE_DELIMITER' Command to play with that Setting, as iMacros for FF doesn't use the Regional Setting...)

Well, good luck, but you know now that it works on FF, and you know in which "Direction" you can go investigating... :wink:
- (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...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Help on removing comma in numbers and saving

by felix1212 on Thu Sep 14, 2017 8:37 pm

chivracq wrote:
felix1212 wrote:The site is an internal web interface of an appliance and I tried to save as complete HTML. I also attached the result csv file as well. Please take a look.

I did try this before as you can see from my code I shared in my question post. Since there was one I don't wanna remove the comma(which is the date field I added at the beginning. If I do so, it will mess up with the first data I'm reading in), I tried to remove all commas for all data and reconstruct the !EXTRACT from setting the !EXTRACT to the !VAR1 I use to hold my correct answer. Still, it shows the exact thing with those [EXTRACTS] in the csv.

Ah OK, perfect with the '.zip' Attachment, now I understand much better, ah-ah...! :D

And hum, I see indeed those '[EXTRACT]''s in your '.csv' from after "09/08/2017", strange...:
Code: Select all
09/07/2017,52029,70813,10898,6691,6849,122,25,147427
09/08/2017,47165,61253,6840,5949,5517,75,2,126801
09/14/2017[EXTRACT]116945[EXTRACT]24827[EXTRACT]23930[EXTRACT]5241[EXTRACT]7736[EXTRACT]911[EXTRACT]111[EXTRACT]179701


Thanks to the 'HTML Saveas', I was able to do a bit of Testing, and your cumbersome 8x 'replace()' Syntax does the "job" indeed, but OK, I prefer mine, ah-ah...! :twisted:

But if I run your Script, the Data then gets saved "correctly" for me:
Code: Select all
"09/14/2017","115553","24656","23838","5188","7589","894","111","177829"
I'm using iMacros for FF (v8.8.2) which tends to add Double Quotes around the Data...

I improved btw a bit the "Quality" (= Reliability + Readability) of your Script...:
Code: Select all
VERSION BUILD=8820413 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
TAB T=1
'URL GOTO=file:///D:/TEMP/iMacros/Temp/_Forum%20Cases/Felix1212/SEA%20-%20asiampx002%20-%20Volume%20lines%20report%20for%20today.htm

SET !EXTRACT {{!NOW:mm/dd/yyyy}}

'Extract all Totals:
TAG POS=1 TYPE=DIV ATTR=TXT:Legitimate
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Bulk<SP>messages
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Blocked<SP>connections
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Spam<SP>medium
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Spam<SP>high
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Other
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Viruses
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT
'>
TAG POS=1 TYPE=DIV ATTR=TXT:Total
TAG POS=R7 TYPE=DIV ATTR=CLASS:ellipsis EXTRACT=TXT

'Clean Data to remove all Commas in the extracted Numbers:
SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var z=s.split(',').join(''); z;")
PROMPT Original<SP>EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>VAR1:<BR>_{{!VAR1}}_

SET !EXTRACT {{!VAR1}}
'SAVEAS TYPE=EXTRACT FOLDER=\\SERVER\d$\IMPORT\ FILE=result.csv
SAVEAS TYPE=EXTRACT FOLDER=* FILE=_Felix1212_EXTRACT_1.csv

'TAG POS=1 TYPE=A ATTR=TXT:Log<SP>Out
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64.)

And this Script gives the same Results of course in the 'SAVEAS'...!

But OK, your Pb is now that the '[EXTRACT]''s do not get converted to Commas for you in your 'SAVEAS' and you can see that it works for me on FF... And it used to work for you as well until 2017/09/08... So, stg must have changed since...!

Well, iMB and iMacros for IE use the Data Separator Setting from the Regional Settings on Windows Environments, so it's possible that you are using some "exotic" Language for your 'Windows Server 2012 R2' OS (some recent Update maybe...?) and/or that that Setting was modified recently.
=> Check that Setting in your Regional Settings.
Try setting it (temporarily) to a Semi-Colon for example, if it's already/still a Comma, run your Script with the Semi-Colon to check that it is taken into account, and reset it then manually to the Comma.

I don't know about iMB v12.0 which is very recent and nobody has reported a similar Issue on the Forum, but if you tested with some previous v10 Versions for iMB and iMacros for IE, that Mechanism works in v10, and it was working for you until recently as well...

I don't know for iMB (that I have never used), but check as well which Language and Character Encoding are being used by your Browser, in case there is some "Incompatibility" to read/convert the Comma from the Regional Settings.

And you could try running your Script on FF or CR of course...
(On FF, you can even use the '!DATASOURCE_DELIMITER' Command to play with that Setting, as iMacros for FF doesn't use the Regional Setting...)

Well, good luck, but you know now that it works on FF, and you know in which "Direction" you can go investigating... :wink:


Really thanks a lot for your help!! Just installed Firefox add-ons and gave a try. It really worked on FF! I checked the List Separator setting in Region and Language option, and it's just a comma. Anyway, It seems like IE won't work as iMB emulates IE. I will try to figure out.

However, if I wanna schedule the .iim in Task Scheduler so that it will run and extract data automatically for now, how can I make it so that it will use FF? It's now always using iMB by default. I couldn't find an option to control it. RECORER = FX seems not doing the job.
felix1212
 
Posts: 7
Joined: Wed Sep 13, 2017 3:30 am

Re: Help on removing comma in numbers and saving

by felix1212 on Fri Sep 15, 2017 1:02 am

Okay. I found a way to launch via imacros://run/?m="My iim files". However, I'm encountering another issue. Have anyone met this problem before?

https://stackoverflow.com/questions/44810571/firefox-wont-play-imacros-via-url

Firefox can open imacros link successfully on my workstation (win7) but not on the scripting server which is a Windows Server 2012 R2. Does anyone have any idea? Thanks a lot.
felix1212
 
Posts: 7
Joined: Wed Sep 13, 2017 3:30 am

Re: Help on removing comma in numbers and saving

by chivracq on Fri Sep 15, 2017 8:37 am

felix1212 wrote:Really thanks a lot for your help!! Just installed Firefox add-ons and gave a try. It really worked on FF! I checked the List Separator setting in Region and Language option, and it's just a comma. Anyway, It seems like IE won't work as iMB emulates IE. I will try to figure out.

However, if I wanna schedule the .iim in Task Scheduler so that it will run and extract data automatically for now, how can I make it so that it will use FF? It's now always using iMB by default. I couldn't find an option to control it. RECORER = FX seems not doing the job.

I never understand why usually only Russians and Asians always think it sounds "cool" to "wanna-wanna"/"gonna-gonna" pretend they speak "Chicago-Street-Kids-Gangsta" Language...!? :roll:

But OK, about the Comma in 'Regional Settings', that's why I told you even if it was already set as a Comma to temporarily change it to stg else like a Semi-Colon to test if it was taken into account... If your OS and/or your Browser are/is in Chinese, it's possible that iMacros cannot locate/access/recognize the "current" Comma...
(I've already had a few Cases on the Forum where Users had posted (.iim) Scripts with 'EVAL()' Statements typed in some Cyrillic or Asian OS and I needed to retype the Commas/Semi-Colons/Single/Double Quotes to be able to run their Script...)

felix1212 wrote:Okay. I found a way to launch via imacros://run/?m="My iim files". However, I'm encountering another issue. Have anyone met this problem before?

https://stackoverflow.com/questions/44810571/firefox-wont-play-imacros-via-url

Firefox can open imacros link successfully on my workstation (win7) but not on the scripting server which is a Windows Server 2012 R2. Does anyone have any idea? Thanks a lot.

Ah-ah...!, funny Thread on SOF, but the "Solution" "found" by the User (reinstalling Windows...!?) was a bit drastic, ah-ah...! :shock:

But yep, launching a Script automatically from the OS Task Scheduler is indeed using the 'imacros://run/?m=' Syntax from a '.BAT' File or a Browser Shortcut, which like documented in the Release Notes 'Known Issues' for v9.0.3 for FF (which is probably the Version you installed on FF (not mentioned in your previous Posts)) doesn't work anymore in this Version:

The Workaround is simply to revert to v8.9.7 (which still works on FF v55.0.3 which is the current (Septb 2017) FF Version.

And yep, the 'VERSION'/'RECORDER' Command has no real "Function" other than "Indicative" about in which Version a Script was created...

Search my Posts on ".BAT / Batch Files Scheduler" if you need some Examples on how to use iMacros on FF from the OS Task Scheduler, you have several Threads on the Forum about that and I think I have participated in probably all of them... And we didn't get any new Threads on the Forum about this Functionality since a long time already (except about 'imacros://run/?m=' being broken in v9.0.3 about 1 year ago already), so I guess the Content of those Threads must be "good" enough for Users searching the Forum...
Last edited by chivracq on Mon Sep 18, 2017 6:52 am, edited 1 time in total.
- (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...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Help on removing comma in numbers and saving

by felix1212 on Sun Sep 17, 2017 7:55 pm

chivracq wrote:
felix1212 wrote:Really thanks a lot for your help!! Just installed Firefox add-ons and gave a try. It really worked on FF! I checked the List Separator setting in Region and Language option, and it's just a comma. Anyway, It seems like IE won't work as iMB emulates IE. I will try to figure out.

However, if I wanna schedule the .iim in Task Scheduler so that it will run and extract data automatically for now, how can I make it so that it will use FF? It's now always using iMB by default. I couldn't find an option to control it. RECORER = FX seems not doing the job.

I never understand why usually only Russians and Asians always think it sounds "cool" to "wanna-wanna"/"gonna-gonna" pretend they speak "Chicago-Street-Kids-Gangsta" Language...!? :roll:

But OK, about the Comma in 'Regional Settings', that's why I told you even if it was already set as a Comma to temporarily change it to stg else like a Semi-Colon to test if it was taken into account... If your OS and/or your Browser are/is in Chinese, it's possible that iMacros cannot locate/access/recognize the "current" Comma...
(I've already had a few Cases on the Forum where Users had posted (.iim) Scripts with 'EVAL()' Statements typed in some Cyrillic or Asian OS and I needed to retype the Commas/Semi-Colons/Single/Double Quotes to be able to run their Script...)

felix1212 wrote:Okay. I found a way to launch via imacros://run/?m="My iim files". However, I'm encountering another issue. Have anyone met this problem before?

https://stackoverflow.com/questions/44810571/firefox-wont-play-imacros-via-url

Firefox can open imacros link successfully on my workstation (win7) but not on the scripting server which is a Windows Server 2012 R2. Does anyone have any idea? Thanks a lot.

Ah-ah...!, funny Thread on SOF, but the "Solution" "found" by the User (reinstalling Windows...!?) was a bit drastic, ah-ah...! :shock:

But yep, launching a Script automatically from the OS Task Scheduler is indeed using the 'imacros://run/?m=' Syntax from a '.BAT' File or a Browser Shortcut, which like documented in the Release Notes 'Known Issues' for v9.0.3 for FF (which is probably the Version you installed on FF (not mentioned in your previous Posts)) doesn't work anymore in this Version:

The Workaround is simply to revert to v8.9.7 (which still works on FF v55.0.3 which is the current (Septb 2017) FF Version.

Ad yep, the 'VERSION'/'RECORDER' Command has no real "Function" other than "Indicative" about in which Version a Script was created...

Search my Posts on ".BAT / Batch Files Scheduler" if you need some Examples on how to use iMacros on FF from the OS Task Scheduler, you have several Threads on the Forum about that and I think I have participated in probably all of them... And we didn't get any new Threads on the Forum about this Functionality since a long time already (except about 'imacros://run/?m=' being broken in v9.0.3 about 1 year ago already), so I guess the Content of those Threads must be "good" enough for Users searching the Forum...


Thanks for reply!

I do not mean to use any "Chicago-Street-Kids-Gangsta" Language or even pretend to speak. I guess I do not need to. English is not my first language but it's just I typed fast and just typed what I was thinking with verifying(That is why you said I managed to have 2 typos in one reply). If that offends you, I am sorry about that.

And yes, I tried to change the Regional Settings on my Windows Server once you suggested last week, and that did not change anything. In fact, all workstations and servers are in English and without any language pack installed.

For the firefox add-ons issue, 8.9.7 was only allowed to install on versions up to 49.*.
felix1212
 
Posts: 7
Joined: Wed Sep 13, 2017 3:30 am

Re: Help on removing comma in numbers and saving

by chivracq on Mon Sep 18, 2017 7:17 am

felix1212 wrote:Thanks for reply!

I do not mean to use any "Chicago-Street-Kids-Gangsta" Language or even pretend to speak. I guess I do not need to. English is not my first language but it's just I typed fast and just typed what I was thinking with verifying(That is why you said I managed to have 2 typos in one reply). If that offends you, I am sorry about that.

And yes, I tried to change the Regional Settings on my Windows Server once you suggested last week, and that did not change anything. In fact, all workstations and servers are in English and without any language pack installed.

For the firefox add-ons issue, 8.9.7 was only allowed to install on versions up to 49.*.

Hum, OK, if your OS is in English, then that clears some "area" for possible Explanation, good...!
But hum, 'Windows Server 2012 R2' is not a "typical" End-User OS running on a Desktop or Laptop for a User to run some iMacros Scripts in their Browser for Web-Automation, so it's possible that this OS was never tested by the iMacros Dev-Team and that it behaves a bit differently than the other Windows (Win7/Win10) "Flavours" concerning Regional Settings..., especially if changing that Setting to a Semi-Colon for example was not taken into account...

But hum, strange that this "new" Behaviour only started recently... Stg must have changed recently, if it was working before..., you didn't get any 'Windows Server 2012 R2' Update recently...?

And well, easy Workaround (for the time being, as if the Pb comes from the OS, it might get fixed in some next OS Update), would simply be to handle yourself the "[EXTRACT]" => "," Conversion in '!EXTRACT' with a Global 'replace()' with 'EVAL()' before doing the 'SAVEAS'... :idea:

iMacros for FF v8.9.7 still works until FF v55.0.3 currently, I run it myself...!! (+ Win10-x64), even if the Mozilla Add-ons Gallery "pretends" it's "not compatible with your FF Version", you first need to download the Add-on locally (from the Mozilla Add-ons Gallery or from the iMacros 'iMacros for FF Version History' Wiki-Page) and to drag it onto the FF Add-on Manager Tab. (And disable automatic Updates for iMacros of course...!)
- (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...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 6 guests

-->