# 【Weather】Rainmeter国内天气代码详解 - Rainmeter技术教程 - 雨滴社区 - Powered by Discuz!
 找回密码
 点击注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 58373|回复: 56

[菜鸟教程] 【Weather】Rainmeter国内天气代码详解

  [复制链接]

签到天数: 208 天

[LV.7]常住居民III

发表于 2013-3-26 13:44:57 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?点击注册

x
本帖最后由 pyrogas 于 2013-7-1 01:07 编辑

以自己的illustro皮肤为例  (link:http://bbs.rainmeter.cn/thread-55131-1-1.html )
另外一款Companion套装同样是用这个代码的
这个皮肤的特点就是可以根据时间自动切换白天和夜晚模式,图标和温度都会切换。图标切换是必然的,至于温度,国内的天气网站会在夜晚把白天的最高温删除,如果不作出调整,那么插件预报的明日气温其实是,今日最低温和明日最高温,以此类推后天的气温也不准切了。很多天气皮肤都存在这个问题,所以自己写了一个。2013/6/30更新,重写。

  1. [Rainmeter]
  2. Author=Papa
  3. e-mail:[email protected]
  4. Update=1000

  5. [Variables]
  6. WeatherCodeLocation=101210101
  7. WeatherUnit=m

  8. Day=[!ShowmeterGroup Day][!HideMeterGroup Night]  \\\\ 依旧定义白天隐藏什么组,夜晚显示什么组
  9. Night=[!HidemeterGroup Day][!ShowMeterGroup Night]

  10. [TXT]
  11. Fontface=微软雅黑    \\\\\\\\\\\\\定义字体、大小、颜色,可以直接引用减少代码行
  12. FontColor=255,255,255,180
  13. FontSize=7
  14. StringAlign=RIGHT
  15. StringStyle=BOLD
  16. Antialias=1

  17. ;==================================================BG

  18. [meterBackground]    \\\\\\\\\\\\\\\\设置背景
  19. Meter=IMAGE              \\\\\\\\\\\\\\\\\\Meter为图片
  20. ImageName=BackgroundAnalog.png          \\\\\\\\\\\\\\图片地址
  21. X=0
  22. Y=0

  23. ;=========================================================Weather RSS

  24. [MeasureWeatherRSS]
  25. Measure=Plugin
  26. Plugin=Plugins\WebParser.dll
  27. UpdateRate=600
  28. URL=http://m.weather.com.cn/data//#WeatherCodeLocation#.html
  29. cc=*&unit=#WeatherUnit#&dayf=6
  30. RegExp="{"weatherinfo":{"city":"(.*)","city_en":"(.*)","date_y":"(.*)","date":"(.*)","week":"(.*)","fchh":"(.*)","cityid":"(.*)","temp1":"(.*)℃~(.*)℃","temp2":"(.*)℃~(.*)℃","temp3":"(.*)℃~(.*)℃","temp4":"(.*)℃~(.*)℃","temp5":"(.*)℃~(.*)℃","temp6":"(.*)~(.*)","tempF1":"(.*)","tempF2":"(.*)","tempF3":"(.*)","tempF4":"(.*)","tempF5":"(.*)","tempF6":"(.*)","weather1":"(.*)","weather2":"(.*)","weather3":"(.*)","weather4":"(.*)","weather5":"(.*)","weather6":"(.*)","img1":"(.*)","img2":"(.*)","img3":"(.*)","img4":"(.*)","img5":"(.*)","img6":"(.*)","img7":"(.*)","img8":"(.*)","img9":"(.*)","img10":"(.*)","img11":"(.*)","img12":"(.*)","img_single":"(.*)","img_title1":"(.*)","img_title2":"(.*)","img_title3":"(.*)","img_title4":"(.*)","img_title5":"(.*)","img_title6":"(.*)","img_title7":"(.*)","img_title8":"(.*)","img_title9":"(.*)","img_title10":"(.*)","img_title11":"(.*)","img_title12":"(.*)","img_title_single":"(.*)","wind1":"(.*)","wind2":"(.*)","wind3":"(.*)","wind4":"(.*)","wind5":"(.*)","wind6":"(.*)","fx1":"(.*)","fx2":"(.*)","fl1":"(.*)","fl2":"(.*)","fl3":"(.*)","fl4":"(.*)","fl5":"(.*)","fl6":"(.*)","index":"(.*)","index_d":"(.*)","index48":"(.*)","index48_d":"(.*)","index_uv":"(.*)","index48_uv":"(.*)","index_xc":"(.*)","index_tr":"(.*)","index_co":"(.*)","st1":"(.*)","st2":"(.*)","st3":"(.*)","st4":"(.*)","st5":"(.*)","st6":"(.*)","index_cl":"(.*)","index_ls":"(.*)"}}"   \\\\\\\\\\设定取值格式

  31. ;=====================================================Now Temp

  32. [MeasureWeatherNOW]
  33. Measure=Plugin
  34. Plugin=Plugins\WebParser.dll
  35. UpdateRate=1800
  36. Url=http://www.weather.com.cn/data/sk//#WeatherCodeLocation#.html
  37. RegExp="{"weatherinfo":{"city":"(.*)","cityid":"(.*)","temp":"(.*)","WD":"(.*)","WS":"(.*)","SD":"(.*)","WSE":"(.*)","time":"(.*)","isRadar":"(.*)","Radar":"(.*)"}}"
  38. StringIndex=1
  39. ;=================================================Now

  40. [MeasureWeatherTemp]
  41. Measure=Plugin
  42. Plugin=Plugins\WebParser.dll
  43. Url=[MeasureWeatherNOW]
  44. StringIndex=3    \\\\\\\\\\\\\\\\\取格式中第3个  (.*)代替的数值。

  45. [MeasureWeatherDesc]
  46. Measure=Plugin
  47. Plugin=Plugins\WebParser.dll
  48. Url=[MeasureWeatherRSS]
  49. StringIndex=26  \\\\\\\\\\\\\\\\\取格式中第26个  (.*)代替的数值。

  50. [MeasureWeatherIcon]
  51. Measure=Plugin
  52. Plugin=Plugins\WebParser.dll
  53. Url=[MeasureWeatherRSS]
  54. StringIndex=32

  55. ;==================================================Now Day

  56. [MeterIconD]  \\\\  白天天气图标
  57. Group=Day    \\\\\\\\对不同内容进行分组
  58. MeasureName=MeasureWeatherIcon    \\\\\\\\\\\\\\\\\\\获取[MeasureWeatherIcon]数值
  59. Meter=IMAGE
  60. Path=#CurrentPATH#/Day/                      \\\\\\\\\\\\\\\\\\\\\\输出Day文件夹下的天气图标
  61. X=15
  62. Y=13
  63. W=40
  64. H=40

  65. [MeterIconN]
  66. Group=Night
  67. MeasureName=MeasureWeatherIcon
  68. Meter=IMAGE
  69. Path=#CurrentPATH#/Night/
  70. X=15
  71. Y=13
  72. W=40
  73. H=40

  74. [MeterTemp]
  75. MeasureName=MeasureWeatherTemp
  76. Meter=STRING
  77. X=200
  78. Y=10
  79. FontColor=255,255,255,205
  80. FontSize=12
  81. StringAlign=RIGHT
  82. StringStyle=BOLD
  83. FontFace=微软雅黑
  84. Antialias=1
  85. Postfix="°"

  86. [MeterDesc]
  87. MeasureName=MeasureWeatherDesc
  88. Meter=STRING
  89. X=100
  90. Y=14
  91. W=100
  92. FontColor=255,255,255,205
  93. FontSize=8
  94. StringAlign=RIGHT
  95. StringStyle=BOLD
  96. FontFace=微软雅黑
  97. Antialias=1

  98. ;=================================================Temp
  99. --------------------------------Day
  100. [MeasureWeatherTempD1]
  101. Measure=Plugin
  102. Plugin=Plugins\WebParser.dll
  103. Url=[MeasureWeatherRSS]
  104. StringIndex=8

  105. [MeasureWeatherTempD2]
  106. Measure=Plugin
  107. Plugin=Plugins\WebParser.dll
  108. Url=[MeasureWeatherRSS]
  109. StringIndex=9

  110. [MeasureWeatherTempD3]
  111. Measure=Plugin
  112. Plugin=Plugins\WebParser.dll
  113. Url=[MeasureWeatherRSS]
  114. StringIndex=10

  115. [MeasureWeatherTempD4]
  116. Measure=Plugin
  117. Plugin=Plugins\WebParser.dll
  118. Url=[MeasureWeatherRSS]
  119. StringIndex=11

  120. [MeasureWeatherTempD5]
  121. Measure=Plugin
  122. Plugin=Plugins\WebParser.dll
  123. Url=[MeasureWeatherRSS]
  124. StringIndex=12

  125. [MeasureWeatherTempD6]
  126. Measure=Plugin
  127. Plugin=Plugins\WebParser.dll
  128. Url=[MeasureWeatherRSS]
  129. StringIndex=13

  130. ;--------------------------------Night
  131. [MeasureWeatherTempN1]
  132. Measure=Plugin
  133. Plugin=Plugins\WebParser.dll
  134. Url=[MeasureWeatherRSS]
  135. StringIndex=9

  136. [MeasureWeatherTempN2]
  137. Measure=Plugin
  138. Plugin=Plugins\WebParser.dll
  139. Url=[MeasureWeatherRSS]
  140. StringIndex=10

  141. [MeasureWeatherTempN3]
  142. Measure=Plugin
  143. Plugin=Plugins\WebParser.dll
  144. Url=[MeasureWeatherRSS]
  145. StringIndex=11

  146. [MeasureWeatherTempN4]
  147. Measure=Plugin
  148. Plugin=Plugins\WebParser.dll
  149. Url=[MeasureWeatherRSS]
  150. StringIndex=12

  151. [MeasureWeatherTempN5]
  152. Measure=Plugin
  153. Plugin=Plugins\WebParser.dll
  154. Url=[MeasureWeatherRSS]
  155. StringIndex=13

  156. [MeasureWeatherTempN6]
  157. Measure=Plugin
  158. Plugin=Plugins\WebParser.dll
  159. Url=[MeasureWeatherRSS]
  160. StringIndex=14

  161. ;================================================Icons
  162. 这里需要说明一下,在Weather D&N中有这样一段代码:Substitute="99":[MeasureWeatherIconN1]    因为在网页数据中,99代表晚上天气图标与白天天气图标相同,所以需要把夜晚时候的99替换为白天数据。

  163. [MeasureWeatherIcon1]
  164. Measure=Plugin
  165. Plugin=Plugins\WebParser.dll
  166. Url=[MeasureWeatherRSS]
  167. StringIndex=32

  168. ;-------------------------
  169. [MeasureWeatherIcon2]
  170. Measure=Plugin
  171. Plugin=Plugins\WebParser.dll
  172. Url=[MeasureWeatherRSS]
  173. StringIndex=34

  174. ;-------------------------
  175. [MeasureWeatherIcon3]
  176. Measure=Plugin
  177. Plugin=Plugins\WebParser.dll
  178. Url=[MeasureWeatherRSS]
  179. StringIndex=36



  180. ;==================================================================ICON
  181. [MeterIconD1]
  182. Group=Day
  183. MeasureName=MeasureWeatherIcon1
  184. Meter=IMAGE
  185. Path=#CurrentPATH#/Day/
  186. X=70
  187. Y=37
  188. H=20
  189. W=20

  190. [MeterIconD2]
  191. Group=Day
  192. MeasureName=MeasureWeatherIcon2
  193. Meter=IMAGE
  194. Path=#CurrentPATH#/Day/
  195. X=25R
  196. Y=37
  197. H=20
  198. W=20

  199. [MeterIconD3]
  200. Group=Day
  201. MeasureName=MeasureWeatherIcon3
  202. Meter=IMAGE
  203. Path=#CurrentPATH#/Day/
  204. X=25R
  205. Y=37
  206. H=20
  207. W=20
  208. --------------------------------------
  209. [MeterIconN1]
  210. Group=Night
  211. MeasureName=MeasureWeatherIcon1
  212. Meter=IMAGE
  213. Path=#CurrentPATH#/Night/
  214. X=70
  215. Y=37
  216. H=20
  217. W=20

  218. [MeterIconN2]
  219. Group=Night
  220. MeasureName=MeasureWeatherIcon2
  221. Meter=IMAGE
  222. Path=#CurrentPATH#/Night/
  223. X=25R
  224. Y=37
  225. H=20
  226. W=20

  227. [MeterIconN3]
  228. Group=Night
  229. MeasureName=MeasureWeatherIcon3
  230. Meter=IMAGE
  231. Path=#CurrentPATH#/Night/
  232. X=25R
  233. Y=37
  234. H=20
  235. W=20

  236. ;==============================================DayTemp

  237. [MeterTempD1]
  238. Group=Day
  239. MeasureName=MeasureWeatherTempD1
  240. Meter=STRING
  241. MeterStyle=TXT
  242. X=115
  243. Y=35
  244. Postfix="°"

  245. [MeterTempD2]
  246. Group=Day
  247. MeasureName=MeasureWeatherTempD2
  248. Meter=STRING
  249. MeterStyle=TXT
  250. X=115
  251. Y=-2R
  252. Postfix="°"

  253. [MeterTempD3]
  254. Group=Day
  255. MeasureName=MeasureWeatherTempD3
  256. Meter=STRING
  257. MeterStyle=TXT
  258. X=157
  259. Y=35
  260. Postfix="°"

  261. [MeterTempD4]
  262. Group=Day
  263. MeasureName=MeasureWeatherTempD4
  264. Meter=STRING
  265. MeterStyle=TXT
  266. X=157
  267. Y=-2R
  268. Postfix="°"

  269. [MeterTempD5]
  270. Group=Day
  271. MeasureName=MeasureWeatherTempD5
  272. Meter=STRING
  273. MeterStyle=TXT
  274. X=199
  275. Y=35
  276. Postfix="°"

  277. [MeterTempD6]
  278. Group=Day
  279. MeasureName=MeasureWeatherTempD6
  280. Meter=STRING
  281. MeterStyle=TXT
  282. X=199
  283. Y=-2R
  284. Postfix="°"
  285. ;==============================================NightTemp

  286. [MeterTempN1]
  287. Group=Night
  288. MeasureName=MeasureWeatherTempN1
  289. Meter=STRING
  290. MeterStyle=TXT
  291. X=115
  292. Y=35
  293. Postfix="°"

  294. [MeterTempN2]
  295. Group=Night
  296. MeasureName=MeasureWeatherTempN2
  297. Meter=STRING
  298. MeterStyle=TXT
  299. X=115
  300. Y=-2R
  301. Postfix="°"

  302. [MeterTempN3]
  303. Group=Night
  304. MeasureName=MeasureWeatherTempN3
  305. Meter=STRING
  306. MeterStyle=TXT
  307. X=157
  308. Y=35
  309. Postfix="°"

  310. [MeterTempN4]
  311. Group=Night
  312. MeasureName=MeasureWeatherTempN4
  313. Meter=STRING
  314. MeterStyle=TXT
  315. X=157
  316. Y=-2R
  317. Postfix="°"

  318. [MeterTempN5]
  319. Group=Night
  320. MeasureName=MeasureWeatherTempN5
  321. Meter=STRING
  322. MeterStyle=TXT
  323. X=199
  324. Y=35
  325. Postfix="°"

  326. [MeterTempN6]
  327. Group=Night
  328. MeasureName=MeasureWeatherTempN6
  329. Meter=STRING
  330. MeterStyle=TXT
  331. X=199
  332. Y=-2R
  333. Postfix="°"
  334. ;=============================================Shift

  335. [MeasureH]
  336. Measure=Time
  337. Format=%H

  338. [DayOrNight]
  339. Measure=Calc
  340. DynamicVariables=1
  341. Formula=[MeasureH]>5 ? ([MeasureH]<18 ? 0 : 1 ) : 1              \\\\\\\\\ 判断当前时间是否在 5~18之间,是输出0,否输出1

  342. [MeasureTime0]                  \\\\\\\\\\\\\\当SUNORNIGHT=1时显示Night组
  343. Measure=Calc
  344. Formula=DayOrNight
  345. IfEqualValue=1
  346. IfEqualAction=!execute #Night#[!RainmeterRedraw]

  347. [MeasureTime1]                   \\\\\\\\\\\\\\当SUNORNIGHT=0时显示Day组
  348. Measure=Calc
  349. Formula=DayOrNight
  350. IfEqualValue=0
  351. IfEqualAction=!execute #Day#[!RainmeterRedraw]
复制代码

评分

参与人数 2心动值 +2 活跃值 +20 技术值 +2 收起 理由
zhujiakai1030 + 1 + 10 + 1 以报我插楼之罪..主要是你给力哈哈
萝莉头 + 1 + 10 + 1 鲶鱼好久不见,依旧给力

查看全部评分

回复

使用道具 举报

签到天数: 208 天

[LV.7]常住居民III

 楼主| 发表于 2013-3-26 13:52:11 | 显示全部楼层
本帖最后由 pyrogas 于 2013-7-1 00:07 编辑
  1. ~~
复制代码
回复

使用道具 举报

签到天数: 208 天

[LV.7]常住居民III

 楼主| 发表于 2013-3-26 13:53:10 | 显示全部楼层
回复

使用道具 举报

签到天数: 270 天

[LV.8]以坛为家I

发表于 2013-3-26 13:54:41 | 显示全部楼层
咱也来支持下,教程贴哇~
回复

使用道具 举报

签到天数: 208 天

[LV.7]常住居民III

 楼主| 发表于 2013-3-26 13:58:53 | 显示全部楼层
hvzone 发表于 2013-3-26 13:54
咱也来支持下,教程贴哇~

为了发这个贴,把我的活跃值都换完了……好不容易才到高级会员……
回复

使用道具 举报

签到天数: 118 天

[LV.6]常住居民II

发表于 2013-3-26 14:05:03 | 显示全部楼层
鲇鱼,评分里我错字了,见谅

许久不见,来个基情的拥抱?
回复

使用道具 举报

签到天数: 208 天

[LV.7]常住居民III

 楼主| 发表于 2013-3-26 14:14:25 | 显示全部楼层
萝莉头 发表于 2013-3-26 14:05
鲇鱼,评分里我错字了,见谅

许久不见,来个基情的拥抱?

来一个
回复

使用道具 举报

mxmenghuan130 该用户已被删除
发表于 2013-3-26 18:05:13 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

签到天数: 291 天

[LV.8]以坛为家I

发表于 2013-3-26 18:42:25 | 显示全部楼层
又是一个技术男吗?
回复

使用道具 举报

签到天数: 1258 天

[LV.10]以坛为家III

发表于 2013-3-26 18:48:29 | 显示全部楼层
很不错,前排支持下。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点击注册

本版积分规则

快速回复 返回顶部 返回列表