benn Posted October 11, 2007 Report Share Posted October 11, 2007 Hi I have a simple script which does the following: logs onto a financial institution webpage, downloads transactions, closes the webpage, loads the transactions into another program. I have Wait for webpage "bla" command to ensure that the page loads before it continues and wait for Window Title "bleh" to ensure the programs are opening their expected windows. If a page doesnt load in the predefined timeframe, an error appears on the screen saying "Webpage "bla" did not load in the specified time" Is ME able to email me if the script does not finish to let me know that it failed? If so how do I do this. I would perfer not logging onto this specifc machine daily to ensure it ran correctly and only resort to this if it failed. Any advice is appreciated Ben Quote Link to comment Share on other sites More sharing options...
Cory Posted October 11, 2007 Report Share Posted October 11, 2007 In cases like these where a simple Wait for Web Page will not work I use polling. That is I poll, or capture, the screen and test it before doing anything else. The easiest way is to do a CTRL+A which selects the entire screen and copy that to the clipboard where you can do the If Variable Contains test to see if it contains the string “did not load in the specified time”. You can also do SaveAs or View Source for polling tests. I was once harvesting a Yahoo Group where I was launching the message ID number in the URL. But every once in a while I would get one of those annoying advertising pages before reaching my intended target. I would simply poll the screen when it was done and if it didn’t contain the text “Message: %T1%” I would launch it again until it worked for a maximum of 5 times after which it would log an error and email it to me. Also you can use screen polls as a sort of Wait For in web pages. Just do it ever couple of seconds in a repeat until you get what you’re looking for. Quote Link to comment Share on other sites More sharing options...
cyberchief Posted October 11, 2007 Report Share Posted October 11, 2007 I do something similar to Cory... but rather than looking for conditions ON the screen... I set a loop to repeat until a specific Window Title is there. I would think that, unless you are working in mulitple web pages or windows with the same names, this would work a little more efficiently. Something like this: Repeat Start (Repeat 60 times) Variable Set String %T1% from Window Title If Variable %T1% contains "Macro Express Forums" Break End If Delay 1 Seconds Repeat End If Variable %T1% does not contain "Macro Express Forums" E-Mail Send: Know Recipients, Fixed Text, No Attachments Macro Return End If Quote Link to comment Share on other sites More sharing options...
benn Posted October 12, 2007 Author Report Share Posted October 12, 2007 Hmmmm will dabble more with variables and email send. Ta! Quote Link to comment Share on other sites More sharing options...
Cory Posted October 12, 2007 Report Share Posted October 12, 2007 CyberChief: Generally if the window titles are different and change I will use the Wait For Window titles but often they either don’t change or appear before the contents of the window has loaded. Terminal emulators are a good example. The title is always the same and if you fire one up to do something the window pops up and depending on network traffic, astrological alignment, and the Coriolis effect the actual content could take from 20mS to a coffee break to load and what loads has a fair chance of being an error. This is when I like to use screen polling. But I use your approach often if there’s a chance a window won’t appear since there is no error handling in ME yet. It’s a solid approach. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.