Posts: 1,769
	Threads: 410
	Joined: Feb 2003
	
	
 
	
	
		Occasionally I get this error in a macro and can't understand why.
It runs 2-3 times an hour 5 days a week and has no problems but on a couple of occasions I get this.  Why would it work 99.9% of the time rather than always failing?
	
	
	
	
	
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
 
	
	
	
		
	Posts: 1,769
	Threads: 410
	Joined: Feb 2003
	
	
 
	
	
		Function 
Get_Temp 
Trigger 
!ca"MessageBoard" "#32770"      
str Src Message zipcode url negtemp
zipcode="65101" ;;enter your zipcode here
ARRAY(str) Temp FeelsLike
url.from("http://www.weather.com/weather/local/" zipcode "?lswe=" zipcode "&lwsa=WeatherLocalUndeclared&from=whatwhere")
int MatchSucess
IntGetFile url Src
;Src.getfile("C:\qm\Desktop\new 2.txt")
err
,Speak "Error getting Temprature" 2 "" -3 55
,end
_s.time("%I:%M")
findrx(Src "<B CLASS=obsTempTextA(>|-)([\d]{1,3})" 0 0 Temp) ;;([\d]{1,3}+)
if Temp[1]="-"
,Message.from("The current Temperature is " Temp[1] Temp[2])
,_s.from("Temp: " Temp[1] Temp[2] "  " _s)
else
,Message.from("The current Temperature is " Temp[2])
,_s.from("Temp: " Temp[2] "  " _s)
err
,_s.from("Error retreiving temp")
Speak Message 2 "" 0 65
_s.setwintext(id(5 win("MessageBoard" "#32770")))
err
 
 
	
	
	
		
	Posts: 12,239
	Threads: 144
	Joined: Dec 2002
	
	
 
	
	
		findrx(Src "<B CLASS=obsTempTextA(>|-)([\d]{1,3})" 0 0 Temp) ;;([\d]{1,3}+)
if Temp[1]="-"
Return if findrx fails (returns -1). Then it does not create the array. For example, sometimes the page may be unavailable, but IntGetFile does not fail because the website provides an error page.