It is currently March 28th, 2024, 3:10 pm

Bitcoin Kraken

Get help with creating, editing & fixing problems with skins
Post Reply
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Bitcoin Kraken

Post by PtitChat107 »

Hi,

I am looking for a solution to make this work but it always returns me an error: RegExp matching error (-1)
Do you have any idea of ​​the problem ? :oops:

I was thinking of taking the result directly from the main site (https://cryptowat.ch/kraken/btceur) but since it seems to work with JavaScript I'm not sure it will work. :confused:

Code: Select all

[measureBitcoin]
Measure=Plugin
Plugin=WebParser
Url=https://api.cryptowat.ch/markets/kraken/btceur/price
UpdateRate=60
StringIndex=1
RegExp="(?siU).*<span class="objectBox objectBox-number">(.*)</span>.*"
Substitute="":"..."
DecodeCharacterReference=1

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

[meterValueBitcoin]
Meter=String
MeterStyle=styleRightText
MeasureName=measureBitcoin
StringIndex=1
X=200
Y=80
W=190
H=14
LeftMouseUpAction=!Execute ["https://cryptowat.ch/kraken/btceur"]
Text=%1
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Bitcoin Kraken

Post by PtitChat107 »

It's works perfectly, thank you.
Too bad that I can not add the currency (€) behind the measure extracted without it disappears by itself but thank you, I will content myself ! :thumbup:
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Bitcoin Kraken

Post by PtitChat107 »

dvo wrote:just put it behind

Code: Select all

%1 €
I try it but it does not seem to work, amazing I know :jawdrop
When you update the skin, 3 special characters are displayed for a few seconds and then nothing.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bitcoin Kraken

Post by jsmorley »

PtitChat107 wrote:I try it but it does not seem to work, amazing I know :jawdrop
When you update the skin, 3 special characters are displayed for a few seconds and then nothing.
You need to encode your skin as Unicode UTF-16 Little Endian in your text editor. Do NOT use ANSI or UTF-8 with Unicode characters, as Rainmeter hates that

https://docs.rainmeter.net/tips/unicode-in-rainmeter/
1.png
2.png
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Bitcoin Kraken

Post by PtitChat107 »

jsmorley wrote:You need to encode your skin as Unicode UTF-16 Little Endian
It works but it disappears as soon as I update the skin, the symbol remains a few seconds and disappears.
dvo wrote:did you put a space between the € and the %1
Yes
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Bitcoin Kraken

Post by balala »

PtitChat107 wrote:I try it but it does not seem to work, amazing I know :jawdrop
When you update the skin, 3 special characters are displayed for a few seconds and then nothing.
Another possibility would be to replace the Sub variable, in the [Variables] section, with the following one: Sub="\s+":"","\n":"","^(.*)$":"\1€". If you do so, you also have to add the RegExpSubstitute=1 option to each measure which uses the above substitution (so, in this case [measureBitcoin], [MeasurePrice], [MeasureCost] and [MeasureRemaining]).
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bitcoin Kraken

Post by jsmorley »

I don't have your MeterStyle settings, but this works fine for me:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[measureBitcoin]
Measure=Plugin
Plugin=WebParser
Url=https://api.cryptowat.ch/markets/kraken/btceur/price
UpdateRate=60
StringIndex=1
RegExp=(?siU)price":(.*)\n.*cost":(.*),\n.*remaining":(.*)\n.*

[MeasurePrice]
Measure=Plugin
Plugin=WebParser
URL=[measureBitcoin]
StringIndex=1

[MeasureCost]
Measure=Plugin
Plugin=WebParser
URL=[measureBitcoin]
StringIndex=2

[MeasureRemaining]
Measure=Plugin
Plugin=WebParser
URL=[measureBitcoin]
StringIndex=3

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

[meterValueBitcoin]
Meter=String
MeasureName=measureBitcoin
X=200
Y=80
StringAlign=Right
LeftMouseUpAction=["https://cryptowat.ch/kraken/btceur"]
Text=%1 €

[meterLabelCost]
Meter=String
MeterStyle=styleLeftText
X=10
Y=100
Text=Cost :

[meterValueCost]
Meter=String
MeasureName=MeasureCost
X=200
Y=100
StringAlign=Right
LeftMouseUpAction=["https://cryptowat.ch/kraken/btceur"]
Text=%1 €

[meterLabelRemaining]
Meter=String
MeterStyle=styleLeftText
X=10
Y=120
Text=Remaining :

[meterValueRemaining]
Meter=String
MeterStyle=styleRightText
MeasureName=MeasureRemaining
StringIndex=3
X=200
Y=120
StringAlign=Right
LeftMouseUpAction=["https://cryptowat.ch/kraken/btceur"]
Text=%1 €
1.png
All that Substitute stuff is just not needed...
Never use !Execute on a bang, it's deprecated and not needed.
Never use StringIndex on a meter, that is only for child WebParser measures.
PtitChat107
Posts: 126
Joined: December 31st, 2015, 6:40 pm

Re: Bitcoin Kraken

Post by PtitChat107 »

jsmorley wrote:This works fine for me:
I checked against your model and everything works perfectly, surely an error on my part but thank you for your correction !
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bitcoin Kraken

Post by jsmorley »

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[measureBitcoin]
Measure=Plugin
Plugin=WebParser
Url=https://api.cryptowat.ch/markets/kraken/btceur/price
UpdateRate=60
StringIndex=1
RegExp=(?siU)price":(.*)\n.*cost":(.*),.*remaining":(.*)\n.*

[MeasurePrice]
Measure=Plugin
Plugin=WebParser
URL=[measureBitcoin]
StringIndex=1

[MeasureCost]
Measure=Plugin
Plugin=WebParser
URL=[measureBitcoin]
StringIndex=2

[MeasureRemaining]
Measure=Plugin
Plugin=WebParser
URL=[measureBitcoin]
StringIndex=3

[MeterBackground]
Meter=Shape
Shape=Rectangle 2,2,275,100,12 | StrokeWidth 1.5 | Stroke Color 150,150,150,255 | Fill Color 47,47,47,255

[StyleText]
FontSize=12
FontColor=255,255,255,255
FontWeight=400
Padding=5,5,5,5
SolidColor=47,47,47,255
AntiAlias=1
StringAlign=Left

[StyleRight]
StringAlign=Right
X=260
FontWeight=700

[meterLabelBitcoin]
Meter=String
MeterStyle=StyleText
X=10
Y=10
Text=Price :

[meterValueBitcoin]
Meter=String
MeasureName=measureBitcoin
MeterStyle=StyleText | StyleRight
Y=0r
LeftMouseUpAction=["https://cryptowat.ch/kraken/btceur"]
Text=%1 €

[meterLabelCost]
Meter=String
MeterStyle=StyleText
X=10
Y=0R
Text=Cost :

[meterValueCost]
Meter=String
MeasureName=MeasureCost
MeterStyle=StyleText | StyleRight
Y=0r
LeftMouseUpAction=!Execute ["https://cryptowat.ch/kraken/btceur"]
Text=%1 €

[meterLabelRemaining]
Meter=String
MeterStyle=StyleText
X=10
Y=0R
Text=Remaining :

[meterValueRemaining]
Meter=String
MeterStyle=StyleText | StyleRight
MeasureName=MeasureRemaining
Y=0r
LeftMouseUpAction=["https://cryptowat.ch/kraken/btceur"]
Text=%1 €
1.png
Post Reply