I will pay $20 to the first one who can help me (EVAL)"US$"

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
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
Roto
Posts: 5
Joined: Sat Jan 18, 2014 12:14 am

I will pay $20 to the first one who can help me (EVAL)"US$"

Post by Roto » Sat Jan 18, 2014 12:55 pm

this is the code:

Code: Select all

VERSION BUILD=8601111 RECORDER=FX
TAB T=1
TAB T=2
SET !EXTRACT_TEST_POPUP NO
TAG POS=7 TYPE=TD ATTR=TXT:* EXTRACT=TXT 
SET !CLIPBOARD {{!EXTRACT}}
TAB T=1
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=ID:elm_price_price CONTENT={{!CLIPBOARD}}
TAG POS=1 TYPE=A ATTR=TXT:Quantity<SP>discounts
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:product_data[prices][1][price] CONTENT={{!CLIPBOARD}}
SET !EXTRACT NULL
This code copy and paste a price of a td to one input. the result is (for example) US$ 1.25
So, I need remove the "US$ "

Seems that some code EVAL do this, but I know know how. I'll give you $20 by pp to the first who can help me with this.
thanks.
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: I will pay $20 to the first one who can help me (EVAL)"U

Post by chivracq » Sun Jan 19, 2014 11:45 pm

Hum, 20$ (sorry, I mean "US$ 20"...!) is a nice incentive...!

Depending on how the <Space> will be taken in the Extract, one of those 2 should work, check on the Prompt to decide... (Both work for me but I have to hard-code the Content of !EXTRACT...)

(I cannot find a single Web-Site on Internet with Prices in $ with a space inbetween, give the URL of your Site if you want me to test for a 100% good Answer otherwise...)

Code: Select all

SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$ \",\"\"); ")
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$<SP>\",\"\"); ")
PROMPT !EXTRACT={{!EXTRACT}}<br>!VAR1={{!VAR1}}<br>!VAR2={{!VAR2}}
So I guess I now need to open a PayPal Account...! Nice feeling btw...!
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Roto
Posts: 5
Joined: Sat Jan 18, 2014 12:14 am

Re: I will pay $20 to the first one who can help me (EVAL)"U

Post by Roto » Wed Jan 22, 2014 8:04 am

hi chivracq! thanks for your reply.
I'm still stuck with this issue.
Image
maybe I'm doing something wrong. here a link with the example:
http://www.focalprice.com/IP3897X/3D_Sn ... e_55S.html
this is the table:
Image
thanks again.
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: I will pay $20 to the first one who can help me (EVAL)"U

Post by chivracq » Wed Jan 22, 2014 8:16 am

Roto wrote:hi chivracq! thanks for your reply.
I'm still stuck with this issue.
Image
maybe I'm doing something wrong. [s]I will send you a pm with the link.[/s]
thanks again.
Yes, I need a Link to a Web-Page where I can find a (similar) HTML Field to extract it myself and play with the raw Data... Text is formatted on a Forum...

Not sure we can send PM's on this Forum, but you can send me a Mail @:
'[My_Pseudo_on_this_Forum]@gmail.com'
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: I will pay $20 to the first one who can help me (EVAL)"U

Post by chivracq » Wed Jan 22, 2014 8:20 am

Roto wrote:hi chivracq! thanks for your reply.
I'm still stuck with this issue.
Image
maybe I'm doing something wrong. here a link with the example:
http://www.focalprice.com/IP3897X/3D_Sn ... e_55S.html
this is the table:
Image
thanks again.
OK, got it, now I can test...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Roto
Posts: 5
Joined: Sat Jan 18, 2014 12:14 am

Re: I will pay $20 to the first one who can help me (EVAL)"U

Post by Roto » Wed Jan 22, 2014 8:21 am

I've edited the post with the information indeed can not send private messages here. thanks again.
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: I will pay $20 to the first one who can help me (EVAL)"U

Post by chivracq » Wed Jan 22, 2014 12:14 pm

OK, then, from the Code I gave you, you can see with the PROMPT that !VAR1 is the Solution:

Code: Select all

VERSION BUILD=8601111 RECORDER=FX
TAB T=1
URL GOTO=http://www.focalprice.com/IP3897X/3D_Snowy_Wolf_Print_Plastic_Protective_Case_for_iPhone_55S.html
'TAG POS=1 TYPE=H1 ATTR=ID:productName
'TAG POS=1 TYPE=DIV ATTR=TXT:Buy<SP>more,<SP>save<SP>more
'TAG POS=1 TYPE=TD ATTR=TXT:Quantity
'TAG POS=1 TYPE=TD ATTR=TXT:Price<SP>/Unit
'TAG POS=1 TYPE=TD ATTR=TXT:3+<SP>units
'TAG POS=1 TYPE=TD ATTR=TXT:5+<SP>units
'TAG POS=1 TYPE=TD ATTR=TXT:10+<SP>units
'TAG POS=1 TYPE=SPAN ATTR=TXT:US$<SP>1.62
'TAG POS=1 TYPE=SPAN ATTR=TXT:US$<SP>1.49
'TAG POS=1 TYPE=SPAN ATTR=TXT:US$<SP>1.38
'TAG POS=1 TYPE=DIV ATTR=ID:summary

TAG POS=1 TYPE=TD ATTR=TXT:Price<SP>/Unit
TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$ \",\"\"); ")
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$<SP>\",\"\"); ")
PROMPT !EXTRACT={{!EXTRACT}}<br>!VAR1={{!VAR1}}<br>!VAR2={{!VAR2}}
... Which gives for your Macro if you want to only extract the first Price:

Code: Select all

VERSION BUILD=8601111 RECORDER=FX
TAB T=1
SET !EXTRACT_TEST_POPUP NO
URL GOTO=http://www.focalprice.com/IP3897X/3D_Snowy_Wolf_Print_Plastic_Protective_Case_for_iPhone_55S.html

TAG POS=1 TYPE=TD ATTR=TXT:Price<SP>/Unit
TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$ \",\"\"); ")
SET !EXTRACT {{!VAR1}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Price.csv 
And if you want to extract all the Prices:

Code: Select all

VERSION BUILD=8601111 RECORDER=FX
TAB T=1
SET !EXTRACT_TEST_POPUP NO
URL GOTO=http://www.focalprice.com/IP3897X/3D_Snowy_Wolf_Print_Plastic_Protective_Case_for_iPhone_55S.html

'1st Price:
TAG POS=1 TYPE=TD ATTR=TXT:Price<SP>/Unit
TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$ \",\"\"); ")
SET !EXTRACT {{!VAR1}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Prices.csv

'2nd Price:
TAG POS=1 TYPE=TD ATTR=TXT:Price<SP>/Unit
TAG POS=R2 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$ \",\"\"); ")
SET !EXTRACT {{!VAR1}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Prices.csv

'3rd Price:
TAG POS=1 TYPE=TD ATTR=TXT:Price<SP>/Unit
TAG POS=R3 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$ \",\"\"); ")
SET !EXTRACT {{!VAR1}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Prices.csv
 
The Files Price.csv and Prices.csv are saved in your 'iMacros\Downloads' Directory...

But you could use 3 different Variables instead of 3 times !VAR1 if you want to do something else with the Values later on in your Script...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Roto
Posts: 5
Joined: Sat Jan 18, 2014 12:14 am

Re: I will pay $20 to the first one who can help me (EVAL)"U

Post by Roto » Tue Jan 28, 2014 5:14 am

thanks for your reply, but, is impossible extract only the number in the clipboard? I just need to copy the number in the clipboard.
example:

Code: Select all

extracted text: 1.62
it's possible?
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: I will pay $20 to the first one who can help me (EVAL)"U

Post by chivracq » Tue Jan 28, 2014 8:16 am

Roto wrote:thanks for your reply, but, is impossible extract only the number in the clipboard? I just need to copy the number in the clipboard.
example:

Code: Select all

extracted text: 1.62
it's possible?
Yes of course. Once you've got the "1.62" Value in !VAR1, you do what you want with it. I thought that you wanted to save it in a .CSV File, but if you want to reuse it later in your Script:
(You don't even need to use the !CLIPBOARD, you can use !VAR1 directly.)

Code: Select all

VERSION BUILD=8601111 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
TAB T=1
'...

TAB T=2
'URL GOTO=http://www.focalprice.com/IP3897X/3D_Snowy_Wolf_Print_Plastic_Protective_Case_for_iPhone_55S.html
'TAG POS=7 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAG POS=1 TYPE=TD ATTR=TXT:Price<SP>/Unit
TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\"; s.replace(\"US$ \",\"\"); ")
'Uncomment next Line if you want to check the Values:
'PROMPT !EXTRACT:<SP>{{!EXTRACT}}<br>!VAR!:<SP>{{!VAR1}}
'SET !CLIPBOARD {{!VAR1}}

TAB T=1
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=ID:elm_price_price CONTENT={{!VAR1}}
TAG POS=1 TYPE=A ATTR=TXT:Quantity<SP>discounts
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:product_data[prices][1][price] CONTENT={{!VAR1}}
SET !EXTRACT NULL
Notice that I prefer to use

Code: Select all

TAG POS=1 TYPE=TD ATTR=TXT:Price<SP>/Unit
TAG POS=R1 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT
instead of your

Code: Select all

TAG POS=7 TYPE=TD ATTR=TXT:* EXTRACT=TXT
with "POS=R1" for the 1st Price, "POS=R2" for the 2nd Price and "POS=R3" for the 3rd Price using Relative Positioning, which is safer than your "POS=7" because as soon as they change something on the Page, your "POS=7" will get another Number than 7 and you'll need quite some time to find out which Number exactly...

EDIT:
I've added a 'PROMPT' Command for you to comment out if you want to check the Values of !EXTRACT and !VAR1 after the EVAL Manipulation.

And if you were serious about the $20, I already give you my Contact Details, I think you'll be using PayPal and all you need is an E-mail Address:
[My_Pseudo_on_this_Forum] @ gmail.com
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply