Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 16 to 29 of 29
  1. #16
    Join Date
    Feb 2006
    Posts
    346
    That's what I was looking for - Thanks for all your help

  2. #17
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,807
    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)

  3. #18
    Join Date
    Feb 2006
    Posts
    346
    No problem - I appreciate all your time and help!

    Thanks again

  4. #19
    Join Date
    Feb 2006
    Posts
    346
    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
    Attached Files

  5. #20
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    Try looking at the section below in your text file for the "OAS_query = " values.

    That appears to hold what your looking for.


    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>
    Just use necessary String commands to parse the data.

  6. #21
    Join Date
    Feb 2006
    Posts
    346
    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">(.+)&deg;F</strong><br/>') ~= nil) then
    			temperature = string.sub(html, string.find(html, '<strong class="obsTempTextA">(.+)&deg;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

  7. #22
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,451
    Quote Originally Posted by abnrange View Post
    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
    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
    Attached Images
    Attached Files

  8. #23
    Join Date
    Feb 2006
    Posts
    346
    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

  9. #24
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,277
    This is our forecast... darn:P this is gonna be a wet week... :(
    Attached Images
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  10. #25
    Join Date
    May 2006
    Posts
    5,291
    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

  11. #26
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,277
    Quote Originally Posted by RizlaUK View Post
    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
    Amen! it's the same over here:P
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  12. #27
    Join Date
    May 2006
    Posts
    5,291
    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.

  13. #28
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,277
    well, invent a waterproof layer that can be sprayed on the wet cement:P
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  14. #29
    Join Date
    Feb 2006
    Posts
    346
    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!

Similar Threads

  1. Error inserting XML
    By TJS in forum AutoPlay Media Studio 6.0
    Replies: 6
    Last Post: 06-08-2006, 11:30 AM
  2. XML plugin Project example - XML Weather from weather.com
    By kpsmith in forum AutoPlay Media Studio 5.0
    Replies: 8
    Last Post: 06-03-2004, 06:25 PM
  3. Spotlight: XML Actions Plugin
    By Desmond in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 03-15-2004, 04:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts