It is currently April 25th, 2024, 8:03 am

simple calculator

Get help with creating, editing & fixing problems with skins
mrniss
Posts: 2
Joined: October 10th, 2018, 5:55 pm

simple calculator

Post by mrniss »

can someone help me with this? i'm obviously stupid, i can't figure out something with two elements, but there it is.

super small calculator (bpm into seconds), input a number into the text box, 60 gets divided by that number, it displays. whenever i uncomment MeasureCalc it just doesn't display anymore.

Code: Select all

[Variables]
bpm=tempo

[MeterInput]
Meter=String
W=100
H=20
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
Text=#bpm#
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureInputText "ExecuteBatch 1"]

[MeterResult]
Meter=String
Measure=MeasureCalc      
W=100
H=20
Y=20
FontColor=255,255,255,255
SolidColor=255,0,0,255
Text=%1
DynamicVariables=1


[MeasureInputText]
Measure=Plugin
Plugin=InputText
W=100
H=20
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
Command1=[!SetVariable bpm "$UserInput$"][!WriteKeyValue Variables bpm "[MeasureInputText]"][!UpdateMeter *][!Redraw]

[MeasureResult]
Measure=Calc
DynamicVariables=1
Formula=60/#bpm#



User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: simple calculator

Post by balala »

mrniss wrote:super small calculator (bpm into seconds), input a number into the text box, 60 gets divided by that number, it displays. whenever i uncomment MeasureCalc it just doesn't display anymore.
Not sure I can completely follow what1s going on there, but definitely there is a mistake: a Measure option doesn't exist on String meters (otherwise a such option doesn't exist on no meter or measure). Probably this option should have to be Measure[color=#FF0000]Name[/color]=MeasureCalc ([MeterResult] meter).
If fixing the above option doesn't help, you have to know that a [MeasureCalc] measure doesn't even exist, that's why I'm not sure what the skin should have to do. Please post the whole code, because I think there should have to exist some unposted sections.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: simple calculator

Post by eclectic-tech »

The correction balala suggested is needed, but you also need to change the value to MeasureName=MeasureResult.

Here is your code with that change and a few other "tweaks" for you to consider... :welcome:

Code: Select all

[Variables]
bpm=60

[MeasureInputText]
Measure=Plugin
Plugin=InputText
W=235
H=20
FontSize=10
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
DefaultValue=Enter BPM
Command1=[!SetVariable bpm "$UserInput$"][!WriteKeyValue Variables bpm "[MeasureInputText]"][!UpdateMeter *][!Redraw]

[MeasureResult]
Measure=Calc
DynamicVariables=1
Formula=60/#bpm#
Substitute="1":""
IfCondition=#CurrentSection#=1
IfTrueAction=[!SetOption MeterResult Text "One Beat Every Second"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterResult Text "One Beat Every %1 Seconds"][!UpdateMeter *][!Redraw]
IfConditionMode=1

[MeterInput]
Meter=String
W=235
H=20
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
AntiAlias=1
Text=#bpm# BPM Translates To
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure MeasureInputText "ExecuteBatch 1"]

[MeterResult]
Meter=String
MeasureName=MeasureResult    
W=235
H=20
Y=20
FontSize=12
FontColor=0,0,0,255
StringStyle=Bold
SolidColor=255,0,0,255
Text=One Beat Every %1 Seconds 
DynamicVariables=1
NumOfDecimals=2

bpm.png
You do not have the required permissions to view the files attached to this post.
mrniss
Posts: 2
Joined: October 10th, 2018, 5:55 pm

Re: simple calculator

Post by mrniss »

i did post all my code... and i also haven't used rainmeter in about 12 years, so, i might as well have never used it, at this point. :(

thank you, though! this is far nicer than keeping openoffice on my screen... though i did make it a little more minimal :)
bpmcalc.PNG
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: simple calculator

Post by eclectic-tech »

I like the look of your solution! :17good

Yeah, I completely understand "Use It or Lose It!"... 12 years! :jawdrop
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: simple calculator

Post by balala »

eclectic-tech wrote:The correction balala suggested is needed, but you also need to change the value to MeasureName=MeasureResult.
The original code had no [MeasureCalc] measure, but it was used into the code.