delete the last character in the variable

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
pepsister
Posts: 4
Joined: Thu Apr 25, 2013 2:47 pm

delete the last character in the variable

Post by pepsister » Thu Apr 25, 2013 2:54 pm

Hello,

I have a table with a gross amount with the sigle '€'.
I set the price in the VAR1, but it saves the sigle '€'. How to delete the last character?
I would like to do an operation with the price.
For example,
TAG POS=1 TYPE=TD ATTR=TXT:FR0000045072 EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=R1 TYPE=TD ATTR=TXT:*€ EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}
SET !EXTRACT NULL
ADD !VAR2 -0.01 => it's not possible because VAR2= 5.5€, i would like to have VAR2=5.5

Thanks for your help,
MeeSush
Posts: 19
Joined: Sat Jan 26, 2013 9:08 am

Re: delete the last character in the variable

Post by MeeSush » Thu Apr 25, 2013 7:42 pm

I think its ONly possible with Js
with substring
pepsister
Posts: 4
Joined: Thu Apr 25, 2013 2:47 pm

Re: delete the last character in the variable

Post by pepsister » Fri Apr 26, 2013 6:56 am

Is it possible to use javascript with imacros?
So, i must to add:
VAR3 = VAR2.substring (0,VAR2.length-1) ???
is it OK?
pepsister
Posts: 4
Joined: Thu Apr 25, 2013 2:47 pm

Re: delete the last character in the variable

Post by pepsister » Fri Apr 26, 2013 7:27 am

ok i add a file .js with:
var rechercher = iimPlay("essai1.iim")
var VAR3 = VAR2.substring (0,VAR2.length-1) + 1

But, when i open imacros in firefox, i select macro.js and click on the button "play" but none !!!
I think, it doesn't go to the file 'essai1.iim' but while?
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: delete the last character in the variable

Post by Tom, Tech Support » Fri Apr 26, 2013 10:34 am

Hi pepsister,

You can use the EVAL command within your macro (.iim) code to evaluate Javascript statements for parsing data. The reference page has several examples.
Regards,

Tom, iMacros Support
pepsister
Posts: 4
Joined: Thu Apr 25, 2013 2:47 pm

Re: delete the last character in the variable

Post by pepsister » Mon May 06, 2013 3:32 pm

thank you very much, it's ok now.
But i have a question again!
I would like to do several extract in the same macro, for example:

TAG POS=1 TYPE=TD ATTR=TXT:*€ EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:gbqf ATTR=ID:gbqfq CONTENT={{!VAR1}}
...
TAG POS=1 TYPE=TD ATTR=TXT:*€ EXTRACT=TXT [EXTRACT]
SET !VAR2 {{!EXTRACT}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:gbqf ATTR=ID:gbqfq CONTENT={{!VAR2}}

the popup after my SET !VAR1 line is: VAR1= 43,770 €
the popup after my SET !VAR2 line is: VAR2=67,530 €
but CONTENT={{!VAR2}} contains: 43,770 €[EXTRACT]67,530 €
I would like : CONTENT =67.530 € only.

Have you any ideas?
User avatar
bobis
Posts: 364
Joined: Sat Sep 11, 2010 3:34 pm
Contact:

Re: delete the last character in the variable

Post by bobis » Mon May 06, 2013 7:49 pm

pepsister wrote:thank you very much, it's ok now.
But i have a question again!
I would like to do several extract in the same macro, for example:

TAG POS=1 TYPE=TD ATTR=TXT:*€ EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:gbqf ATTR=ID:gbqfq CONTENT={{!VAR1}}
...
TAG POS=1 TYPE=TD ATTR=TXT:*€ EXTRACT=TXT [EXTRACT]
SET !VAR2 {{!EXTRACT}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:gbqf ATTR=ID:gbqfq CONTENT={{!VAR2}}

the popup after my SET !VAR1 line is: VAR1= 43,770 €
the popup after my SET !VAR2 line is: VAR2=67,530 €
but CONTENT={{!VAR2}} contains: 43,770 €[EXTRACT]67,530 €
I would like : CONTENT =67.530 € only.

Have you any ideas?
use

Code: Select all

set !extract null
after each extraction
Get Best iMacros scripts at http://imacrosbot.com/
Post Reply