It is currently April 25th, 2024, 5:17 pm
Rename file
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Rename file
is there any way to rename a file with Rainmeter skin? i'm unable to find it if there is.
Last edited by pul53dr1v3r on November 26th, 2019, 8:51 pm, edited 1 time in total.
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rename file
Yes, there is, through a RunCommand plugin measure. For instance running the following measure will rename the Test.txt file within the @Resources folder, to MyFile.txt:Pul53dr1v3r wrote: ↑November 25th, 2019, 4:30 pm is there any way to rename a file with Rainmeter skin? i'm unable to find it if there is.
Code: Select all
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=rename "#@#Test.txt" "MyFile.txt"
State=Hide
OutputType=ANSI
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Rename file
Great!balala wrote: ↑November 25th, 2019, 4:41 pm Yes, there is, through a RunCommand plugin measure. For instance running the following measure will rename the Test.txt file within the @Resources folder, to MyFile.txt:Code: Select all
[MeasureRun] Measure=Plugin Plugin=RunCommand Parameter=rename "#@#Test.txt" "MyFile.txt" State=Hide OutputType=ANSI
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rename file
Supposingly it does work?
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Rename file
will test it a bit later, but i gues it should work. Will see.
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rename file
OK, just please let me know if you succeed.Pul53dr1v3r wrote: ↑November 25th, 2019, 5:19 pm will test it a bit later, but i gues it should work. Will see.
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Rename file
does anything else along the measure have to be added to get it work?
I added an option ro Rainmeter section to execute the measure on refresh: OnRefreshAction=[!CommandMeasure "MeasureRun" "Run"] but no effect.
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rename file
Check the file name and path and the name you want to rename the file to. Have you used a valid path, of an existing file?Pul53dr1v3r wrote: ↑November 25th, 2019, 7:16 pm does anything else along the measure have to be added to get it work?
I added an option ro Rainmeter section to execute the measure on refresh: OnRefreshAction=[!CommandMeasure "MeasureRun" "Run"] but no effect.
How exactly the [MeasureRun] measure looks like?
-
- Posts: 442
- Joined: July 30th, 2014, 10:30 am
Re: Rename file
ok, after i "opened" my eyes, i found the mistake. It works now. But when i change the file name once, next time i can't do it until i put the new file name manually in the code(Parameter). Imagine that we rename the file using an InputText field. It would work for the first change, but next time a manual change in the code is necessary.
This is the code:
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
MiddleMouseDownAction=[!Refresh]
OnRefreshAction=[!CommandMeasure "MeasureRun" "Run"]
[Variables]
Num=2
[meterBg]
Meter=Shape
Shape=Rectangle 0,0,50,50,5 | Fill Color 0,0,0
[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter=rename "#@#MyFile.ini" "MyFile#Num#.ini"
State=Hide
OutputType=ANSI
-
- Rainmeter Sage
- Posts: 16169
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rename file
I don't see how are you changing the Num variable (the InputText plugin measure is not posted), but if you are changing it dynamically (what I suppose) you have to add a DynamicVariables=1 option to the [MeasureRun] measure. If that's right, it explains why the first time the file is renamed.Pul53dr1v3r wrote: ↑November 25th, 2019, 7:54 pm But when i change the file name once, next time i can't do it until i put the new file name manually in the code(Parameter). Imagine that we rename the file using an InputText field. It would work for the first change, but next time a manual change in the code is necessary.
Is it right?