Jump to content

Google Weather


nobbe
 Share

Recommended Posts

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

The reply that comes back from Google is a Unicode XML document. If you save this to a local file on your system then perhaps it's running a default conversion from Unicode to your local codepage. This would then prevent it from loading correctly in the XML parser.

WBD

Link to comment
Share on other sites

The reply that comes back from Google is a Unicode XML document. If you save this to a local file on your system then perhaps it's running a default conversion from Unicode to your local codepage. This would then prevent it from loading correctly in the XML parser.

WBD

It's not Unicode. It only contains accented characters (ASCI > 128) which are problematic in _XMLOpen() part.

I think those characters should be somehow encoded, maybe %hex_number or something similar.

Link to comment
Share on other sites

It's not Unicode. It only contains accented characters (ASCI > 128) which are problematic in _XMLOpen() part.

I think those characters should be somehow encoded, maybe %hex_number or something similar.

I haven't tested this, but in the call to _XMLFileOpen he should maybe pass a version number as the second parameter...

$objDoc = _XMLFileOpen($infile, 3)

It seems like the latest parser should be able to read these characters - if not, I think there is a international government conspiracy at work to prevent it because I am a congenital conspiracy theorist.

Das Häschen benutzt Radar

Link to comment
Share on other sites

updates first post

i added a litte chart for temperatures (google.chart.api)

Chart is a nice addition but I'm not sure just how useful it will be. In the meantime you have a problem in the GUI when using the German site and perhaps others. The Label for wind conditions won't hold the data. You may have to take the controls for Current conditions out of the Array and create them separately. Resizing the Window isn't enough.

EDIT:

Tip -- Remove all of your GUICtrlSetFont() lines and place this below the GUICreate()

GUISetFont(8, 800, 0, "Arial")
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Another issue has just popped up. As you noticed in the PM, If I use Google.com or anything except google.ca, the current info and the image fields are blank. This is rectified by using google.ca however the images on google.ca are png images. I've solved the issue of getting the correct image in my modified functions but you may want to make a note of this in case someone else has the same problem.

I will PM you the code that I'm using.

EDIT: I just found where all the problems are. Google is in the midst of changing the Weather API. I have another function that I'm working on to solve that problem and another with the way °C and °F are handled. Slight delay while I finish.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I googled for MSXML details and here it is:

Character Encoding and MSXML

http://msdn.microsoft.com/en-us/library/ms757065(VS.85).aspx

Enforcing Character Encoding with DOM

http://msdn.microsoft.com/en-us/library/ms761374(VS.85).aspx

MSXML DOM Reference

http://msdn.microsoft.com/en-us/library/ms764730(VS.85).aspx

Another nice web page about this problem:

http://www.w3schools.com/XML/xml_encoding.asp

Google weather has only head without encoding like this <?xml version="1.0"?>

So after download your encoding should be manually added <?xml version="1.0" encoding="ISO-8859-2"?>

Here is related AU3 code:

Global $infile = @ScriptDir & "\weather.xml";
InetGet("http://www.google.cz/ig/api?weather=Brno", $infile, 1, 0)
    
$text = FileRead($infile)
$text = StringReplace($text, '<?xml version="1.0"?>', '<?xml version="1.0" encoding="ISO-8859-2"?>')
FileDelete($infile)
FileWrite($infile, $text)
Edited by Zedna
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...