trim() not working

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
Bassoo7
Posts: 5
Joined: Tue May 30, 2017 7:22 pm

trim() not working

Post by Bassoo7 » Tue Jun 13, 2017 9:22 pm

FCI: (Added by Mod from User's Sig.)
My Config: iMacros Browser 11.5 DESKTOP; Windows 7

>>>

I'm extracting data that contains spaces, and so I use the trim() function to removes the spaces.

But It doesn't work!

Here's a sample code :

Code: Select all

VERSION BUILD=11.5.499.3066
TAB T=1
TAB CLOSEALLOTHERS

SET !VAR0 <SP><SP><SP><SP><SP><SP>Hi<SP>
SET someVar EVAL("var some='{{!VAR0}}'.trim(); some;")
PROMPT {{someVar}}
The code above should work normally but it returns this error :
Error -1250: JScript statement in EVAL contains the following error: Objects of type 'System.String' do not have such a member. Line 6: SET someVar EVAL("var some='{{!VAR0}}'.trim(); some;")

JavaScript does have trim() function and it works on IE and all browsers!

UPDATE : Apparently It works on FireFox Add-on but not on the iMacros Desktop Browser. Why doesn't it work on the iMacros Browser, which is supposed to be superior than the free add-ons ?!!
Last edited by chivracq on Fri Dec 02, 2022 9:18 am, edited 1 time in total.
Reason: FCI added by Mod from User's Sig.
MY Config: iMacros Browser 11.5 DESKTOP; Windows 7
chivracq
Posts: 10238
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: trim() not working

Post by chivracq » Wed Jan 11, 2023 3:20 pm

Bassoo7 wrote:
Tue Jun 13, 2017 9:22 pm
FCI: (Added by Mod from User's Sig.)
My Config:

Code: Select all

iMacros Browser 11.5 DESKTOP; Windows 7
>>>

I'm extracting data that contains spaces, and so I use the trim() function to removes the spaces.

But It doesn't work!

Here's a sample code :

Code: Select all

VERSION BUILD=11.5.499.3066
TAB T=1
TAB CLOSEALLOTHERS

SET !VAR0 <SP><SP><SP><SP><SP><SP>Hi<SP>
SET someVar EVAL("var some='{{!VAR0}}'.trim(); some;")
PROMPT {{someVar}}
The code above should work normally but it returns this error :
Error -1250: JScript statement in EVAL contains the following error: Objects of type 'System.String' do not have such a member. Line 6: SET someVar EVAL("var some='{{!VAR0}}'.trim(); some;")

JavaScript does have trim() function and it works on IE and all browsers!

UPDATE : Apparently It works on FireFox Add-on but not on the iMacros Desktop Browser. Why doesn't it work on the iMacros Browser, which is supposed to be superior than the free add-ons ?!!

"Late" Reply, about 5 years later, "thanks" to some fake User/Spammer who happened to simply copy and paste this current Thread to appear to open some "legit" Thread to get access to the Forum :shock: , ... and to which @TechSup posted a Reply, ... that actually belongs in this current Thread: 8)
Tom, Tech Support wrote:
Wed Jan 11, 2023 1:43 pm
Support for the trim() function is dependent on the version of the Javascript engine in use. It looks like you recorded your macro with an older version of the iMacros browser, and hence trim() is not available. However, you can use the replace() function with a regular expression to achieve the same result. An example is provided under the Manipulate extraction section on the EVAL command reference page.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- 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: 10238
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: trim() not working

Post by chivracq » Wed Jan 11, 2023 3:24 pm

Bassoo7 wrote:
Tue Jun 13, 2017 9:22 pm
FCI: (Added by Mod from User's Sig.)
My Config:

Code: Select all

iMacros Browser 11.5 DESKTOP; Windows 7
>>>

I'm extracting data that contains spaces, and so I use the trim() function to removes the spaces.

But It doesn't work!

Here's a sample code :

Code: Select all

VERSION BUILD=11.5.499.3066
TAB T=1
TAB CLOSEALLOTHERS

SET !VAR0 <SP><SP><SP><SP><SP><SP>Hi<SP>
SET someVar EVAL("var some='{{!VAR0}}'.trim(); some;")
PROMPT {{someVar}}
The code above should work normally but it returns this error :
Error -1250: JScript statement in EVAL contains the following error: Objects of type 'System.String' do not have such a member. Line 6: SET someVar EVAL("var some='{{!VAR0}}'.trim(); some;")

JavaScript does have trim() function and it works on IE and all browsers!

UPDATE : Apparently It works on FireFox Add-on but not on the iMacros Desktop Browser. Why doesn't it work on the iMacros Browser, which is supposed to be superior than the free add-ons ?!!

"Late" Reply, about 5 years later, "thanks" to some fake User/Spammer who happened to simply copy and paste this current Thread to appear to open some "legit" Thread to get access to the Forum :shock: , ... and to which @TechSup posted a Reply, ... that actually belongs in this current Thread: 8)
I asked @TechSup to maybe move their Reply to this current Thread, but here is a Quote already...:
Tom, Tech Support wrote:
Wed Jan 11, 2023 1:43 pm
Re: How to trim whitespace with EVAL

Support for the trim() function is dependent on the version of the Javascript engine in use. It looks like you recorded your macro with an older version of the iMacros browser, and hence trim() is not available. However, you can use the replace() function with a regular expression to achieve the same result. An example is provided under the Manipulate extraction section on the EVAL command reference page.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- 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