Want ot proceed after executing the MacroError function

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
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
JagadeeshK
Posts: 8
Joined: Tue Jan 05, 2016 3:41 pm

Want ot proceed after executing the MacroError function

Post by JagadeeshK » Tue Jan 05, 2016 4:20 pm

Hi,

I'm using iMacros11 in iMacros Browser V11.0.246.4051. I'm trying to do some validations in my script using the Eval with MacroError function(please refer the below code).Once the MacroError function is completed I want to proceed with the rest of the steps, but it's not happening. I need to do the same kind of validations in multiple pages.Could someone suggest me a work around for this.

Code: Select all

URL GOTO={{!COL1}}
WAIT SECONDS=10
TAG POS=1 TYPE=P ATTR=CLASS:prodname EXTRACT=TXT
'Validating that the Product name contains the particular text or not
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\";if(s.match(/Level 1/g)&&s.match(/CD-ROM/g)){MacroError(\"Text Found\");} else {MacroError(\"Text not found\");}")
'The above step is executed successfully, after that the below steps are not executed
PROMPT {{!VAR2}}
TAG POS=1 TYPE=SELECT ATTR=NAME:cart[*][qty] CONTENT=%2
WAIT SECONDS=5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Checkout
Thanks,
Jagadeesh.K
chivracq
Posts: 8616
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Want ot proceed after executing the MacroError function

Post by chivracq » Tue Jan 05, 2016 8:47 pm

JagadeeshK wrote:Hi,

I'm using

Code: Select all

iMacros11 in iMacros Browser V11.0.246.4051.
I'm trying to do some validations in my script using the Eval with MacroError function(please refer the below code).Once the MacroError function is completed I want to proceed with the rest of the steps, but it's not happening. I need to do the same kind of validations in multiple pages.Could someone suggest me a work around for this.

Code: Select all

URL GOTO={{!COL1}}
WAIT SECONDS=10
TAG POS=1 TYPE=P ATTR=CLASS:prodname EXTRACT=TXT
'Validating that the Product name contains the particular text or not
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\";if(s.match(/Level 1/g)&&s.match(/CD-ROM/g)){MacroError(\"Text Found\");} else {MacroError(\"Text not found\");}")
'The above step is executed successfully, after that the below steps are not executed
PROMPT {{!VAR2}}
TAG POS=1 TYPE=SELECT ATTR=NAME:cart[*][qty] CONTENT=%2
WAIT SECONDS=5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Checkout
Thanks,
Jagadeesh.K
Hum, I read your Post several times but first I don't understand your Thread Title, especially the "ot" part, it could be "not" but it still doesn't make sense...
And I don't really understand your "'The above step is executed successfully, after that the below steps are not executed" either, do you get the MacroError or not...?

I can't have a look at your Site to test your Code if you don't post the URL...! :roll:

Mini-Hint, I don't like 'match()' that I find complicated to handle, I prefer to use 'split()' (and count the Length of the Array, if your Search Keyword was not found, the Length will be =1, if it was found, it will be >1...).
- (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...
JagadeeshK
Posts: 8
Joined: Tue Jan 05, 2016 3:41 pm

Re: Want to proceed after executing the MacroError function

Post by JagadeeshK » Wed Jan 06, 2016 4:57 am

Hi Chivracq thanks for your reply.. actually it's "to".. sorry for the typo :)

The below code executed successfully.. I got the appropriate result... but after executing the below step, Macro stopped, it's not executing the rest of the steps.

Code: Select all

SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\";if(s.match(/Level 1/g)&&s.match(/CD-ROM/g)){MacroError(\"Text Found\");} else {MacroError(\"Text not found\");}") 
all I'm trying to do is,after adding a product to the cart, just trying to validate appropriate product description is there or not, and want to proceed with the rest of the steps.

In order to check the actual product, hit the URL http://www.rosettastone.com/learn-english and add any product to the cart
chivracq
Posts: 8616
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Want to proceed after executing the MacroError function

Post by chivracq » Wed Jan 06, 2016 1:18 pm

JagadeeshK wrote:Hi Chivracq thanks for your reply.. actually it's "to".. sorry for the typo :)

The below code executed successfully.. I got the appropriate result... but after executing the below step, Macro stopped, it's not executing the rest of the steps.

Code: Select all

SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\";if(s.match(/Level 1/g)&&s.match(/CD-ROM/g)){MacroError(\"Text Found\");} else {MacroError(\"Text not found\");}") 
all I'm trying to do is,after adding a product to the cart, just trying to validate appropriate product description is there or not, and want to proceed with the rest of the steps.

In order to check the actual product, hit the URL http://www.rosettastone.com/learn-english and add any product to the cart
Ah...!, OK for "ot" = "to", yep logical...! You can still edit the Thread Title of your OP as it is the one visible from the Forum View...

But for your Qt, yep, it's logical, in both cases you trigger a MacroError. MacroError is meant to stop the Macro. If you want your Macro to keep running, you need to use 'PROMPT' (or iimDisplay()' from a '.js' Script). (You cannot use 'alert()' at this moment with the 'URL GOTO=javascript:' Syntax, it is broken, TechSupport aware of it... Oh...!, yes you can!, it is only broken on FF, you are "lucky" to be using the iMacros Browser...)

For an Example with 'PROMPT', you can have a look at this very similar Thread that we had recently on the Forum:
- Re: [SOLVED] EVAL IF ELSE #EANF# anchor not found
- (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...
JagadeeshK
Posts: 8
Joined: Tue Jan 05, 2016 3:41 pm

Re: Want ot proceed after executing the MacroError function

Post by JagadeeshK » Fri Jan 22, 2016 8:37 am

Hi Chivracq,

Thanks for the examples. It helped me a lot in taking a different approach.

Regards,
Jagadeesh.K
chivracq
Posts: 8616
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Want ot proceed after executing the MacroError function

Post by chivracq » Fri Jan 22, 2016 10:24 pm

JagadeeshK wrote:Hi Chivracq,

Thanks for the examples. It helped me a lot in taking a different approach.

Regards,
Jagadeesh.K
Hum, good to hear but you could mention what "different Approach" you chose, and share your Final Script if that can help other Users with a similar Qt...

Oh and I found a Workaround in the meantime for the Conditional PROMPT...

And you didn't correct the Typo in the Thread Title...
- (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