Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1590

Help: Rainmeter Skins • Re: Time Zone Abbreviation

$
0
0
Thanks to all who contributed to this thread.

After a lot of reading and searching, I decided to use WebParser with the following two sites, both of which were mentioned by one or another in this thread:
https://ipapi.co/json
https://api.geotimezone.com/public/timezone?latitude=38.7351&longitude=-77.0797
The lat./long. in the second URL will be filled in with the lat./long. gathered from the first URL, which uses one's IP address.

Since I'm working with a desktop, I decided to put the static information (city, lat./long., etc.) in a tooltip, rather than continuously displaying unchanging information.

So here's some sample code pulled from my suite:

Code:

;=======================================; RAINMETER;=======================================[Rainmeter]Update=1000AccurateText=1OnRefreshAction=[!Move #skinX# #skinY#];=======================================; VARIABLES;=======================================[Variables]; Variables from the include file.;---------------------------------------q3workAreaWidth=#WORKAREAWIDTH#q3workAreaHeight=#WORKAREAHEIGHT#q3screenBorder=4q3skinBorder=2q3dividerWidth=2q3titlebarHeight=32q3titlebarCenterY=(trunc(#q3titlebarHeight#/2))q3titleCoverHeight=10q3cornerRoundness=7q3cellWidth=(Round(#q3workAreaWidth#/100)*10)q3leftPanelX=(#WORKAREAX#+#q3screenBorder#)q3leftPanelY=(#WORKAREAY#+#q3screenBorder#)q3leftPanelWidth=(trunc((#q3workAreaWidth#-(#q3screenBorder#*4)-(#q3cellWidth#*7)-#q3dividerWidth#)/2))q3leftPanelLeft=#q3leftPanelX#q3leftPanelRight=(#q3leftPanelLeft#+#q3leftPanelWidth#-1)q3leftPanelCenterX=(#q3leftPanelLeft#+(#q3leftPanelWidth#/2))q3clockHeight=(#q3titlebarHeight#*2)q3clrBackground=0,99,177,255q3clrBorder=0,120,215,255q3clrTitlebar=0,120,215,255q3clrText=255,255,255,255q3fontBold=700; Geolocation WebParser Addresses;---------------------------------------; IPAPIsite:  IP API site.; GEOtimezoneSite:  GEO Timezone site.IPAPIsite=https://ipapi.co/jsonGEOtimezoneSite=https://api.geotimezone.com/public/timezone?latitude=[&msrIPAPIlatitude]&longitude=[&msrIPAPIlongitude]; Skin Variables;---------------------------------------; skinBorder:  size of skin border.; skinX:  skin left edge position on screen.; skinY:  skin top edge position on screen.; skinWidth:  width of the skin.; skinHeight:  height of the skin.; skinLeft:  left edge of skin; always 0.; skinRight:  right edge of skin.; skinTop:  top edge of skin; always 0.; skinBottom:  bottom edge of skin.; skinCenterX:  horizontal center of skin.skinBorder=#q3skinBorder#skinX=#q3leftPanelX#skinY=#q3leftPanelY#skinWidth=#q3leftPanelWidth#skinHeight=#q3clockHeight#skinRight=#q3leftPanelRight#skinBottom=(#skinY#+#skinHeight#-1)skinCenterX=#q3leftPanelCenterX#[styleHeader]FontFace=Trebuchet MSFontSize=13FontWeight=#q3fontBold#FontColor=#q3clrText#StringAlign=CenterCenterStringCase=NoneAntiAlias=1ClipString=0;=======================================; CLOCK MEASURES;=======================================;---------------------------------------; IPAPI Site Measures;---------------------------------------[msrIPAPISite]Measure=WebParserUpdateRate=3600URL=#IPAPIsite#RegExp=(?siU)"ip": "(.*)".*"city": "(.*)".*"region": "(.*)".*"region_code": "(.*)".*"country_name": "(.*)".*"country_code": "(.*)".*"latitude": (.*),.*"longitude": (.*),.*"timezone": "(.*)".*"utc_offset": "(.*)"FinishAction=[!CommandMeasure msrGEOtimezoneSite "Update"][msrIPAPIip]Measure=WebParserURL=[msrIPAPISite]StringIndex=1[msrIPAPIcity]Measure=WebParserURL=[msrIPAPISite]StringIndex=2[msrIPAPIregion]Measure=WebParserURL=[msrIPAPISite]StringIndex=3[msrIPAPIregion_code]Measure=WebParserURL=[msrIPAPISite]StringIndex=4[msrIPAPIcountry]Measure=WebParserURL=[msrIPAPISite]StringIndex=5[msrIPAPIcountry_code]Measure=WebParserURL=[msrIPAPISite]StringIndex=6[msrIPAPIlatitude]Measure=WebParserURL=[msrIPAPISite]StringIndex=7[msrIPAPIlongitude]Measure=WebParserURL=[msrIPAPISite]StringIndex=8[msrIPAPItimezone]Measure=WebParserURL=[msrIPAPISite]StringIndex=9[msrIPAPIutc_offset]Measure=WebParserURL=[msrIPAPISite]StringIndex=10;---------------------------------------; GEO Timezone Site Measures;---------------------------------------[msrGEOtimezoneSite]Measure=WebParserUpdateRate=3600DynamicVariables=1URL=#GEOtimezoneSite#RegExp=(?siU)"timezone_abbreviation":"(.*)".*"dst_abbreviation":"(.*)"[msrGEOtimezoneSTDabbrev]Measure=WebParserURL=[msrGEOtimezoneSite]StringIndex=1[msrGEOtimezoneDSTabbrev]Measure=WebParserURL=[msrGEOtimezoneSite]StringIndex=2;---------------------------------------; Generanl Clock Measures;---------------------------------------[msrTZStandardName]Measure=SysInfoSysInfoType=TIMEZONE_STANDARD_NAMEUpdateDivider=-1[msrTZDaylightName]Measure=SysInfoSysInfoType=TIMEZONE_DAYLIGHT_NAMEUpdateDivider=-1[msrTZisDaylight]Measure=SysInfoSysInfoType=TIMEZONE_ISDSTIfCondition=msrTZisDaylight = 1IfTrueAction=[!SetOption mtrClockBody MeasureName2 "msrGEOtimezoneDSTabbrev"][!SetOption mtrClockBackground MeasureName11 "msrTZDaylightName"]IfFalseAction=[!SetOption mtrClockBody MeasureName2 "msrGEOtimezoneSTDabbrev"][!SetOption mtrClockBackground MeasureName11 "msrTZStandardName"][msrTimeDayDate12]Measure=TimeFormat=%A, %B %d %#I:%M %p[msrTimeDate24]Measure=TimeFormat=%Y-%m-%d %H%M.%S;=======================================; CLOCK METERS;=======================================; Display the clock background and title bar.;=======================================; The first shape is the background rectangle with rounded corners, the second; shape is the title bar with rounded corners, and the third shape is a square-; cornered rectangle to cover the title bar's bottom rounded corners.[mtrClockBackground]Meter=ShapeMeasureName=msrIPAPIipMeasureName2=msrIPAPIcityMeasureName3=msrIPAPIregionMeasureName4=msrIPAPIregion_codeMeasureName5=msrIPAPIcountryMeasureName6=msrIPAPIcountry_codeMeasureName7=msrIPAPIlatitudeMeasureName8=msrIPAPIlongitudeMeasureName9=msrIPAPItimezoneMeasureName10=msrIPAPIutc_offsetMeasureName11=msrTZStandardNameShape=Rectangle 0,0,#skinWidth#,#skinHeight#,#q3cornerRoundness# | StrokeWidth #skinBorder# | Stroke Color #q3clrBorder# | Fill Color #q3clrBackground#Shape2=Rectangle 0,0,#skinWidth#,#q3titlebarHeight#,#q3cornerRoundness# | StrokeWidth #skinBorder# | Stroke Color #q3clrTitleBar# | Fill Color #q3clrTitleBar#Shape3=Rectangle 0,(#q3titlebarHeight#-#q3titleCoverHeight#),#skinWidth#,#q3titleCoverHeight# | StrokeWidth #skinBorder# | Stroke Color #q3clrBorder# | Fill Color #q3clrTitleBar#DynamicVariables=1AntiAlias=1X=0Y=0W=#skinWidth#H=#skinHeight#ToolTipType=#QtipType#ToolTipText="%2, %4, %5#CRLF#Latitude:     %7#CRLF#longitude:  %8#CRLF#%9 (%10)#CRLF#%11#CRLF#IP:  %1"; Display the clock title.;---------------------------------------[mtrClockTitle]Meter=StringMeterStyle=styleHeaderMeasureName=msrTimeDayDate12ClipString=1X=#skinCenterX#Y=#q3titlebarCenterY#W=#skinWidth#H=#q3titlebarHeight#InlineSetting=Case | LowerInlinePattern=AM|PMText="%1"; Display the clock body.;---------------------------------------[mtrClockBody]Meter=StringMeterStyle=styleHeaderMeasureName=msrTimeDate24MeasureName2=msrGEOtimezoneSTDabbrevMeasureName3=msrIPAPIutc_offsetDynamicVariables=1ClipString=1X=#skinCenterX#Y=0RW=#skinWidth#H=#q3titlebarHeight#Text="%1 %2 (%3)"
This is just a work in progress, but you should be able to run it. Feel free to comment on any improvements or otherwise.

Statistics: Posted by qwerky — Yesterday, 11:17 pm



Viewing all articles
Browse latest Browse all 1590

Trending Articles