# 转载:Illustro天气修改 - Rainmeter技术教程 - 雨滴社区 - Powered by Discuz!
 找回密码
 点击注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 27613|回复: 89

[技术交流] 转载:Illustro天气修改

  [复制链接]

签到天数: 118 天

[LV.6]常住居民II

发表于 2011-12-30 04:12:25 | 显示全部楼层 |阅读模式

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

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

x
先声明一下,此文章转载自论坛Pyrogas的博客。
一个非常详细的国内天气讲解,转载来跟大家分享一下,有兴趣的朋友不妨看看
在此也谢谢Pyrogas!辛苦了!


以下正文:

很久以前,从网上找了一个Illustro主题的天气皮肤。
可能是外国人做的,用的是外国的天气网站,所以很多国内的城市都没有代码,自然也不能显示天气。所以论坛上有人要我做一个国内的,好吧。
以前我一直搞不明白Rainmeter怎么调用天气图标,我在代码里面找了很久也没有找到类似的语句,好吧,小白了。后来发现根本不是Rainmeter调用,而是RSS天气网站的的时候,网站已经写好了的。(害我白费了很多脑细胞啊!)
但是国内的中国天气网的天气数据十分的蛋疼,外国网站是最高温度,最低温度分开的,而国内网站是**℃~**℃。
例如晚上RSS显示的是"temp1":"16℃~20℃","temp2":"13℃~17℃","temp3":"12℃~18℃"
但是到了第二天白天,RSS显示"temp1":"20℃~13℃","temp2":"17℃~12℃","temp3":”18℃~14℃"
Temp后面的数字不是按照固定格式的,而是按照先后顺序出来。所以有两个格式。自然需要重新组合、排列。
并且能自动切换当时的天气状况图标。

经过改进,可以说和原版完全不一样了,添加了至少一倍的代码,并且引用格式也换了,并且改进显示界面。以前只能显示未来三天白天的天气状况,现在能显示未来三天白天和晚上的天气状况。

先说一下,大致思路:
1.        先用Time插件抓取时间,显示小时%H
2.        判断%H和18大小,小于18套用白天格式显示白天数据,大于等于18套用晚上格式,并且显示晚上数据。

本来这里是想抓取网站上的日落时间,然后对比日落时间和计算机时间来进行判断,但是找了半天找不到那句代码。所以可能会添加一个计算公式,但是在这里并没有添加,而是大致取了晚上18点为切换点。

虽然只有简单的2步,但是那些代码看得我眼都花了。
接下来上代码:

===========================================================================
  1. [Rainmeter]         -----------无关紧要的一段,主要介绍作者,设置刷新时间、背景模式
  2. Author=Papa
  3. e-mail:[email protected]
  4. Update=1000         -----------刷新时间,1000秒
  5. BackgroundMode=1
  6. MouseActionCursor=0
  7. MiddleMouseDownAction=!RainmeterDeactivateConfig    ----------鼠标中键点击关闭皮肤。

  8. [Metadata]         -----------介绍皮肤名字、版本号
  9. Name=area weather
  10. Config=area weather white
  11. Description=shows weather
  12. Version=2.1.0
  13. License=PAPA share

  14. [Variables]         -----------总结性的规定一下字体或者别的什么,这里只规定了字体
  15. WeatherCodeLocation=101210101         -----------城市代码,这是杭州的代码,可换
  16. WeatherUnit=m
  17. Font=Century Gothic

  18. ;=========================================================Hide OR Show

  19. ;Day         -----------规定在白天,即18点以前显示哪些项目,隐藏哪些
  20. !RainmeterHideMeter 即为隐藏   中间为Show即为显示
  21. Hide1=[!RainmeterHideMeter MeterTemp1_N][!RainmeterHideMeter MeterTemp2_N][!RainmeterHideMeter MeterTemp2_1_N][!RainmeterHideMeter MeterTemp3_N][!RainmeterHideMeter MeterTemp3_1_N][!RainmeterHideMeter MeterTemp4_N][!RainmeterHideMeter MeterIcon_N][!RainmeterHideMeter MeterIcon1_D][!RainmeterHideMeter MeterIcon2_D][!RainmeterHideMeter MeterIcon3_D][!RainmeterHideMeter MeterIcon1_N][!RainmeterHideMeter MeterIcon2_N][!RainmeterHideMeter MeterIcon3_N]
  22. Show1=[!RainmeterShowMeter MeterTemp1_D][!RainmeterShowMeter MeterTemp2_D][!RainmeterShowMeter MeterTemp3_D][!RainmeterShowMeter MeterTemp1_1_D][!RainmeterShowMeter MeterTemp2_1_D][!RainmeterShowMeter MeterTemp3_1_D][!RainmeterShowMeter MeterIcon][!RainmeterShowMeter MeterIcon1_1_D][!RainmeterShowMeter MeterIcon2_1_D][!RainmeterShowMeter MeterIcon3_1_D][!RainmeterShowMeter MeterIcon1_1_N][!RainmeterShowMeter MeterIcon2_1_N][!RainmeterShowMeter MeterIcon3_1_N]

  23. ;Night         -----------规定在晚上,即18点以后显示哪些项目,隐藏哪些
  24. Hide2=[!RainmeterHideMeter MeterTemp1_D][!RainmeterHideMeter MeterTemp2_D][!RainmeterHideMeter MeterTemp3_D][!RainmeterHideMeter MeterTemp1_1_D][!RainmeterHideMeter MeterTemp2_1_D][!RainmeterHideMeter MeterTemp3_1_D][!RainmeterHideMeter MeterIcon][!RainmeterHideMeter MeterIcon1_1_D][!RainmeterHideMeter MeterIcon2_1_D][!RainmeterHideMeter MeterIcon3_1_D][!RainmeterHideMeter MeterIcon1_1_N][!RainmeterHideMeter MeterIcon2_1_N][!RainmeterHideMeter MeterIcon3_1_N]
  25. Show2=[!RainmeterShowMeter MeterTemp1_N][!RainmeterShowMeter MeterTemp2_N][!RainmeterShowMeter MeterTemp2_1_N][!RainmeterShowMeter MeterTemp3_N][!RainmeterShowMeter MeterTemp3_1_N][!RainmeterShowMeter MeterTemp4_N][!RainmeterShowMeter MeterIcon_N][!RainmeterShowMeter MeterIcon1_D][!RainmeterShowMeter MeterIcon2_D][!RainmeterShowMeter MeterIcon3_D][!RainmeterShowMeter MeterIcon1_N][!RainmeterShowMeter MeterIcon2_N][!RainmeterShowMeter MeterIcon3_N]

  26. ;=========================================================Weather RSS
  27. [MeasureWeatherRSS] ----------开始调用RSS插件,后台访问天气网站获取数据
  28. Measure=Plugin         ----------调用=插件
  29. Plugin=Plugins\WebParser.dll         ----------插件地址
  30. UpdateRate=600         ----------更新时间600秒,这里和上面的不一样,这是访问网站,上面的是刷新
  31. URL=http://m.weather.com.cn/data//#WeatherCodeLocation#.html
  32. ----------获取数据的地址,##中间是调用上面代码
  33. cc=*&unit=#WeatherUnit#&dayf=6
  34. 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":"(.*)"}}"
  35. ----------网站上面对数据格式,(.*)意思为变量,也是我们需要的
  36. StringIndex=1         ----------获取第一个(.*)数据
  37. IfAboveValue=1         ----------如果大于1,便执行下面命令
  38. IfAboveAction=!execute [!RainmeterHideMeter MeterIconNA][!RainmeterShowMeter MeterIcon]

  39. ;=====================================================Now Temp

  40. [MeasureWeatherNOW]  ----------为了显示当前温度,上面的格式中没有当前温度
  41. Measure=Plugin
  42. Plugin=Plugins\WebParser.dll
  43. UpdateRate=1800
  44. Url=http://www.weather.com.cn/data/sk//#WeatherCodeLocation#.html
  45. RegExp="{"weatherinfo":{"city":"(.*)","cityid":"(.*)","temp":"(.*)","WD":"(.*)","WS":"(.*)","SD":"(.*)","WSE":"(.*)","time":"(.*)","isRadar":"(.*)","Radar":"(.*)"}}"
  46. StringIndex=1

  47. ;=======================================================Temp
  48. ;--------------------------------Day         ----------白天温度显示

  49. [MeasureWeatherTemp1_D]
  50. Measure=Plugin
  51. Plugin=Plugins\WebParser.dll
  52. Url=[MeasureWeatherRSS]
  53. StringIndex=8  
  54. Substitute="℃":"","~":"°#CRLF#"
  55. ----------将第八个(.*)中的数据替换,也就是tamp后面的温度替换
  56. [MeasureWeatherTemp1_1_D]
  57. Measure=Plugin
  58. Plugin=Plugins\WebParser.dll
  59. Url=[MeasureWeatherRSS]
  60. StringIndex=8  
  61. Substitute="℃":"","~":"                                                       "

  62. [MeasureWeatherTemp2_D]
  63. Measure=Plugin
  64. Plugin=Plugins\WebParser.dll
  65. Url=[MeasureWeatherRSS]
  66. StringIndex=9
  67. Substitute="℃":"","~":"°#CRLF#"

  68. [MeasureWeatherTemp2_1_D]
  69. Measure=Plugin
  70. Plugin=Plugins\WebParser.dll
  71. Url=[MeasureWeatherRSS]
  72. StringIndex=9  
  73. Substitute="℃":"","~":"                                                       "

  74. [MeasureWeatherTemp3_D]
  75. Measure=Plugin
  76. Plugin=Plugins\WebParser.dll
  77. Url=[MeasureWeatherRSS]
  78. StringIndex=10
  79. Substitute="℃":"","~":"°#CRLF#"

  80. [MeasureWeatherTemp3_1_D]
  81. Measure=Plugin
  82. Plugin=Plugins\WebParser.dll
  83. Url=[MeasureWeatherRSS]
  84. StringIndex=10  
  85. Substitute="℃":"","~":"                                                                                           "

  86. ;--------------------------------Night
  87. [MeasureWeatherTemp1_N]
  88. Measure=Plugin
  89. Plugin=Plugins\WebParser.dll
  90. Url=[MeasureWeatherRSS]
  91. StringIndex=8  
  92. Substitute="℃":"","~":"                                                                                          "

  93. [MeasureWeatherTemp2_N]
  94. Measure=Plugin
  95. Plugin=Plugins\WebParser.dll
  96. Url=[MeasureWeatherRSS]
  97. StringIndex=9
  98. Substitute="℃":"","~":"°#CRLF##CRLF##CRLF##CRLF##CRLF#"

  99. [MeasureWeatherTemp2_1_N]
  100. Measure=Plugin
  101. Plugin=Plugins\WebParser.dll
  102. Url=[MeasureWeatherRSS]
  103. StringIndex=9
  104. Substitute="℃":"","~":"                                                                                           "

  105. [MeasureWeatherTemp3_N]
  106. Measure=Plugin
  107. Plugin=Plugins\WebParser.dll
  108. Url=[MeasureWeatherRSS]
  109. StringIndex=10
  110. Substitute="℃":"","~":"°#CRLF##CRLF##CRLF##CRLF##CRLF#"

  111. [MeasureWeatherTemp3_1_N]
  112. Measure=Plugin
  113. Plugin=Plugins\WebParser.dll
  114. Url=[MeasureWeatherRSS]
  115. StringIndex=10
  116. Substitute="℃":"","~":"                                                                                           "

  117. [MeasureWeatherTemp4_N]
  118. Measure=Plugin
  119. Plugin=Plugins\WebParser.dll
  120. Url=[MeasureWeatherRSS]
  121. StringIndex=11
  122. Substitute="℃":"","~":"°#CRLF##CRLF##CRLF##CRLF##CRLF#"

  123. ----------这里替换的思路是这样的,原本抓取的数据只是**~**,并不能隔行显示,而且太长容易造成字体重叠。所以将℃替换成为空格,将~替换成强制换行的代码,使其换行,后来考虑调整字体问题,就使用空格和#CRLF#组合方式换行。然后考虑到晚上会显示晚上最低温,觉得没用于是将~替换为一串空格,并且设置右对齐,使前面没用的数据溢出皮肤显示界面,然后调用两次第二天气温,设置显示长度,又将后半段舍去,放在第一个温度下面,然后在引用一次,舍去前一半数据,以此类推。
  124. ;=================================================Now

  125. [MeasureWeatherTemp]
  126. Measure=Plugin
  127. Plugin=Plugins\WebParser.dll
  128. Url=[MeasureWeatherNOW]
  129. StringIndex=3

  130. [MeasureWeatherDesc]
  131. Measure=Plugin
  132. Plugin=Plugins\WebParser.dll
  133. Url=[MeasureWeatherRSS]
  134. StringIndex=20

  135. [MeasureWeatherIcon]
  136. Measure=Plugin
  137. Plugin=Plugins\WebParser.dll
  138. Url=[MeasureWeatherRSS]
  139. StringIndex=26

  140. ;==================================================DayIcon
  141. ----------开始设置天气状况图标

  142. [MeasureWeatherIcon1_1_D]
  143. Measure=Plugin
  144. Plugin=Plugins\WebParser.dll
  145. Url=[MeasureWeatherRSS]
  146. StringIndex=26
  147. ;-------------------------
  148. [MeasureWeatherIcon2_1_D]
  149. Measure=Plugin
  150. Plugin=Plugins\WebParser.dll
  151. Url=[MeasureWeatherRSS]
  152. StringIndex=28
  153. ;-------------------------
  154. [MeasureWeatherIcon3_1_D]
  155. Measure=Plugin
  156. Plugin=Plugins\WebParser.dll
  157. Url=[MeasureWeatherRSS]
  158. StringIndex=30

  159. [MeasureWeatherIcon1_1_N]
  160. Measure=Plugin
  161. Plugin=Plugins\WebParser.dll
  162. Url=[MeasureWeatherRSS]
  163. StringIndex=27
  164. ;-------------------------
  165. [MeasureWeatherIcon2_1_N]
  166. Measure=Plugin
  167. Plugin=Plugins\WebParser.dll
  168. Url=[MeasureWeatherRSS]
  169. StringIndex=29
  170. ;-------------------------
  171. [MeasureWeatherIcon3_1_N]
  172. Measure=Plugin
  173. Plugin=Plugins\WebParser.dll
  174. Url=[MeasureWeatherRSS]
  175. StringIndex=31
  176. ----------这里的思路是因为白天和晚上的温度会变,所以图标也会跟着变,所以势必要同步显示。所以一次要引用6个温度。
  177. ;==================================================NightIcon

  178. [MeasureWeatherIcon1_D]
  179. Measure=Plugin
  180. Plugin=Plugins\WebParser.dll
  181. Url=[MeasureWeatherRSS]
  182. StringIndex=27
  183. ;-------------------------
  184. [MeasureWeatherIcon2_D]
  185. Measure=Plugin
  186. Plugin=Plugins\WebParser.dll
  187. Url=[MeasureWeatherRSS]
  188. StringIndex=29
  189. ;-------------------------
  190. [MeasureWeatherIcon3_D]
  191. Measure=Plugin
  192. Plugin=Plugins\WebParser.dll
  193. Url=[MeasureWeatherRSS]
  194. StringIndex=31

  195. [MeasureWeatherIcon1_N]
  196. Measure=Plugin
  197. Plugin=Plugins\WebParser.dll
  198. Url=[MeasureWeatherRSS]
  199. StringIndex=28
  200. ;-------------------------
  201. [MeasureWeatherIcon2_N]
  202. Measure=Plugin
  203. Plugin=Plugins\WebParser.dll
  204. Url=[MeasureWeatherRSS]
  205. StringIndex=30
  206. ;-------------------------
  207. [MeasureWeatherIcon3_N]
  208. Measure=Plugin
  209. Plugin=Plugins\WebParser.dll
  210. Url=[MeasureWeatherRSS]
  211. StringIndex=32

  212. ;==================================================BG
  213. ----------设置背景图片
  214. [meterBackground]
  215. Meter=IMAGE
  216. ImageName=BackgroundAnalog.png
  217. X=0
  218. Y=0

  219. ;==================================================Now Day
  220. ----------白天时候的当前温度和天气状况设置
  221. [MeterTemp]
  222. MeasureName=MeasureWeatherTemp         ----------引用上文MeasureWeatherTemp
  223. Meter=STRING
  224. X=100
  225. Y=10
  226. FontColor=255,255,255,205         ----------字体颜色
  227. FontSize=12         ----------字体大小
  228. StringAlign=RIGHT         ----------对齐方式=右
  229. StringStyle=NORMAL         ----------字体显示:常规
  230. FontFace=#Font#         ----------字体,文章最开始定义的
  231. Antialias=1         ----------字体平滑处理=1=Ture   若0即为False
  232. Postfix="°"         ----------输出数字后追加  °

  233. [MeterDesc]         ----------天气状况设置
  234. MeasureName=MeasureWeatherDesc
  235. Meter=STRING
  236. X=200
  237. Y=14
  238. FontColor=255,255,255,205
  239. FontSize=8
  240. StringAlign=RIGHT
  241. StringStyle=Normal
  242. FontFace=微软雅黑
  243. Antialias=1

  244. [MeterIcon]         ----------天气图标设置
  245. MeasureName=MeasureWeatherIcon
  246. Meter=IMAGE
  247. Path=#CurrentPATH#/Day/         ----------图标位置
  248. X=15
  249. Y=20
  250. W=50
  251. H=50         ----------位置,宽高

  252. ;==================================================Now Night

  253. [MeterIcon_N]
  254. MeasureName=MeasureWeatherIcon
  255. Meter=IMAGE
  256. Path=#CurrentPATH#/Night/         ----------因为这里需要白天晚上图标不一样,所以分存两个文件夹
  257. X=15
  258. Y=20
  259. W=50
  260. H=50
  261. ;==================================================================Day

  262. [MeterTemp1_D]         ----------明天温度显示
  263. MeasureName=MeasureWeatherTemp1_D
  264. Meter=STRING
  265. X=115
  266. Y=37
  267. W=26
  268. H=15
  269. FontColor=255,255,255,180
  270. FontSize=10
  271. StringAlign=RIGHT
  272. StringStyle=NORMAL
  273. FontFace=#Font#
  274. Antialias=1
  275. Postfix="°"
  276. ClipString=1

  277. [MeterIcon1_1_D]         ----------明天白天天气状况
  278. MeasureName=MeasureWeatherIcon1_1_D
  279. Meter=IMAGE
  280. Path=#CurrentPATH#/Day/
  281. X=73
  282. Y=37
  283. H=20
  284. W=20

  285. [MeterIcon1_1_N]         ----------明天夜晚天气状况
  286. MeasureName=MeasureWeatherIcon1_1_N
  287. Meter=IMAGE
  288. Path=#CurrentPATH#/Night/
  289. X=73
  290. Y=57
  291. H=20
  292. W=20

  293. ;-------------------------

  294. [MeterTemp1_1_D]
  295. MeasureName=MeasureWeatherTemp1_1_D
  296. Meter=STRING
  297. X=115
  298. Y=60
  299. FontColor=255,255,255,180
  300. FontSize=10
  301. StringAlign=RIGHT
  302. StringStyle=NORMAL
  303. FontFace=#Font#
  304. Antialias=1
  305. Postfix="°"

  306. ;-------------------------

  307. [MeterTemp2_D]
  308. MeasureName=MeasureWeatherTemp2_D
  309. Meter=STRING
  310. X=160
  311. Y=37
  312. W=26
  313. H=15
  314. FontColor=255,255,255,180
  315. FontSize=10
  316. StringAlign=RIGHT
  317. StringStyle=NORMAL
  318. FontFace=#Font#
  319. Antialias=1
  320. Postfix="°"
  321. ClipString=1

  322. [MeterIcon2_1_D]
  323. MeasureName=MeasureWeatherIcon2_1_D
  324. Meter=IMAGE
  325. Path=#CurrentPATH#/Day/
  326. X=116
  327. Y=37
  328. H=20
  329. W=20

  330. [MeterIcon2_1_N]
  331. MeasureName=MeasureWeatherIcon2_1_N
  332. Meter=IMAGE
  333. Path=#CurrentPATH#/Night/
  334. X=116
  335. Y=57
  336. H=20
  337. W=20

  338. ;-------------------------------

  339. [MeterTemp2_1_D]
  340. MeasureName=MeasureWeatherTemp2_1_D
  341. Meter=STRING
  342. X=160
  343. Y=60
  344. FontColor=255,255,255,180
  345. FontSize=10
  346. StringAlign=RIGHT
  347. StringStyle=NORMAL
  348. FontFace=#Font#
  349. Antialias=1
  350. Postfix="°"

  351. ;-------------------------------

  352. [MeterTemp3_D]
  353. MeasureName=MeasureWeatherTemp3_D
  354. Meter=STRING
  355. X=202
  356. Y=37
  357. W=26
  358. H=15
  359. FontColor=255,255,255,180
  360. FontSize=10
  361. StringAlign=RIGHT
  362. StringStyle=NORMAL
  363. FontFace=#Font#
  364. Antialias=1
  365. Postfix="°"
  366. ClipString=1

  367. [MeterIcon3_1_D]
  368. MeasureName=MeasureWeatherIcon3_1_D
  369. Meter=IMAGE
  370. Path=#CurrentPATH#/Day/
  371. X=160
  372. Y=37
  373. H=20
  374. W=20

  375. [MeterIcon3_1_N]
  376. MeasureName=MeasureWeatherIcon3_1_N
  377. Meter=IMAGE
  378. Path=#CurrentPATH#/Night/
  379. X=160
  380. Y=57
  381. H=20
  382. W=20

  383. ;-------------------------------

  384. [MeterTemp3_1_D]
  385. MeasureName=MeasureWeatherTemp3_1_D
  386. Meter=STRING
  387. X=202
  388. Y=60
  389. FontColor=255,255,255,180
  390. FontSize=10
  391. StringAlign=RIGHT
  392. StringStyle=NORMAL
  393. FontFace=#Font#
  394. Antialias=1
  395. Postfix="°"

  396. ;==================================================================Night

  397. [MeterTemp1_N]
  398. MeasureName=MeasureWeatherTemp1_N
  399. Meter=STRING
  400. X=115
  401. Y=37
  402. FontColor=255,255,255,180
  403. FontSize=10
  404. StringAlign=RIGHT
  405. StringStyle=NORMAL
  406. FontFace=#Font#
  407. Antialias=1
  408. Postfix="°"

  409. [MeterIcon1_N]
  410. MeasureName=MeasureWeatherIcon1_N
  411. Meter=IMAGE
  412. Path=#CurrentPATH#/Night/
  413. X=73
  414. Y=57
  415. H=20
  416. W=20

  417. [MeterIcon1_D]
  418. MeasureName=MeasureWeatherIcon1_D
  419. Meter=IMAGE
  420. Path=#CurrentPATH#/Day/
  421. X=73
  422. Y=37
  423. H=20
  424. W=20

  425. ;-------------------------

  426. [MeterTemp2_N]
  427. MeasureName=MeasureWeatherTemp2_N
  428. Meter=STRING
  429. X=115
  430. Y=60
  431. W=26
  432. H=15
  433. FontColor=255,255,255,180
  434. FontSize=10
  435. StringAlign=RIGHT
  436. StringStyle=NORMAL
  437. FontFace=#Font#
  438. Antialias=1
  439. Postfix="°"
  440. ClipString=1

  441. [MeterIcon2_N]
  442. MeasureName=MeasureWeatherIcon2_N
  443. Meter=IMAGE
  444. Path=#CurrentPATH#/Night/
  445. X=116
  446. Y=57
  447. H=20
  448. W=20

  449. [MeterIcon2_D]
  450. MeasureName=MeasureWeatherIcon2_D
  451. Meter=IMAGE
  452. Path=#CurrentPATH#/Day/
  453. X=116
  454. Y=37
  455. H=20
  456. W=20

  457. ;-------------------------

  458. [MeterTemp2_1_N]
  459. MeasureName=MeasureWeatherTemp2_1_N
  460. Meter=STRING
  461. X=160
  462. Y=37
  463. FontColor=255,255,255,180
  464. FontSize=10
  465. StringAlign=RIGHT
  466. StringStyle=NORMAL
  467. FontFace=#Font#
  468. Antialias=1
  469. Postfix="°"

  470. ;-------------------------------

  471. [MeterTemp3_N]
  472. MeasureName=MeasureWeatherTemp3_N
  473. Meter=STRING
  474. X=160
  475. Y=60
  476. W=26
  477. H=15
  478. FontColor=255,255,255,180
  479. FontSize=10
  480. StringAlign=RIGHT
  481. StringStyle=NORMAL
  482. FontFace=#Font#
  483. Antialias=1
  484. Postfix="°"
  485. ClipString=1

  486. [MeterIcon3_N]
  487. MeasureName=MeasureWeatherIcon3_N
  488. Meter=IMAGE
  489. Path=#CurrentPATH#/Night/
  490. X=160
  491. Y=57
  492. H=20
  493. W=20

  494. [MeterIcon3_D]
  495. MeasureName=MeasureWeatherIcon3_D
  496. Meter=IMAGE
  497. Path=#CurrentPATH#/Day/
  498. X=160
  499. Y=37
  500. H=20
  501. W=20

  502. ;-------------------------
  503. [MeterTemp3_1_N]
  504. MeasureName=MeasureWeatherTemp3_1_N
  505. Meter=STRING
  506. X=202
  507. Y=37
  508. FontColor=255,255,255,180
  509. FontSize=10
  510. StringAlign=RIGHT
  511. StringStyle=NORMAL
  512. FontFace=#Font#
  513. Antialias=1
  514. Postfix="°"


  515. ;-------------------------------

  516. [MeterTemp4_N]
  517. MeasureName=MeasureWeatherTemp4_N
  518. Meter=STRING
  519. X=202
  520. Y=60
  521. W=26
  522. H=15
  523. FontColor=255,255,255,180
  524. FontSize=10
  525. StringAlign=RIGHT
  526. StringStyle=NORMAL
  527. FontFace=#Font#
  528. Antialias=1
  529. Postfix="°"
  530. ClipString=1

  531. ;=============================================Shift

  532. [MeasureHour]
  533. Measure=Time         ----------抓取时间
  534. Format=%H         ----------显示小时

  535. [MeasureTime1]
  536. Measure=Time
  537. Format="%H"
  538. IfBelowValue=18
  539. IfBelowAction=!execute #Show1##Hide1#[!RainmeterRedraw]

  540. [MeasureTime2]
  541. Measure=Time
  542. Format="%H"
  543. IfEqualValue=18
  544. IfEqualAction=!execute #Hide2##Show2#[!RainmeterRedraw]

  545. [MeasureTime3]
  546. Measure=Time
  547. Format="%H"
  548. IfAboveValue=18
  549. IfAboveAction=!execute #Hide2##Show2#[!RainmeterRedraw]
复制代码
----------最为精华的一段,抓取当前时间,以判断当前该显示什么。



(最后附上下载地址:http://bbs.rainmeter.cn/thread-55131-1-1.html

评分

参与人数 1活跃值 +11 收起 理由
欢少 + 11 很给力,感谢楼主分享~~~~

查看全部评分

回复

使用道具 举报

签到天数: 149 天

[LV.7]常住居民III

发表于 2011-12-30 09:19:54 | 显示全部楼层
有爱心的人
   支持一下
回复

使用道具 举报

签到天数: 365 天

[LV.9]以坛为家II

发表于 2011-12-30 10:10:21 | 显示全部楼层
{:soso_e154:}
果断收藏了
回复

使用道具 举报

签到天数: 71 天

[LV.6]常住居民II

发表于 2011-12-30 12:54:17 | 显示全部楼层
代码讲解,这个太有了。
回复

使用道具 举报

签到天数: 16 天

[LV.4]偶尔看看III

发表于 2012-1-12 10:49:48 | 显示全部楼层
本帖最后由 irmer 于 2012-1-12 10:50 编辑

直接贴代码的人最有爱了,呵呵,
我要借用楼主的代码改一下我的天气皮肤,让预报每天只刷新3次,因为据我观察,Weather.com.cn 的天气预报数据每天只会发布3次,分别是8,11,18时。
顺便问一下楼主,为什么这两行
  1. Measure=Time
  2. Format=%H
复制代码
反复出现。
回复

使用道具 举报

签到天数: 208 天

[LV.7]常住居民III

发表于 2012-1-23 01:45:07 | 显示全部楼层

这个是为了抓取时间,我的设定是让它18点以前显示白天的天气图标,有太阳。18点以后显示晚上的图标,月亮。   而且不知道你发现没有这个天气网站的后台的温度,白天和晚上在最高温最低温上面有问题。比如说 今天白天最高 15  最低 10 第二天最高温最低温分别是是 16和 11 那么白天它的代码是 “15”~“10”  “16”~“11”到了晚上 由于没有最高温(下午两点左右),就会把最高温排除 那么它的代码会变成 “10”~“16” "11"~"**"     所以直接提取而不加关于时间的判断语句,会比较不准确。
回复

使用道具 举报

该用户从未签到

发表于 2012-1-26 22:55:07 | 显示全部楼层
支持支持!!!!!!!!!1
回复

使用道具 举报

签到天数: 6 天

[LV.2]偶尔看看I

发表于 2012-2-16 17:32:38 | 显示全部楼层
{:soso_e179:}{:soso_e179:}
回复

使用道具 举报

头像被屏蔽

签到天数: 5 天

[LV.2]偶尔看看I

发表于 2012-2-16 18:08:38 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

签到天数: 1 天

[LV.1]初来乍到

发表于 2012-2-16 23:44:10 | 显示全部楼层
xxxx谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢
回复

使用道具 举报

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

本版积分规则

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