That's what I was looking for - Thanks for all your help
Professional Software Development Tools
That's what I was looking for - Thanks for all your help
I try to give folks a way to learn -- give them a fishing pole & guide them...
so what have you tried?
you'd use the http.download() and that would go to a file.
then use TextFile.ReadToString() to read in that file.
Then use String.Find() and String.Mid() to "pull" the information between the markers.
I'll come up with an example using that website in a few days for you.. but it's a low priority for me.. (I hope you understand)
(Click here to contact me)
Providing Independent Professional Consulting Services for
IndigoRose products, World Wide.
Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)
No problem - I appreciate all your time and help!
Thanks again
Hello,
Could use some more help with extracting data from text file. I would like to extract the 5 day forecast and display each day into a paragraph. The problem is I do not understand how to get the data from the text file then write it to a string. When looking at the text file I do not know what to look for or how to get the data into ams to display into a paragraph along with image (rain, clouds etc). If someone could show me a sample for one day and where to get the data from the text file - It would be greatly appreciated.
Sorry still learning - Thanks
Try looking at the section below in your text file for the "OAS_query = " values.
That appears to hold what your looking for.
Just use necessary String commands to parse the data.Code:<!-- MJX config controlled by pif_btrav_tenday_long --> <SCRIPT LANGUAGE="JavaScript"> <!-- OAS_MJX_on = true; // when true, this allows the MJX ad request to be made OAS_spoof = '/p/f/r/p/5day/us/nj/504/mays_landing/08330.'; OAS_listpos = 'PageCounter,HeaderSpon,WindowShade,Classified,PageSpon,PageSpon2,PdSearch,PageSpon3,PageSpon4,Hidden1,Hidden2'; OAS_query = 'context=trvl_btrav_tenday&templ1=38&temph2=51&templ2=32&fcond2=cloud_mostly&temph3=51&templ3=33&fcond3=clear_mostly_sunny&'; CM_tag = 'null'; // --> </SCRIPT>
Here is the code that gets current image and temp.
I 'm still confused on how to do this. How do I get each day temp and image to read to 5 different paragraphs. I'm a visual person - I need to see some type of smaple to understand. The code posted below just confuses me - I don't understand (yet) how to get the data and pass to a string. Any help would be great. Thanks
Code:-- A function that accepts two values and returns one value function fetchWeather(URL) StatusDlg.Hide(); HTTP.Download(URL, _TempFolder .. "\\weather.htm", MODE_TEXT, 30, 80) StatusDlg.Hide(); end function displayWeather() if (File.DoesExist(_TempFolder .. "\\weather.htm")) then html = TextFile.ReadToString(_TempFolder .. "\\weather.htm"); if (string.find(html, '<strong class="obsTempTextA">(.+)°F</strong><br/>') ~= nil) then temperature = string.sub(html, string.find(html, '<strong class="obsTempTextA">(.+)°F</strong><br/>')); value = String.Mid(temperature, 30, String.Length(temperature) - 49); Label.SetText("weather", value .. "°F"); else Label.SetText("weather", "???"); end end end function fetchImage() if (File.DoesExist(_TempFolder .. "\\weather.htm")) then html = TextFile.ReadToString(_TempFolder .. "\\weather.htm"); if (string.find(html, '<div class="cImage"><img width="52" height="52" border="0" src="(.+)" alt=""/><br/>') ~= nil) then image = string.sub(html, string.find(html, '<div class="cImage"><img width="52" height="52" border="0" src="(.+)" alt=""/><br/>')); url = String.Mid(image, 65, String.Length(image) - 80); HTTP.Download(url, _TempFolder .. "\\image.png", MODE_BINARY, 30, 80); error = Application.GetLastError(); if (error == 0) then Image.Load("Image1", _TempFolder .. "\\image.png"); end end end end
I believe that "a small sample" was already given. Actually, a whole solution how to search for strings in a document is shown in my code.
The code I presented before showed how to fetch specific information from a specific HTML file. If the file structure changes, or if you want to fetch different informations, the functions won't work without modifications. And to be able to do that, you have to understand what they do. You won't learn just copying somebody's work - try to see what is done, and why. Use the debug window to inspect what the variables contain as the function is processed.
I am showing you now a new project, which demonstrates how to retrieve 5 days of weather forecast. If this page on the Weather.com web site changes its structure, you will have to adjust the code accordingly, or the information won't be found and something might end up missing on the screen.
Ulrich
upeters - Thanks again for your help.
I tried to see what and how it was done. Still does not make sense too me.
I still do not understand how you pull the data from the text file.
With time I will learn - Thanks
This is our forecast... darn:P this is gonna be a wet week... :(
lol, i dont need any app or site to tell me im gonner get wet, november in london is always wet, cold n wet and by xmas everything will be coverd in ice
roll on may, thats what i say![]()
yeah, another *raind off* day
i will jump for joy the day thay invent cement you can use in the rain, its not even like we can use a canvas with all this wind as well, its too much, another day added to the job and not a stich done.
well, invent a waterproof layer that can be sprayed on the wet cement:P
Hello,
I was wonder if it is possible have an input object so, you can type a ZIP code and it would go fetech the data with images. If so, how can it be done?
I have tried for a few weeks working with parsing data - I don't think I will ever understand how to do it.
Thanks!