iimGetExtract vrs iimGetLastExtract: NOT the same!

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
additional001
Posts: 175
Joined: Sun Jul 06, 2008 3:24 am

iimGetExtract vrs iimGetLastExtract: NOT the same!

Post by additional001 » Thu Nov 20, 2014 7:21 pm

Kickin' it with old school code using iimGetLastExtract

Code: Select all

var SBHome
var SBLogin
var SBLoginChk1
var SBLoginChk2
var nL="\n"
var i

SBHome = "CODE:"
SBHome = SBHome+"SET !ERRORIGNORE YES" + nL
SBHome = SBHome+"SET !TIMEOUT_PAGE 30" +nL
SBHome = SBHome+"TAB T=1" + nL
SBHome = SBHome+"TAB CLOSEALLOTHERS" + nL
SBHome = SBHome+"URL GOTO=http://www.swagbucks.com/p/login" + nL
iimDisplay("We need to close ALL tabs now.")
iimPlay(SBHome)

SBLogin = "CODE:"
SBLogin = SBLogin+"TAG POS=1 TYPE=A ATTR=HREF:/p/login&&ID:sbGlobalNavLoginBtn EXTRACT=HREF" + nL
SBLogin = SBLogin+"TAG POS=1 TYPE=A ATTR=HREF:/?gw=1&&CLASS:wndFooter EXTRACT=HREF" + nL
iimPlay(SBLogin)

SBLoginChk1 = iimGetLastExtract(1)
SBLoginChk2 = iimGetLastExtract(2)

iimDisplay(SBLoginChk2)
You can toggle the SBLoginChk2 to SBLoginChk1 and get the expected results from the extractions.
1 should yield #EANF# and 2 should yield http://www.swagbucks.com/?gw=1

With iimGetLastExtract we get expected results and correct extraction. However we have been instructed by the wiki see here http://wiki.imacros.net/iimGetLastExtract%28%29 to use iimGetExtract because iimGetLastExtract is depreciated.

New code....

Code: Select all

var SBHome
var SBLogin
var SBLoginChk1
var SBLoginChk2
var nL="\n"
var i

SBHome = "CODE:"
SBHome = SBHome+"SET !ERRORIGNORE YES" + nL
SBHome = SBHome+"SET !TIMEOUT_PAGE 30" +nL
SBHome = SBHome+"TAB T=1" + nL
SBHome = SBHome+"TAB CLOSEALLOTHERS" + nL
SBHome = SBHome+"URL GOTO=http://www.swagbucks.com/p/login" + nL
iimDisplay("We need to close ALL tabs now.")
iimPlay(SBHome)

SBLogin = "CODE:"
SBLogin = SBLogin+"TAG POS=1 TYPE=A ATTR=HREF:/p/login&&ID:sbGlobalNavLoginBtn EXTRACT=HREF" + nL
SBLogin = SBLogin+"TAG POS=1 TYPE=A ATTR=HREF:/?gw=1&&CLASS:wndFooter EXTRACT=HREF" + nL
iimPlay(SBLogin)

SBLoginChk1 = iimGetExtract(1)
SBLoginChk2 = iimGetExtract(2)

iimDisplay(SBLoginChk1)
SBLoginChk1 yields #EANF#[EXTRACT]http://www.swagbucks.com/?gw=1
SBLoginChk2 yields #EANF#[EXTRACT]http://www.swagbucks.com/?gw=1

It's like it mushes them together every time into one variable. This is unexpected and undesired behavior. Is this a bug?

Windows 8.1 Enterprise
Firefox 33.0
iMacros FF Plugin 8.8.7
Java(TM) Platform SE 8 U25 Version: 11.25.2.18
Tom, Tech Support
Posts: 3522
Joined: Mon May 31, 2010 4:59 pm

Re: iimGetExtract vrs iimGetLastExtract: NOT the same!

Post by Tom, Tech Support » Fri Dec 12, 2014 1:28 pm

Hi additional001,

Great bug report! Sorry I missed this earlier (and thanks to chivracq for pointing it out on this post!).

So what's happening with iimGetExtract is that it is ignoring the parameter value that is passed in and instead always acting as if you are calling iimGetExtract() or iimGetExtract(0), which returns all the results as a single string with each value delimited by [EXTRACT].

Thank you for taking the time to report this here and bringing it to our attention. I have logged this issue for further investigation by our development team.
Regards,

Tom, iMacros Support
additional001
Posts: 175
Joined: Sun Jul 06, 2008 3:24 am

Re: iimGetExtract vrs iimGetLastExtract: NOT the same!

Post by additional001 » Wed Dec 17, 2014 12:43 pm

Apologies for the long reply TS Tom (a touch of the flu), Thanks for the kudos. Just doing my part for the community. :D

My thanks to chivracq as well for pointing the cross thread point to get the issue noticed. Good looking out! :D
chivracq
Posts: 8703
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: iimGetExtract vrs iimGetLastExtract: NOT the same!

Post by chivracq » Sun Feb 08, 2015 6:24 pm

Another User reporting the same Problem (probably on iMacros for FF v8.8.8, FF35 (CIM...! :mrgreen: )), with simpler Scripts to demonstrate and reproduce the Problem, in this Post:
- Re: Feature Requests & Bug Fix Requests. ADD YOURS!]Re: Feature Requests & Bug Fix Requests. ADD YOURS!
InfSub wrote:#Current.iim

Code: Select all

SET !EXTRACT "first stroke"
ADD !EXTRACT "second stroke"
test_1.js

Code: Select all

iimPlay("#Current.iim")
alert( iimGetLastExtract(1) +"\n"+ iimGetLastExtract(2) );
result:
first stroke
second stroke
It's OK!

test_2.js

Code: Select all

iimPlay("#Current.iim")
alert( iimGetExtract(1) +"\n"+ iimGetExtract(2) );
result:
first stroke[EXTRACT]second stroke
first stroke[EXTRACT]second stroke
Why? Is it bug?

and another test:
test_3.js

Code: Select all

iimPlay("#Current.iim")
alert ( iimGetLastExtract('any') +"\n"+ iimGetExtract('any') );
result:
#nodata#
first stroke[EXTRACT]second stroke
- (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