Learning Functions
Posted: Sat Feb 27, 2010 4:02 am
As I am learning RR I have created my first application which has given me many ideas for additional desktop applications. The following code I have used within an on MouseUp code block and I am wanting to create its own function.
If I wrap the above code with
and put it on the Main Stack Script I have tried on the card script to call GetWeatherInfo(46528) which upon running the stack, I get an error message of
Unable to find Handler
Anyone have any ideas?
Code: Select all
put "" into tString
put "User-Agent: WeAreClosedToday DesktopWeatherApplication/" into tUserAgent
put "1.0.0" after tUserAgent
set the httpHeaders to tUserAgent
put url ("http://demo.weareclosedtoday.com/properties/xmlfeed/runrevfunctions.cfm?Method=QueryWUndergroundStations&ZipCode=" & passZipCode) into tWUndergroundStationsData
put revCreateXMLTree(tWUndergroundStationsData, false, true, false) into tWUndergroundStationsTreeID
if tWUndergroundStationsTreeID is not a number then
answer error "XML Tree not Created due to error"
exit GetWeatherInfo
end if
put revXMLRootNode(tWUndergroundStationsTreeID) into tWUndergroundStationsXMLRootNode
put revXMLNumberOfChildren(tWUndergroundStationsTreeID, tWUndergroundStationsXMLRootNode, "", 0) into tWUndergroundStationsXMLChildrenNodes
put revXMLNodeContents(tWUndergroundStationsTreeID, "RunRevXML/ClosestAirportCode") into tClosestAirportCode
put revXMLNodeContents(tWUndergroundStationsTreeID, "RunRevXML/ClosestPersonalWSCode") into tClosestPersonalWSCode
put url ("http://demo.weareclosedtoday.com/properties/xmlfeed/runrevfunctions.cfm?Method=QueryWUndergroundAirportStatus&AirportCode=" & tClosestAirportCode) into tWUndergroundAirportData
put revCreateXMLTree(tWUndergroundAirportData, false, true, false) into tWUndergroundAirportTreeID
if tWUndergroundAirportTreeID is not a number then
answer error "XML Tree not Created due to error"
exit GetWeatherInfo
end if
-- Put Information into Variables to be displayed on the screen within the Stack
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/ObservationTime") into tObservationTimeField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/Weather") into tWeatherField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/RelativeHumidity") into tRelativeHumidityField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/Temperature") into tTemperatureField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/WindString") into tWindSpeedField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/PressureString") into tPressureStringField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/DewPointString") into tDewPointStringField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/HeatIndexString") into tHeatIndexStringField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/WindChillString") into tWindChillStringField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/VisibilityMi") into tVisibilityMiField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/IconBaseURL") into tIconBaseURLField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/IconBaseName") into tIconBaseNameField
put revXMLNodeContents(tWUndergroundAirportTreeID, "RunRevXML/CurrentIcon") into tCurrentIconField
-- Lets Display the information to the Card
put revXMLNodeContents(tWUndergroundStationsTreeID, "RunRevXML/LocationCountry") into field "CountryField" on card "Get Weather Info"
put revXMLNodeContents(tWUndergroundStationsTreeID, "RunRevXML/LocationState") into field "StateField" on card "Get Weather Info"
put revXMLNodeContents(tWUndergroundStationsTreeID, "RunRevXML/LocationCity") into field "CityField" on card "Get Weather Info"
set the filename of image "CurrentWeatherImage" on card "Get Weather Info" to tIconBaseURLField & tCurrentIconField & tIconBaseNameField
put tObservationTimeField into field "ObservationTimeField" on card "Get Weather Info"
put tTemperatureField into field "Current Temp Field" on card "Get Weather Info"
put tDewPointStringField into field "Dew Point Field" on card "Get Weather Info"
put tWindSpeedField into field "Wind Speed Field" on card "Get Weather Info"
put tRelativeHumidityField into field "Relative Humidity Field" on card "Get Weather Info"
put tPressureStringField into field "Pressure Field" on card "Get Weather Info"
put tVisibilityMiField & " Mile(s)" into field "Visibility Field" on card "Get Weather Info"
put "" into field "Feels Like Label" on card "Get Weather Info"; put "" into field "Feels Like Field" on card "Get Weather Info"
if "NA" is not in tHeatIndexStringField then
put "Heat Index: " into field "Feels Like Label" on card "Get Weather Info"
put tHeatIndexStringField into field "Feels Like Field" on card "Get Weather Info"
else if "NA" is not in tWindChillStringField then
put "Wind Chill: " into field "Feels Like Label" on card "Get Weather Info"
put tWindChillStringField into field "Feels Like Field" on card "Get Weather Info"
end if
Code: Select all
function GetWeatherInfo passZipCode
end GetWeatherInfo
Unable to find Handler
Anyone have any ideas?