# Tips - Setoption Guide - Rainmeter官方文档 - 雨滴社区 - Powered by Discuz!
 找回密码
 点击注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 2471|回复: 0

Tips - Setoption Guide

[复制链接]

签到天数: 265 天

[LV.8]以坛为家I

发表于 2012-5-27 14:49:38 | 显示全部楼层 |阅读模式

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

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

x

【版权声明】
   本文档翻译者:雨滴社区-相望无言
   本文档仅用于雨滴社区站内交流,禁止转载,由此引发的一切责任及版权纠纷由转载、传播本文档者负责。
 


!Setoption Guide

 

!SetOption [Meter/Measure] [Option] [Value] (Config)

更改meter或者measure一个设置(例如:Fontsizetextformulaetc)(欢迎深入列举)


!SetOptionGroup [Group] [Option] [Value] (Config)

更改在特殊group中的meters或者measures中的设置(例如:Fontsizetextformulaetc)(欢迎深入列举)

 

这个bang 允许你同时给metersmeasures设置多个设置,这不需要在metermeasure中添加“DynamicVariables”

并且一直有效直到皮肤被刷新,或者被其他动作改变。这个设置不存在于meter或者measure,因为如果需要!Setoption会代替任何显示的设置或者增加选项。

 

更改或添加一个选项

下面这个代码的效果是:当你鼠标悬停在这个meter时,文字颜色从红色变为绿色,并且文字样式变为加粗。

[MeterOne]
Meter=String
meter的属性为string(文字)
FontColor=255,0,0,255
;文字颜色为红色,透明度为0%,即不透明(颜色表示方法为RRR,GGG,BBB,ALPH)(ALPH为透明度,范围是0~255,0表示最透明,即看不到点不着,255为最不透明。如果你要既看不到又能拖动就设置为1,例如0,0,0,1
Text="Hello World"
;显示的文字为Hello World
MouseOverAction=!Execute [!SetOption MeterOne FontColor 0,255,0,255][!SetOption MeterOne StringStyle Bold]
;鼠标动作,分为很多,将在其他里面做解释,
;这个为鼠标悬停时的动作,
!SetOption MeterOne FontColor 0,255,0,255
;这个作用是在鼠标悬停时更改 meterone fontcolor的属性为0,255,0,255
!SetOption MeterOne StringStyle Bold
;这个作用是在鼠标悬停时在meterone中增加stringstyle的属性为bold


删除或恢复选项

你可以再次用!SetOption删除你的前面更改的值用””空字符串,应当注意这里是从metermeasure中删除整个选项。

[MeterOne]
Meter=String
FontColor=255,0,0,255
Text="Hello World"
MouseOverAction=!Execute [!SetOption MeterOne FontColor 0,255,0,255][!SetOption MeterOne StringStyle Bold]
MouseLeaveAction=!Execute [!SetOption MeterOne FontColor ""][!SetOption MeterOne StringStyle ""]

这里将移除meter中的fontcolorstringstyle的设置,这会引起一个问题,现在这个meter没有了fontcolor的设置,并且文字的颜色将会更改为默认的0,0,0,255(黑色),并不是你想的变回255,0,0,255(红色)。

 

这个问题可以用2个方法解决

 

第一个:特别设置为它原本的样子

[MeterOne]
Meter=String
FontColor=255,0,0,255
Text="Hello World"
MouseOverAction=!Execute [!SetOption MeterOne FontColor 0,255,0,255][!SetOption MeterOne StringStyle Bold]
MouseLeaveAction=!Execute [!SetOption MeterOne FontColor 255,0,0,255][!SetOption MeterOne StringStyle ""]


第二个:使用meterstyle!SetOption 增加的fontcolor将会优先使用,优先级别高于meterstyle,而后移除fontcolormeterstyle将会起作用。

[TextStyle]
FontColor=255,0,0,255
 
[MeterOne]
Meter=String
MeterStyle=TextStyle
;引用textstyle
Text="Hello World"
MouseOverAction=!Execute [!SetOption MeterOne FontColor 0,255,0,255][!SetOption MeterOne StringStyle Bold]
MouseLeaveAction=!Execute [!SetOption MeterOne FontColor ""][!SetOption MeterOne StringStyle ""] 


Variables and !SetOption

!SetOption,像其他的bang一样,将会在被设置之前计算得到任何引用变量的值, #Variables# 

[Variables]
MyColor=255,255,255,255
 
[MeterOne]
Meter=String
Text="Hello World"
MouseOverAction=!SetOption MeterOne FontColor #MyColor#
DynamicVariables=1


这个将会在meterone下直接生成 fontcolor=255,255,255,255,而不是fontcolor=#MyColor#

如果想要只是写入#MYCOLOR#,你需要这样写#*MYCOLOR*#,这样你就会得到FONTCOLOR=#MyColor#

[MeterOne]
Meter=String
Text="Hello World"
MouseOverAction=!SetOption MeterOne FontColor #*MyColor*#
DynamicVariables=1

现在meter将会跟随变量mycolor的变化而变化,由于 DynamicVariables=1任何变量mycolor的改变都会在这个皮肤中起到作用。


[Measures] and !SetOption

 

!SetOption可以使用Measures中的值

[MeasureTime1]
Measure=Time
Format=%S
 
[MeasureTime2]
Measure=Time
Format=%M
 
[MeterOne]
Meter=String
Text=[MeasureTime1]
DynamicVariables=1
LeftMouseUpAction=!SetOption MeterOne Text [MeasureTime2]

这个将会把text设置为measuretime2检测到的分钟值,而不是text=[Measuretime2],如果你想要得到text=[measuretime2]这样的效果,就需要这样写[*MeasureTime2*],代码如下

[MeasureTime1]
Measure=Time
Format=%S
 
[MeasureTime2]
Measure=Time
Format=%M
 
[MeterOne]
Meter=String
Text=[MeasureTime1]
DynamicVariables=1
LeftMouseUpAction=!SetOption MeterOne Text [*MeasureTime2*]

现在meter将会跟随measuretime2的变化而变化,由于 DynamicVariables=1任何measuretime2的改变都会在这个皮肤中起到作用。

 

哪些!setoption可以改变哪些不可以

一般情况下,!setoption可以用来改变任何metermeasure中的任何设置。几乎在metermeasure中特定的类型设置,像fontcolor或者ImagenameFormula是被允许的,其他metermeasure共用的设置,例如:GroupMeterstyleUpdateDivider也是被允许改变的。你可以设置MouseIF 这些动作。然而还是有一些类型和特殊的事情是!Setoption 可以和不可以使用的。

 

l  你只能在metersmeasures中使用!setoption,这意味着你不能改变任何[rainmeter]或者[variables]中的设置。也不能改变作为meterstyle使用的部分,除非这些部分自身同时也是有效地meter或者measure样式

l  你不能使用!setoption改变meter或者measure中的[sectionname],还有不能改变metermeasure中的[style](例如meter=string)

l  你不能使用!setoption改变一个metermeasurename=

l  你也不能使用!setoption改变meter[hidden=][disabled=]的值,你可以用!Hidemeter/!Showmeter!DisableMeasure/!Enablemeasure 完成

l  你不能使用!setoption改变 meter中的x=Y=,可以用!movemeter 指令完成

l  对于plugin measures 有一些特殊的规则,由于他们实际上在大多数案例的设置当中不支持动态改变。

1.     你不能使用!setoption改变那些特殊类型的pluginmeasure中的特殊设置(例如 Url= on WebParser or PathName= on Quote

2.     你不能使用!setoption改变plugin measure中插件的类型,你可以使用它来改变那些MEASURES中共用的设置。包括:(Group, UpdateDivider, InvertMeasure, MaxValue, MinValue, Substitute, RegExpSubstitute and AverageSize)



回复

使用道具 举报

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

本版积分规则

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