It is currently September 1st, 2024, 12:50 am
Lua for me.
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Lua for me.
Also, could you please explain what's going on in your .lua code on the newT( t ) function? I'm no lua expert as you must have figured out by now.
-
- Rainmeter Sage
- Posts: 16485
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Lua for me.
Yep, I realized this and it's clear. However I think rewriting the code when any changes occurs isn't extremely efficient approach. Especially that in such cases you have to refresh the skin, to use the rewritten file.kyriakos876 wrote:Also you can only open and rewrite on a file without deleting everything only if it's in .txt format
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Lua for me.
That is true and one of my concerns. I'm studying raiguards code that could solve many of my problems though.balala wrote:Yep, I realized this and it's clear. However I think rewriting the code when any changes occurs isn't extremely efficient approach. Especially that in such cases you have to refresh the skin, to use the rewritten file.
-
- Rainmeter Sage
- Posts: 16485
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Lua for me.
I have no good ideas, because if the file is rewritten a refresh of the skin is absolutely necessary. No other ways.kyriakos876 wrote:That is true and one of my concerns. I'm studying raiguards code that could solve many of my problems though.
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Lua for me.
I think I can compromise one refresh every time a disk is added or removed...It does happen a lot but It's not THAT often and nothing that a computer made for server can't handle. Imagine a refresh every 1 hour for example... It's not that bad... but at the moment I don't know how to do that. Maybe you could help me here...balala wrote:I have no good ideas, because if the file is rewritten a refresh of the skin is absolutely necessary. No other ways.
My issue is :
Code: Select all
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=wmic logicaldisk get caption
OutputType=ANSI
RegExpSubstitute=1
Substitute="Caption":""," ":"",":":"","Name.*#CRLF#":"","#CRLF#":"
OnUpdateAction=[!SetVariable AllDisks "[#CurrentSection#]"]
OnChangeAction=[bang that rewrites everything][!Delay 1000][!Refresh]
DynamicVariables=1
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Lua for me.
By the way, I almost went crazy until I found out how to make this work:
I literally tried everything in my power, only to come up with this:
\#*quotes*\#Stop 2\#*quotes*\#
I basically named a variable quotes=" because I just couldn't make it work any other way. I swear this has to be the stupidest thing I've ever done.
![Confused :?](./images/smilies/an.gif)
Code: Select all
SKIN:Bang(string.format('!WriteKeyValue Background_Disk_%s "MouseLeaveAction" "[!CommandMeasure DiskAnimation%s "Stop 1"][!CommandMeasure DiskAnimation%s "Execute 2"]" "#@#FileToEdit.txt"',i,i,i))
\#*quotes*\#Stop 2\#*quotes*\#
I basically named a variable quotes=" because I just couldn't make it work any other way. I swear this has to be the stupidest thing I've ever done.
![Confused :?](./images/smilies/an.gif)
![Confused :?](./images/smilies/an.gif)
![Confused :?](./images/smilies/an.gif)
![Confused :?](./images/smilies/an.gif)
![Confused :?](./images/smilies/an.gif)
-
- Rainmeter Sage
- Posts: 16485
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Lua for me.
Maybe try something like the following: add the following String measure:kyriakos876 wrote:My issue is :
This will OnChangeAction will be triggered from the first update because the [MeasureRun] will first have " " as return which is nothing, and then in the next update it will have the actual value... what could I do about this? Any ideas?Code: Select all
[MeasureRun] Measure=Plugin Plugin=RunCommand Parameter=wmic logicaldisk get caption OutputType=ANSI RegExpSubstitute=1 Substitute="Caption":""," ":"",":":"","Name.*#CRLF#":"","#CRLF#":" OnUpdateAction=[!SetVariable AllDisks "[#CurrentSection#]"] OnChangeAction=[bang that rewrites everything][!Delay 1000][!Refresh] DynamicVariables=1
Code: Select all
[MeasureDisks]
Measure=String
String=[MeasureRun]
DynamicVariables=1
OnChangeAction=[bang that rewrites everything][!Delay 1000][!Refresh]
UpdateDivider=-1
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Lua for me.
So you mean this?balala wrote:Maybe try something like the following: add the following String measure:then add the FinishAction=[!UpdateMeasure "MeasureDisks"] option to the [MeasureRun] measure.Code: Select all
[MeasureDisks] Measure=String String=[MeasureRun] DynamicVariables=1 OnChangeAction=[bang that rewrites everything][!Delay 1000][!Refresh] UpdateDivider=-1
Code: Select all
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=wmic logicaldisk get caption
OutputType=ANSI
RegExpSubstitute=1
Substitute="Caption":""," ":"",":":"","Name.*#CRLF#":"","#CRLF#":"
OnUpdateAction=[!SetVariable AllDisks "[#CurrentSection#]"]
FinishAction=[!UpdateMeasure "MeasureDiskss"]
DynamicVariables=1
[MeasureDiskss]
Measure=String
String=[MeasureRun]
DynamicVariables=1
OnChangeAction=[!CommandMeasure "MeasureLua" "Split()"][!Delay 2400][!Refresh]
UpdateDivider=-1
-
- Developer
- Posts: 22710
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Lua for me.
If you have a FinishAction that triggers, even second-hand, a refresh of the skin, that is going to be fired every time the skin is refreshed. That is a certain endless loop.
Understand that any IfCondition or IfMatch works in the following way:
1. The test is done the first time the measure it is on is updated, and the results of "true" or "false" are acted on.
2. The test is done on every subsequent update of the measure and the "true" or "false" actions are taken if the result of the test has changed. So in other words, when the result changes from "true" to "false" or from "false" to "true".
3. The "true" or "false" actions are not taken if the result of the test has not changed. The action is not taken if the result was "true" and is still "true".
4. IfConditionMode can change that behavior so the actions are taken on every update, even if they remain in the same "true" or "false" state.
Refreshing a skin will always cause item 1. to apply. When a skin is refreshed, it is started over, and there is no way for it to remember any previous state of "true" or "false", thus the appropriate action is applied. Only with some clever use of !WriteKeyValue can make any state be "persistent" and survive a refresh of the skin.
Understand that any IfCondition or IfMatch works in the following way:
1. The test is done the first time the measure it is on is updated, and the results of "true" or "false" are acted on.
2. The test is done on every subsequent update of the measure and the "true" or "false" actions are taken if the result of the test has changed. So in other words, when the result changes from "true" to "false" or from "false" to "true".
3. The "true" or "false" actions are not taken if the result of the test has not changed. The action is not taken if the result was "true" and is still "true".
4. IfConditionMode can change that behavior so the actions are taken on every update, even if they remain in the same "true" or "false" state.
Refreshing a skin will always cause item 1. to apply. When a skin is refreshed, it is started over, and there is no way for it to remember any previous state of "true" or "false", thus the appropriate action is applied. Only with some clever use of !WriteKeyValue can make any state be "persistent" and survive a refresh of the skin.
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Lua for me.
So basically I need a second skin that handles this...jsmorley wrote:If you have a FinishAction that triggers, even second-hand, a refresh of the skin, that is going to be fired every time the skin is refreshed. That is a certain endless loop.
Understand that any IfCondition or IfMatch works in the following way:
1. The test is done the first time the measure it is on is updated, and the results of "true" or "false" are acted on.
2. The test is done on every subsequent update of the measure and the "true" or "false" actions are taken if the result of the test has changed. So in other words, when the result changes from "true" to "false" or from "false" to "true".
3. The "true" or "false" actions are not taken if the result of the test has not changed. The action is not taken if the result was "true" and is still "true".
4. IfConditionMode can change that behavior so the actions are taken on every update, even if they remain in the same "true" or "false" state.
Refreshing a skin will always cause item 1. to apply.