I have been looking for various examples, but they all do not really match my goal.
The idea is for the value of a measure to be written to a text file.
I'm lost,
Here is the skin:
I apologise for the possibility that this mish mash is completely wrong. Focusing on the write to file. (everything else works great - until now).
I am not getting any results. So, what I mean by mish mash, is I have been trying to cross associate other peoples code snippets, into this.
Thanks for any help
The relevant parts are mostly at the end of the Awake.ini
It is currently May 4th, 2024, 12:50 pm
Mish-Mash Write contents of a measure to TXT file [solved]
-
- Posts: 1366
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Mish-Mash Write contents of a measure to TXT file [solved]
You do not have the required permissions to view the files attached to this post.
Last edited by CodeCode on December 26th, 2023, 3:23 am, edited 1 time in total.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
-
- Rainmeter Sage
- Posts: 16198
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Mish-Mash Write contents of a measure to TXT file
Which option of which section is the one which should write the value of a measure (most probably as a variable) into the file and doesn't do? Because there are lot of bangs which are writing values of different variables as variables and those bangs are writing the appropriate values correctly to the file (however I obviously haven't even checked them all, but the two I did, wrote the values correctly). But didn't find the bang you have problems with.
So, which is the problematic bang? In which option of which section is it placed?
-
- Posts: 1366
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Re: Mish-Mash Write contents of a measure to TXT file
It worked for you? Would you mind pasting the lines from the SleepDiary.txt file, please?
I click the Log button, but nothing happens. The SleepDiary.txt remains empty.
These are the only measures that I would deem relevant:
I click the Log button, but nothing happens. The SleepDiary.txt remains empty.
These are the only measures that I would deem relevant:
Code: Select all
[MeasureLogTime]
Measure=Time
Format=%A %d.%m.%Y- %H:%M:%S
[MeasureInput]
Measure=Plugin
Plugin=RunCommand
Program=Powershell
State=Hide
OutputType=ANSI
OutputFile=#@#SleepDiary.txt
Command1=[!CommandMeasure MeasureLua "AddToLine([AverageResult])"][!Refresh]
DynamicVariables=1
[MeterLogClick]
Meter=String
SolidColor=0,0,0,1
X=297
Y=480
FontFace=#TallFont#
FontColor=#OuterEdge#
StringAlign=CenterCenter
FontWeight=700
InlineSetting=CharacterSpacing | 1 | 1
FontSize=10
Text=LOG
LeftMouseUpAction=[!CommandMeasure MeasureInput "Run"]
DynamicVariables=1
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
-
- Posts: 1366
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Re: Mish-Mash Write contents of a measure to TXT file
I think there is a much simpler solution.
I saw something that posited the idea of simply using the !WriteKeyValue bang.
It does work, but the idea is that each time the 'Log' button is clicked, a new line would be written.
I am not sure how, if possible, to make the Variable advance. Like LogTime1= LogTime2=, each time a new line would be generated with #CRLF# and the new variable name.
But since I have been writing this post, it occurred to me to make the variable advance using another variable with the LogTime#var#= , then advance the #var# variable every time the log button is clicked.
This is going to be much simpler than recycling an old lua file that is meant to work with a completely unnecessary $inputtext$.
I will try that, and post about that effort here.
I saw something that posited the idea of simply using the !WriteKeyValue bang.
It does work, but the idea is that each time the 'Log' button is clicked, a new line would be written.
I am not sure how, if possible, to make the Variable advance. Like LogTime1= LogTime2=, each time a new line would be generated with #CRLF# and the new variable name.
But since I have been writing this post, it occurred to me to make the variable advance using another variable with the LogTime#var#= , then advance the #var# variable every time the log button is clicked.
This is going to be much simpler than recycling an old lua file that is meant to work with a completely unnecessary $inputtext$.
I will try that, and post about that effort here.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
-
- Posts: 1366
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Re: Mish-Mash Write contents of a measure to TXT file
Okey Dokey.
I have what seems to be an excellent result with the !WriteKeyVariable Bang.
This is the line of code I used:
So I 'think' that is it for now.
Thanks balala for taking time to look into this.
I have what seems to be an excellent result with the !WriteKeyVariable Bang.
This is the line of code I used:
Code: Select all
Text=LOG
LeftMouseUpAction=[!SetVariable var "(#var#+1)"][!WriteKeyValue Variables var "[#var]" "#@#_Awake.inc"][!WriteKeyValue Variables LogEntry#var# "LogTime:[MeasureLogTime] Average:[AverageResult]" "#@#SleepDiary.ini"][!Update]
Thanks balala for taking time to look into this.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
-
- Posts: 1366
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Re: Mish-Mash Write contents of a measure to TXT file
SideNote: The Sleep Diary entries are being sent to an .ini. This was explained in that old post as the only way this idea could work. NB: It was so old - the post - that I think !WriteKeyvalue bang was in a Beta.CodeCode wrote: ↑December 26th, 2023, 3:23 am Okey Dokey.
I have what seems to be an excellent result with the !WriteKeyVariable Bang.
This is the line of code I used:So I 'think' that is it for now.Code: Select all
Text=LOG LeftMouseUpAction=[!SetVariable var "(#var#+1)"][!WriteKeyValue Variables var "[#var]" "#@#_Awake.inc"][!WriteKeyValue Variables LogEntry#var# "LogTime:[MeasureLogTime] Average:[AverageResult]" "#@#SleepDiary.ini"][!Update]
Thanks balala for taking time to look into this.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
-
- Rainmeter Sage
- Posts: 7198
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Mish-Mash Write contents of a measure to TXT file
I guess at some point you might want to "recycle and reuse" the log so that way too old entries are being rewritten with new ones. You already store the line where you write, which is good, the only thing you'd need to do if you want such an ability is to set var to either the value you're setting, or set it back to 1 or similar if its current value is past some threshold. I'm using roughly the same technique to "log" the already read feed items in the Feeds skin from my suite.CodeCode wrote: ↑December 26th, 2023, 3:23 am Okey Dokey.
I have what seems to be an excellent result with the !WriteKeyVariable Bang.
This is the line of code I used:So I 'think' that is it for now.Code: Select all
Text=LOG LeftMouseUpAction=[!SetVariable var "(#var#+1)"][!WriteKeyValue Variables var "[#var]" "#@#_Awake.inc"][!WriteKeyValue Variables LogEntry#var# "LogTime:[MeasureLogTime] Average:[AverageResult]" "#@#SleepDiary.ini"][!Update]
Thanks balala for taking time to look into this.
-
- Rainmeter Sage
- Posts: 16198
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Mish-Mash Write contents of a measure to TXT file
The SleepDiary.txt file remains empty. But you didn't describe in your first post what do you expect to happen:
So, I looked for a bang which should write a value returned by a measure. Didn1t find such a bang, so posted my reply.
You definitely should be much more precise when you post a question. You should explain what we have to do and in what circumstances what should be written is not written. Sorry but no one out there can't figure these out.
-
- Posts: 1366
- Joined: September 7th, 2020, 2:24 pm
- Location: QLD, Australia
Re: Mish-Mash Write contents of a measure to TXT file
Sorry if I was ambiguous about my issue. It seemed to me like I described it ok, I guess not.balala wrote: ↑December 26th, 2023, 6:59 am The SleepDiary.txt file remains empty. But you didn't describe in your first post what do you expect to happen:
So, I looked for a bang which should write a value returned by a measure. Didn1t find such a bang, so posted my reply.
You definitely should be much more precise when you post a question. You should explain what we have to do and in what circumstances what should be written is not written. Sorry but no one out there can't figure these out.
I found a solution, in the by and by, so I am happy about that.
I am just using RunCommand to start a new log file that overwrites the old one, like you say; the need will likely arise eventually, So I built in a create new log on LeftMouseUpAction on a different meter. I had something already that was pretty straight forward, just changed it to suit my current need.Yincognito wrote: ↑December 26th, 2023, 5:30 am I guess at some point you might want to "recycle and reuse" the log so that way too old entries are being rewritten with new ones. You already store the line where you write, which is good, the only thing you'd need to do if you want such an ability is to set var to either the value you're setting, or set it back to 1 or similar if its current value is past some threshold. I'm using roughly the same technique to "log" the already read feed items in the Feeds skin from my suite.
The File is created with the first default line of [Variables]. It seemed logical to do that so the !WriteKeyValue would see the log entries as variables and not just text, also since the idea was that the !WriteKeyValue bang will only work on an ini or inc file.
There is also a place to click and open the log ini. I am not worried that the ini would pose a problem since every text editor in the world can open an ini.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
-
- Rainmeter Sage
- Posts: 16198
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania