iMacro Email If Fail

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

iMacro Email If Fail

by Capyn on Mon Jun 26, 2017 5:56 am

(F)CIM = FF 8.9.7, FF54, MacOS X_10_10.1

Hi There,

I have tried searching for a solution but have had no luck.

I have a iMacro code that works fine - I have it completing automated tasks and then stopping once a particular content is found. BUT I wanted to take things a little further... Once iMacro detects the content, then stops (fail_if_found) I wanted to know if iMacro is capable of emailing me upon failure? Is there a function within iMacro's that is capable in doing this?

Cheers
Capyn
 
Posts: 22
Joined: Sun May 14, 2017 4:47 pm

Re: iMacro Email If Fail

by chivracq on Mon Jun 26, 2017 7:25 am

Capyn wrote:(F)CIM =
Code: Select all
FF 8.9.7, FF54, MacOS X_10_10.1


Hi There,

I have tried searching for a solution but have had no luck.

I have an iMacro code that works fine - I have it completing automated tasks and then stopping once a particular content is found. BUT I wanted to take things a little further... Once iMacro detects the content, then stops (fail_if_found) I wanted to know if iMacro is capable of emailing me upon failure? Is there a function within iMacro's that is capable in doing this?

Cheers

:!: Make sure to stay at v8.9.7 for FF if you are using 'FAIL_IF_FOUND' as this Commands appears to be broken in v9.0.3 for FF...

Well, what you want is not very complicated, simply use some Webmail Interface like 'Gmail' or 'Yahoo' (in a 2nd Tab for example) and include the Creation of some automated Mail in your Script... :idea:

The only "little complicated thing", will be that you need of course to include the E-mail part BEFORE the 'FAIL_IF_FOUND', ah-ah...!
=> Before triggering the 'FAIL_IF_FOUND', you'll need to check first with 'EXTRACT=TXT' for example if your HTML Element is found (using 'EVAL()') to "decide" to (conditionally) switch to TAB_2 to create and send the Mail before switching back to TAB_1 to still trigger the 'FAIL_IF_FOUND' or to abort your Macro with 'MacroError()' (that I found more "flexible" than 'FAIL_IF_FOUND' as it allows you to display your own "explanatory" little Msg/Report in the Display Area of the iMacros Side-Panel...).
Last edited by chivracq on Mon Jun 26, 2017 7:38 am, edited 3 times in total.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: iMacro Email If Fail

by Capyn on Mon Jun 26, 2017 7:34 am

Sure thing and thank you for your reply! I am wondering how to go about creating a Automated mail script, is it a conditional command or is it another command?
Capyn
 
Posts: 22
Joined: Sun May 14, 2017 4:47 pm

Re: iMacro Email If Fail

by chivracq on Mon Jun 26, 2017 7:36 am

Capyn wrote:Sure thing and thank you for your reply! I am wondering how to go about creating a Automated mail script, is it a conditional command or is it another command?

Oh..., I was sill editing my previous Post, ah-ah...!
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: iMacro Email If Fail

by Capyn on Mon Jun 26, 2017 7:44 am

Oh Sorry! And of course! I understand what you mean.

At this stage my code FAIL_IF_FOUND looks like this:

TAG POS=1 TYPE=SPAN ATTR=CLASS:example&&TXT: CONTENT=EVENT:FAIL_IF_FOUND

So in the above code I need to include a 'EVAL()' as suggested. My main concern is using the 'EVAL()' command as I am very unfamiliar with it! :(

Would this be too complicated to code? Or can someone like me put it together?

Thank you!
Capyn
 
Posts: 22
Joined: Sun May 14, 2017 4:47 pm

Re: iMacro Email If Fail

by chivracq on Mon Jun 26, 2017 8:13 am

Capyn wrote:Oh Sorry! And of course! I understand what you mean.

At this stage my code FAIL_IF_FOUND looks like this:

TAG POS=1 TYPE=SPAN ATTR=CLASS:example&&TXT: CONTENT=EVENT:FAIL_IF_FOUND

So in the above code I need to include a 'EVAL()' as suggested. My main concern is using the 'EVAL()' command as I am very unfamiliar with it! :(

Would this be too complicated to code? Or can someone like me put it together?

Thank you!

You are actually a bit "lucky" because I wrote a very similar Script for myself this WE, ah-ah...!
Code: Select all
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=CLASS:example&&TXT: EXTRACT=TXT
SET Object_Found EVAL("var s='{{!EXTRACT}}'; var z; if(s!='#EANF#'){z='YES';} else{z='NO';}; z;")

SET Change_TAB EVAL("var s='{{Object_Found}}'; var z; if(s=='YES'){z=2;} else{z=1;}; z;")
TAB T={{Change_TAB}}

SET URL_Webmail https://mail.google.com/
SET URL_TAB2 EVAL("var t='{{Change_TAB}}', u='{{URL_Webmail}}'; var z; if(t==2){z=u;} else{z='';}; z;")
URL GOTO={{URL_TAB2}}

'Handle the Mail Creation here...
'...

TAB T=1
SET !ERRORIGNORE NO
TAG POS=1 TYPE=SPAN ATTR=CLASS:example&&TXT: CONTENT=EVENT:FAIL_IF_FOUND


EDIT: Corrected a mini Typo/Mistake in 'URL_TAB2'. ("if(t=2)" must be "if(t==2)"...!)
Last edited by chivracq on Tue Jun 27, 2017 3:21 am, edited 2 times in total.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: iMacro Email If Fail

by Capyn on Mon Jun 26, 2017 7:21 pm

Wow chivracq! You're amazing, as always!

When I am back home I am going to try this! I will let you know how I go by reporting back!

Thank you! :)
Capyn
 
Posts: 22
Joined: Sun May 14, 2017 4:47 pm

Re: iMacro Email If Fail

by chivracq on Tue Jun 27, 2017 3:34 am

Capyn wrote:Wow chivracq! You're amazing, as always!

When I am back home I am going to try this! I will let you know how I go by reporting back!

Thank you! :)

Ah-ah...! 8)

I've corrected a mini Typo/Mistake btw in my Script...

>>>

And hum..., would be nice if you could mention your FCI as well in your parallel Thread on SOF..., no Pb to open parallel Threads on different Forums but I consider you must "maintain" them all, and all with the same "Quality", which is the main Reason why I rarely answer(ed) Threads on SOF as Users there practically never mention their FCI and I find the "Quality" of most Threads related to iMacros usually pretty low..., and I think I can't post there anymore anyway because of the stupid Reputation System on SOF, ah-ah...! :roll:

Re-hum..., and you never followed up on your previous/first Thread either on SOF, nor accepted the Solution with 'FAIL_IF_FOUND' that was provided to you by @Shugar while you obviously now use this Solution in your Script...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: iMacro Email If Fail

by Capyn on Tue Jun 27, 2017 5:18 am

Oh of course chivracq, I totally forgot about those posts/threads I made on SOF. I have since followed up on both of them as advised :)

Thank you for your edit! I have run the script:


SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=CLASS:example&&TXT: EXTRACT=TXT

SET Object_Found EVAL("var s='{{!EXTRACT}}'; var z; if(s!='#EANF#'){z='YES';} else{z='NO';}; z;")

SET Change_TAB EVAL("var s='{{Object_Found}}'; var z; if(s=='YES'){z=2;} else{z=1;}; z;")
TAB T={{Change_TAB}}

SET URL_Webmail https://mail.google.com/
SET URL_TAB2 EVAL("var t='{{Change_TAB}}', u='{{URL_Webmail}}'; var z; if(t==2){z=u;} else{z='';}; z;")
URL GOTO={{URL_TAB2}}

TAG POS=3 TYPE=DIV ATTR=TXT:COMPOSE
TAG POS=1 TYPE=TEXTAREA FORM=ID::nk ATTR=ID::nn CONTENT=ai
TAG POS=2 TYPE=DIV ATTR=TXT:testing123@gmail.com
TAG POS=1 TYPE=INPUT:TEXT FORM=ID::nk ATTR=ID::n6 CONTENT=EXAMPLEFOUND
TAG POS=1 TYPE=DIV ATTR=ID::mw

TAB T=1
SET !ERRORIGNORE NO
TAG POS=1 TYPE=SPAN ATTR=CLASS:example&&TXT: CONTENT=EVENT:FAIL_IF_FOUND

-

Once "example" is found, it switches to tab two of my gmail then it switches back to the original tab but it does not send email?

Does my code look correct for the handling email area? I feel like I've done that part incorrectly.

Thank you
Capyn
 
Posts: 22
Joined: Sun May 14, 2017 4:47 pm

Re: iMacro Email If Fail

by chivracq on Tue Jun 27, 2017 6:15 am

Capyn wrote:Oh of course chivracq, I totally forgot about those posts/threads I made on SOF. I have since followed up on both of them as advised :)

Thank you for your edit! I have run the script:

Code: Select all
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0

SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=CLASS:example&&TXT: EXTRACT=TXT

SET Object_Found EVAL("var s='{{!EXTRACT}}'; var z; if(s!='#EANF#'){z='YES';} else{z='NO';}; z;")

SET Change_TAB EVAL("var s='{{Object_Found}}'; var z; if(s=='YES'){z=2;} else{z=1;}; z;")
TAB T={{Change_TAB}}

SET URL_Webmail https://mail.google.com/
SET URL_TAB2 EVAL("var t='{{Change_TAB}}', u='{{URL_Webmail}}'; var z; if(t==2){z=u;} else{z='';}; z;")
URL GOTO={{URL_TAB2}}

TAG POS=3 TYPE=DIV ATTR=TXT:COMPOSE
TAG POS=1 TYPE=TEXTAREA FORM=ID::nk ATTR=ID::nn CONTENT=ai
TAG POS=2 TYPE=DIV ATTR=TXT:testing123@gmail.com
TAG POS=1 TYPE=INPUT:TEXT FORM=ID::nk ATTR=ID::n6 CONTENT=EXAMPLEFOUND
TAG POS=1 TYPE=DIV ATTR=ID::mw

TAB T=1
SET !ERRORIGNORE NO
TAG POS=1 TYPE=SPAN ATTR=CLASS:example&&TXT: CONTENT=EVENT:FAIL_IF_FOUND

-

Once "example" is found, it switches to tab two of my gmail then it switches back to the original tab but it does not send email?

Does my code look correct for the handling email area? I feel like I've done that part incorrectly.

Thank you

Ah OK, yep, just saw the Replies on SOF, hum, nice as well to mention me, ah-ah...! :oops:
Even if hum..., the "Revert back" to v8.9.7 is not really the "Solution" for your Mail Thread (parallel to this one), even if yep, your Script is using 'FAIL_IF_FOUND' which doesn't work anymore in v9.0.3 indeed, but the same Mechanism could still be done in v9.0.3 using 'MacroError()' like I mentioned earlier, and the "Send a Mail" Functionality is independent from 'FAIL_IF_FOUND'... But OK, never mind...

>>>

Yeah..., it looks like for the Mail part, that Gmail doesn't really like the 'TAG' Mode, the 'Compose' Click doesn't work for a start, and the 'Mail Body' doesn't like it either... The Gmail "Standard" Mode is full of JavaScript and Dynamic ID's, you may consider using the Basic HTML Mode which I reckon will be more reliable, and will work with the 'TAG' Mode...

I manage to get the following Script to work, using the 'EVENT' Mode (without ID's) (using the Standard Gmail anyway):
Code: Select all
'TAG POS=3 TYPE=DIV ATTR=TXT:COMPOSE
EVENT TYPE=CLICK SELECTOR="#\\:ya>DIV>DIV" BUTTON=0

'E-mail Address:
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(17)>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV:nth-of-type(4)>TABLE>TBODY>TR>TD:nth-of-type(2)>FORM>DIV>TABLE>TBODY>TR>TD:nth-of-type(2)>DIV>DIV>TEXTAREA" CHARS="test123@test.com"
'>
'Subject Line:
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(17)>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV:nth-of-type(4)>TABLE>TBODY>TR>TD:nth-of-type(2)>FORM>DIV:nth-of-type(3)>INPUT" CHARS="Subject Line...!"
'>
'Mail Body:
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(17)>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV:nth-of-type(4)>TABLE>TBODY>TR>TD:nth-of-type(2)>TABLE>TBODY>TR>TD>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD:nth-of-type(2)>DIV:nth-of-type(2)>DIV" CHARS="Body of the Mail...!"
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(17)>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV:nth-of-type(4)>TABLE>TBODY>TR>TD:nth-of-type(2)>TABLE>TBODY>TR>TD>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD:nth-of-type(2)>DIV:nth-of-type(2)>DIV" KEYS="[13,13]"
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(17)>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV:nth-of-type(4)>TABLE>TBODY>TR>TD:nth-of-type(2)>TABLE>TBODY>TR>TD>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD:nth-of-type(2)>DIV:nth-of-type(2)>DIV" CHARS="Greetings..."
EVENT TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(17)>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV:nth-of-type(4)>TABLE>TBODY>TR>TD:nth-of-type(2)>TABLE>TBODY>TR>TD>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD:nth-of-type(2)>DIV:nth-of-type(2)>DIV" KEY=13
'>
'Send Mail:
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(17)>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>DIV:nth-of-type(4)>TABLE>TBODY>TR>TD:nth-of-type(2)>TABLE>TBODY>TR:nth-of-type(2)>TD>DIV>DIV>DIV:nth-of-type(4)>TABLE>TBODY>TR>TD>DIV>DIV:nth-of-type(2)" BUTTON=0
(Tested on iMacros for FF v8.8.2, PM v26.3.3 (=FF47), Win10-x64.)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: iMacro Email If Fail

by Capyn on Tue Jun 27, 2017 11:48 pm

Hi chivracq, thanks so much for your reply. And I agree with your recommendation for SOFs. Ill keep that in mind in future :)


Thank you for your code - I appreciate that! That looks intense! (too intense for me to understand haha!)

I have managed to get it working, it all works for me! You're a genius! :)
Capyn
 
Posts: 22
Joined: Sun May 14, 2017 4:47 pm

Re: iMacro Email If Fail

by chivracq on Wed Jun 28, 2017 5:48 am

Capyn wrote:Hi chivracq, thanks so much for your reply. And I agree with your recommendation for SOFs. Ill keep that in mind in future :)

Thank you for your code - I appreciate that! That looks intense! (too intense for me to understand haha!)

I have managed to get it working, it all works for me! You're a genius! :)

OK, good to hear, ah-ah...! But a "genius", ah-ah...!, first time I get this "Qualifier", I think, I more often get "moron" hum or "douche" as well this week which was new... 8)

But OK, Code looks "intense", well that's how the 'EVENT' Mode without ID's looks like, but iMacros does all the Black Magic itself, and I actually simplified it by removing all 'CLICK' 'EVENT' Statements that iMacros records as well and that are most of the time not necessary...
Important with the 'EVENT' Mode is to use Comments like I did, as it's otherwise nearly impossible to follow/debug your Script if anything stops working... Good Practice is as well to keep the equivalent 'TAG' Statement even if it's not working like I did for example for the 'COMPOSE' Button...

But I think the Mail part is not very "reliable" and will probably stop working as soon as Google adds or modifies "something" on the Page, or if some Popup comes up about some Functionality not working on the Page (which happens regularly) or if sbd tries to catch you on the Chat, etc...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: iMacro Email If Fail

by Capyn on Fri Jul 07, 2017 5:34 am

Absolutely, I can see why you used EVENT now!

UPDATE - The script is working fine still!! :)
I am currently trying to get another script together. I will make a separate thread for that and see if there is a solution! :D
Capyn
 
Posts: 22
Joined: Sun May 14, 2017 4:47 pm


Return to General Support & Discussions

Who is online

Users browsing this forum: No registered users and 7 guests

-->