It is currently March 28th, 2024, 1:09 pm

Rename file

Get help with installing and using Rainmeter.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Rename file

Post by pul53dr1v3r »

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.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rename file

Post by balala »

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.
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
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Rename file

Post by pul53dr1v3r »

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
Great! :thumbup:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rename file

Post by balala »

Pul53dr1v3r wrote: November 25th, 2019, 4:55 pm Great! :thumbup:
Supposingly it does work?
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Rename file

Post by pul53dr1v3r »

balala wrote: November 25th, 2019, 5:05 pm Supposingly it does work?
will test it a bit later, but i gues it should work. Will see.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rename file

Post by balala »

Pul53dr1v3r wrote: November 25th, 2019, 5:19 pm will test it a bit later, but i gues it should work. Will see.
OK, just please let me know if you succeed.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Rename file

Post by pul53dr1v3r »

balala wrote: November 25th, 2019, 6:47 pm OK, just please let me know if you succeed.
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.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rename file

Post by balala »

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.
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?
How exactly the [MeasureRun] measure looks like?
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Rename file

Post by pul53dr1v3r »

balala wrote: November 25th, 2019, 7:22 pm 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?
How exactly the [MeasureRun] measure looks like?
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
So, not the full name would be changed, but the part with variable in the name. What we should do is to "scrape" the new file name and replace the MyFile.ini in the "Parameter" option with it... Possible?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rename file

Post by balala »

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.
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.
Is it right?
Post Reply