Weather gadget (Gdip). Accuweather

Post your working scripts, libraries and tools
drozdman
Posts: 63
Joined: 05 Dec 2015, 01:07

Weather gadget (Gdip). Accuweather

14 Aug 2018, 12:54

I replaced some Windows Vista sidebar gadgets ("Network monitor", "CPU monitor","Traditional clock with alarm"), but I didn't post the weather gadget. I thought it was personalized too much and the Accuweather website layout may change in the future. Adding to that, the website sends data with different units for USA and the world (Celsius, Fahrenheit). It may be useful to post it, even though it may not work in the future (I may not be updating it).
The gadget can be easily changed and customized. I cleaned the script and removed unnecessary features.
I hope it works in different locations
I chose a few locations like: "https://www.accuweather.com/en/it/rome/213490/current-weather/213490"
The chosen url for another location must be exactly like this one (with "/en/","/current-weather/").
I think it will work in many countries, but I didn't check this by proxy.

Weather gadget
● top left circle - toggle always on top
● double click on the title to go to the saved position
● F4 - show GUI , or click on tray icon
● more options in the right click context menu: background color; save position for next launch,
● To start not on top of other windows: enable this line #227 ;Gosub, onTop
● Accuweather forecast in popup window
● Depending on a country, data is received in Fahrenheit or Celsius degrees.
So choose units below: unit:="C" or unit:="F".
Convert Fahrenheit to Celsius with option: F_to_Celsius:=1

Save the file in Unicode or UTF-8 with signature (not in UTF-8 as it is chosen with the download feature here - it messes up unicode characters).

Code: [Select all] [Expand] [Download] (Drozd_Weather_simple.ahk)GeSHi © Codebox Plus



Drozd_Weather_gadget.png
Drozd_Weather_gadget.png (3.84 KiB) Viewed 306 times
chucknp

Re: Weather gadget (Gdip). Accuweather

17 Aug 2018, 13:31

Great drozdman, thanks!

Have been using this script + your CPU Monitor + Network monitor.
sevenwenty
Posts: 5
Joined: 30 Apr 2016, 10:29

Re: Weather gadget (Gdip). Accuweather

26 Aug 2018, 21:52

Excellent work! This has a lot of potential.
How do I set the refresh rate to 15 minutes instead of the default 30 minutes? Just change the part that says "30*60*1000" to "15*60*1000"?
Some feature requests:
  • Allow any saved position. Currently, it ignores the saved position if part of the window is outside of the screen (i.e. x = 1600 on a 1680 screen).
  • Simple mode that only shows temperature. No backgrounds, no titlebar, no text; just the temperature.
  • Custom text sizes.
  • Custom window size.
  • Custom window/text colors.
  • High/low temperatures.
I've already added some of these features by commenting out lines and making minor edits. If I have time I'll try to make them into proper patches.
mshall
Posts: 24
Joined: 13 Jul 2018, 16:42

Re: Weather gadget (Gdip). Accuweather

27 Aug 2018, 11:44

sevenwenty wrote:How do I set the refresh rate to 15 minutes instead of the default 30 minutes?


I haven't look at the code too long, but the Accuweather API only allows you to refresh every 30 minutes (unless that has changed).
drozdman
Posts: 63
Joined: 05 Dec 2015, 01:07

Re: Weather gadget (Gdip). Accuweather

27 Aug 2018, 12:15

@sevenwenty
● about timer - yes
● Many of those things would require a complete GUI redesign. But some changes can be made easily
● You probably wanted to cut part of the window by putting it off screen.
It's easier to simply cut the GUI with
WinSet, Region, 2-18 56-18 56-50 2-50 , ahk_id %GuiHwnd% ;Drozd_weather
It will leave just the temperature control in the view.
● "saved position" - you can go to this part and remove the line with "if"

Code: [Select all] [Download] GeSHi © Codebox Plus

	GoToSavedPos: 
IniRead, pos_x_saved, %settings_ini%, window position, x
IniRead, pos_y_saved, %settings_ini%, window position, y
if(pos_x_saved<A_ScreenWidth-120 && pos_y_saved<A_ScreenHeight-140)
WinMove, Drozd_weather, ,pos_x_saved,pos_y_saved
return

If there is some more problem change A_ScreenWidth to MonitorWorkAreaRight. But that's not the issue, I think

Code: [Select all] [Download] GeSHi © Codebox Plus

	SysGet, MonitorWorkArea, MonitorWorkArea, 1
pos_x:=MonitorWorkAreaRight - 138 ;A_ScreenWidth - 138
pos_y:= MonitorWorkAreaBottom -688


● You can feel free to make changes and post it. Some things would require changing a lot of code, though.


@mshall
I didn't use API, I would hahe to sign up. It's simply taken from the website.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 14 guests