Page 3 of 6

Re: Value change icon

Posted: July 2nd, 2018, 6:06 pm
by jsmorley
PtitChat107 wrote:I allow myself to intervene, but in the case of the repeated use of this function; would it be possible to gather all the "ValuePrev" in one file instead of finding it in the Variables ?
You are certainly going to want to use dynamic variables to hold the value(s), so you can react to them instantly without having to refresh the skin. Where you store the value(s) for purposes of making them "persistent" when the skin is loaded or refreshed, that is up to you. Write them to the Variables section of the actual skin, or put them in a .inc @Include file.

Re: Value change icon

Posted: July 2nd, 2018, 6:13 pm
by balala
PtitChat107 wrote:I allow myself to intervene, but in the case of the repeated use of this function; would it be possible to gather all the "ValuePrev" in one file instead of finding it in the Variables ?
Just for a few details beside jsmorley's reply, you have to know that you just have to add a fourth parameter, under the !WriteKeyValue bangs: the file where you want to write those values. Eg the !WriteKeyValue bangs of the following IfTrueAction options ([MeasurePrev] measure) write these values into a MyVars.inc file, placed in the @Resources folder:

Code: Select all

[MeasurePrev]
Measure=Calc
Formula=SGN([MeasureTemp])
RegExpSubstitute=1
Substitute="^1$":"+","^-1$":"","0":""
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValue# > [MeasureTemp]
IfTrueAction=[!SetVariable DirIcon "▼"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]" "#@#MyVars.inc"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValue# < [MeasureTemp]
IfTrueAction2=[!SetVariable DirIcon "▲"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]" "#@#MyVars.inc"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValue# = [MeasureTemp]
IfTrueAction3=[!SetVariable DirIcon "▬"][!SetVariable PrevValue "[MeasureTemp]"][!WriteKeyValue Variables PrevValue "[MeasureTemp]" "#@#MyVars.inc"][!UpdateMeter *][!Redraw]
Note the newly added "#@#MyVars.inc" parameters, under the !WriteKeyValue bangs.
But you have to be careful: the MyVars.inc file MUST have a [Variables] section, where the skin can write those variables.

Re: Value change icon

Posted: July 2nd, 2018, 6:26 pm
by PtitChat107
balala wrote:Note the newly added "#@#MyVars.inc" parameters, under the !WriteKeyValue bangs.
But you have to be careful: the MyVars.inc file MUST have a [Variables] section, where the skin can write those variables.
This is exactly what I was looking for ! 8-) By cons now I lost the color lol and the value also does not seem to register :/

Code: Select all

[Variables]
fontName=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205
@include=\UserVariables.inc
@include=\PrevVariables.inc

; ----------------------------------
; MEASURES
; ----------------------------------


[measureBitcoin]
Measure=Plugin
Plugin=WebParser
Url=https://api.cryptowat.ch/markets/kraken/btceur/price
UpdateRate=30
StringIndex=1
RegExp=(?siU){"result":{"price":(.*)},"allowance".*
FinishAction=[!EnableMeasure MeasureBitcoinPrev][!UpdateMeasure MeasureBitcoinPrev]

[MeasureBitcoinPrev]
Measure=Calc
Formula=[measureBitcoin]
DynamicVariables=1
Disabled=1
UpdateDivider=-1
IfCondition=#PrevValue# > [measureBitcoin]
IfTrueAction=[!SetVariable DirIcon "▼"][!SetOption meterValueBitcoin InlineSetting "Color | 255,0,0,255"][!SetOption meterValueBitcoin InlinePattern "^.* € (.)$"][!SetVariable PrevValueBitcoin "[measureBitcoin]"][!WriteKeyValue Variables "#@#PrevVariables.inc" "[measureBitcoin]"][!UpdateMeter *][!Redraw]
IfCondition2=#PrevValue# < [measureBitcoin]
IfTrueAction2=[!SetVariable DirIcon "▲"][!SetOption meterValueBitcoin InlineSetting "Color | 0,255,0,255"][!SetOption meterValueBitcoin InlinePattern "^.* € (.)$"][!SetVariable PrevValueBitcoin "[measureBitcoin]"][!WriteKeyValue Variables "#@#PrevVariables.inc" "[measureBitcoin]"][!UpdateMeter *][!Redraw]
IfCondition3=#PrevValue# = [measureBitcoin]
IfTrueAction3=[!SetVariable DirIcon "▬"][!SetOption meterValueBitcoin InlineSetting "Color | 0,0,255,255"][!SetOption meterValueBitcoin InlinePattern "^.* € (.)$"][!SetVariable PrevValueBitcoin "[measureBitcoin]"][!WriteKeyValue Variables "#@#PrevVariables.inc" "[measureBitcoin]"][!UpdateMeter *][!Redraw]

; ----------------------------------
; STYLES are used to "centralize" options
; ----------------------------------

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

; ----------------------------------
; METERS
; ----------------------------------

[meterLabelBitcoin]
Meter=String
MeterStyle=styleLeftText
X=10
Y=80
W=190
H=14
Text=Bitcoin

[meterValueBitcoin]
Meter=String
MeasureName=measureBitcoin
MeterStyle=styleRightText
X=200
Y=80
StringAlign=Right
AntiAlias=1
DynamicVariables=1
Text=[measureBitcoin] € #DirIcon#

Re: Value change icon

Posted: July 2nd, 2018, 6:32 pm
by balala
xenium wrote:Not working !
[MeasureTemp] does not update when the [ Measurepdate] value changes
Normally. Finally I think I found a very stupid mistake in one of my previous posts: the OnChange[color=#FF0000]Value[/color]=[!CommandMeasure "MeasureTemp" "Update"] option is not OnChangeValue, but OnChangeAction. So, correctly this option should have to be OnChange[color=#22B14C]Action[/color]=[!CommandMeasure "MeasureTemp" "Update"].
Please try out this new form of this option and let me know if this is working.

Sorry for my mistake.

Also fixed in the above post.

Re: Value change icon

Posted: July 2nd, 2018, 6:46 pm
by balala
PtitChat107 wrote:and the value also does not seem to register :/
The posted !WriteKeyValue bangs ([!WriteKeyValue Variables "#@#PrevVariables.inc" "[measureBitcoin]"]) are wrong:
  • The first parameter has to be the name of the section. This is ok.
  • The second parameter should have to be the name of the variable which will be written. This is missing from your bangs.
  • The third one should have to be the value which will be written when the bang is executed. In your case this probably is the "[measureBitcoin]", which is posted as the last parameter.
  • And finally if added, the fourth (and last) parameter is the file where the variable will be written. In your code this would be probably "#@#PrevVariables.inc".
So a fixed form of these bangs would be: [!WriteKeyValue Variables PrevValue "[measureBitcoin]" "#@#PrevVariables.inc"]

Re: Value change icon

Posted: July 2nd, 2018, 7:59 pm
by xenium
balala wrote:Normally. Finally I think I found a very stupid mistake in one of my previous posts: the OnChange[color=#FF0000]Value[/color]=[!CommandMeasure "MeasureTemp" "Update"] option is not OnChangeValue, but OnChangeAction. So, correctly this option should have to be OnChange[color=#22B14C]Action[/color]=[!CommandMeasure "MeasureTemp" "Update"].
Please try out this new form of this option and let me know if this is working.

Sorry for my mistake.

Also fixed in the above post.
I tried and unfortunately does not work

Re: Value change icon

Posted: July 2nd, 2018, 8:07 pm
by balala
xenium wrote:I tried and unfortunately does not work
I'm checking it...

Re: Value change icon

Posted: July 3rd, 2018, 11:50 am
by balala
xenium wrote:I tried and unfortunately does not work
Ok, here is the solution: replace the UpdateDivider=-1 option of the [MeasureTemp] measure with UpdateRate=-1. So simple...

Re: Value change icon

Posted: July 3rd, 2018, 2:49 pm
by PtitChat107
I must be silly I think :rofl: I let you check my version because the result in the .ini file does not seem to register correctly so I prefer to give you directly what I work with and wait for your opinion and changes that I can bring.

Re: Value change icon

Posted: July 3rd, 2018, 3:54 pm
by balala
PtitChat107 wrote:I must be silly I think :rofl: I let you check my version because the result in the .ini file does not seem to register correctly so I prefer to give you directly what I work with and wait for your opinion and changes that I can bring.
The package doesn't have a @Resources folder. But the code wants to use it. The PrevVariables.inc and UserVariables.inc files are placed near the Clock.ini, but the !WriteKeyValue bangs want to write the values for example into the #@#/Clock_test/PrevVariables.inc file, which at least in the posted package, doesn't exist.
So, please check the path of those files and either move them into the appropriate folder, or modify the last parameter of the !WriteKeyValue bangs.
Same about the @Include options. The two paths (in the @Include options and in the !WriteKeyValue bangs) don't match each other.
And one more about the @Include options: take care to remove the first \ characters: eg the @include=[color=#FF0000]\[/color]UserVariables.inc option should have to be @include=UserVariables.inc.