Can I change #EANF# response to a custom text?

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
artb
Posts: 3
Joined: Tue Aug 11, 2009 4:50 pm

Can I change #EANF# response to a custom text?

Post by artb » Tue Aug 11, 2009 7:20 pm

Instead of getting a #EANF# response from imacros in firefox, Can I change #EANF# extract response to a custom text? (something like, "no value discovered" ). I would prefer to do this from within the macro without scripting, if possible.
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

Re: Can I change #EANF# response to a custom text?

Post by ABooth » Thu Aug 13, 2009 8:17 pm

Where would it return to? If it's not coming from a script, it's useless no matter what, because nothing does anything with it. If it's from a script, such as VBScript or javascript, you can have a constant representation for it instead, with any name you like and use that. E.G: -

const NOT_FOUND = "#EANF#";

if (returnValue == NOT_FOUND)
alert('Doh!');
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
Hannes, Tech Support

Re: Can I change #EANF# response to a custom text?

Post by Hannes, Tech Support » Mon Aug 17, 2009 9:32 am

The "#EANF#" is the plugin's way to discriminate between a failing TAG command (return value < 0) and a "not found" message that should not be regarded as a "real" error. The typical usage indeed is via a script that checks for this string and then reports whatever you like to the user.

Concerning changing the string directly in a macro: I will point the developers to this thread. Thanks for the suggestion!
dobbs
Posts: 1
Joined: Tue Sep 15, 2009 12:55 pm

Re: Can I change #EANF# response to a custom text?

Post by dobbs » Tue Sep 15, 2009 1:06 pm

Forgive my ignorance, but wouldn't that allow "malicious individuals" to confuse a script by including "#EANF#" in web page content? Using web forums as an example, someone could start an "#EANF#" topic and any scripts parsing topic titles would fail to parse any further topics.

Why doesn't the call to iimPlay return an error code that means "Extraction Anchor Not Found"? Or possibly have the call to iimGetLastExtract throw an exception?
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

Re: Can I change #EANF# response to a custom text?

Post by ABooth » Tue Sep 15, 2009 2:06 pm

dobbs wrote:Forgive my ignorance, but wouldn't that allow "malicious individuals" to confuse a script by including "#EANF#" in web page content? Using web forums as an example, someone could start an "#EANF#" topic and any scripts parsing topic titles would fail to parse any further topics.

Why doesn't the call to iimPlay return an error code that means "Extraction Anchor Not Found"? Or possibly have the call to iimGetLastExtract throw an exception?
#EANF# is the response from a null extract. You could include it where ever you like in the web page and the script could care less. It's only when a tag attribute is extracted with a value of #EANF# would it be an issue and even then, the only malice caused would be from your scripts handling of that value.

Also, iimPlay() returns a return code (an Integer) it would be iimGetLastExtract() that could return #EANF# (a string).

Finally; why would "Extraction Anchor Not Found" be any less malicious a return value than "#EANF#"? I suspect they chose #EANF# because it is a short abbreviation with meaning and being wrapped in '#' characters, would decrease the likelihood of it being a user entered value. It's less likely for a developer/tester to mistype #EANF# than a case sensitive sentence like: "Extraction Anchor Not Found"

On a personal note, I would prefer a method to check whether there is any extract content rather than a null return string.
VBScript Example:

Current Usage

Code: Select all

Dim returnValue
returnValue = iimGetLastExtract()
If "#EANF#" = returnValue Then
   returnValue = Null
End If

My preference

Code: Select all

Dim returnValue
If iimHasExtract() Then
    returnValue = iimGetLastExtract()
End If
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
Hannes, Tech Support

Re: Can I change #EANF# response to a custom text?

Post by Hannes, Tech Support » Wed Sep 16, 2009 6:19 am

ABooth wrote:

Code: Select all

Dim returnValue
If iimHasExtract() Then
    returnValue = iimGetLastExtract()
End If
I really like the idea of "iimHasExtract()" or "iimExtractIsEmpty()".
Will forward your suggestion to the developers.

Thanks!
Post Reply