It is currently April 16th, 2024, 5:22 am

Can RunCommand be used to create a txt file

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Can RunCommand be used to create a txt file

Post by CodeCode »

I am adding another feature to my music mini suite, but having tried several ways I don't think I am getting closer to a solution so far as I understand the RunCommand plugin and what I've come across when googling:

Code: Select all

[mMakeText]
Measure=Plugin
Plugin=RunCommand
Program=cmd.exe or PowerShell
Parameter=type nul > Tracks.txt
State=Hide
OutPutFile=Current bottom level folder / StartInFolder ,-Needs to be dynamically recognised for any path the NowPlaying track is in.
Then;
LeftMouseUpAction=[!RunCommand mMakeText Run]
I always seem to get ideas that I need help with on this skin... :???:
Thanks for any help.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2601
Joined: March 23rd, 2015, 5:26 pm

Re: Can RunCommand be used to create a txt file

Post by SilverAzide »

CodeCode wrote: March 5th, 2023, 7:05 pm Can RunCommand be used to create a txt file
Of course it can; it can do anything you can do at a command or Powershell prompt. But what are you trying to create exactly? The command you are using, type nul > Tracks.txt, is just going to create a zero-byte file named Tracks.txt, which isn't terribly useful.
Gadgets Wiki GitHub More Gadgets...
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can RunCommand be used to create a txt file

Post by balala »

SilverAzide wrote: March 5th, 2023, 8:21 pm The command you are using, type nul > Tracks.txt, is just going to create a zero-byte file named Tracks.txt, which isn't terribly useful.
Additionally the Program=cmd.exe or PowerShell option is not correct either, because can't be used both programs, Cmd and PowerShell in the same measure.
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Can RunCommand be used to create a txt file

Post by CodeCode »

SilverAzide wrote: March 5th, 2023, 8:21 pm Of course it can; it can do anything you can do at a command or Powershell prompt. But what are you trying to create exactly? The command you are using, type nul > Tracks.txt, is just going to create a zero-byte file named Tracks.txt, which isn't terribly useful.
Hi SilverAxzide.

The ideal is exactly that.; create an empty text file in the correct directory. and have the txt file open and then have it be parsed once fill edit out put. just streamlining the file to ctrl-s process, and making the desired path be the location as a long playing mp3 with arbitrary pieced in the mp3.

So, trying to manage several fields tracks.ini for practically any file with no pause between tracks/. Nothing I have tried yet sums to get many further \than saying the path was being requested for saving the path rather tan the destination folder shared with a mp3 to copy navigate then save again. Rather than files manually - the txt file/s.

I hope that helped clarify my working model.? :rosegift:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Can RunCommand be used to create a txt file

Post by CodeCode »

balala wrote: March 5th, 2023, 9:28 pm Additionally the Program=cmd.exe or PowerShell option is not correct either, because can't be used both programs, Cmd and PowerShell in the same measure.
works for me if it gets the job doe.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Can RunCommand be used to create a txt file

Post by CodeCode »

balala wrote: March 5th, 2023, 9:28 pm Additionally the Program=cmd.exe or PowerShell option is not correct either, because can't be used both programs, Cmd and PowerShell in the same measure.
Ye, I put both, not knowing which was best suited for this task.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can RunCommand be used to create a txt file

Post by balala »

CodeCode wrote: March 5th, 2023, 7:05 pm I am adding another feature to my music mini suite, but having tried several ways I don't think I am getting closer to a solution so far as I understand the RunCommand plugin and what I've come across when googling:
My approach on this:

Code: Select all

[mMakeText]
Measure=Plugin
Plugin=RunCommand
Parameter=echo Text to be included into the file > Tracks.txt
State=Hide
;OutPutFile=Current bottom level folder / StartInFolder ,-Needs to be dynamically recognised for any path the NowPlaying track is in.
I commented out the OutputFile option. In this option you should have a file name. Am I correct when thinking the string you've entered into this option is the string you want to include into the newly created file? If I am, add this string into the Parameter option, between the echo command and the > character (no quotes are required).
If needed, you can add the result returned by a measure as well. For instance:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H:%M:%S

[mMakeText]
Measure=Plugin
Plugin=RunCommand
Parameter=echo [MeasureTime] > Tracks.txt
State=Hide
DynamicVariables=1
The measure can be executed with the [!CommandMeasure "mMakeText" "Run"] bang. You can use this bang into a LeftMouseUpAction, as posted.
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Can RunCommand be used to create a txt file

Post by CodeCode »

Hi balala
That creates the file in the skin directory.

I was really hoping I could specify a path where the file would be needed
And the zero byte file is certainly useless, so placing a string in the file creates an actual txt file that can be edited.

I am on a mobile my internet is down for correcting tomorrow morning,

So I can’t really see this phone really good at the moment,

The path would be taken from the playertype=file which captures the path of the currently playing mp3 file

Can that work the way I am hoping?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Can RunCommand be used to create a txt file

Post by eclectic-tech »

CodeCode wrote: March 7th, 2023, 10:23 am Hi balala
That creates the file in the skin directory.

I was really hoping I could specify a path where the file would be needed
And the zero byte file is certainly useless, so placing a string in the file creates an actual txt file that can be edited.

I am on a mobile my internet is down for correcting tomorrow morning,

So I can’t really see this phone really good at the moment,

The path would be taken from the playertype=file which captures the path of the currently playing mp3 file

Can that work the way I am hoping?
Try this:

Code: Select all

[MeasurePath]
Measure=NowPlaying
Playername=[MeasureTitle]
PlayerType=File
RegExpSubstitute=1
Substitute="^(.*)\\.*$":"\1"
; ,"(^.*$)":"\1\"
DynamicVariables=1

[mMakeText]
Measure=Plugin
Plugin=RunCommand
; Program=%ComSpec% \U \C
Parameter=""echo Enter the desired info and save with encoding ANSI > tracks.txt""
State=Hide
StartInFolder=[&MeasurePath]
FinishAction=["[MeasurePath]\Tracks.txt"]
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can RunCommand be used to create a txt file

Post by balala »

CodeCode wrote: March 7th, 2023, 10:23 am Can that work the way I am hoping?
Besides eclectic-tech's code, everything you asked for is definitely possible.
CodeCode wrote: March 7th, 2023, 10:23 am That creates the file in the skin directory.

I was really hoping I could specify a path where the file would be needed
For instance:

Code: Select all

[mMakeText]
Measure=Plugin
Plugin=RunCommand
Parameter=echo Enter the desired info and save with encoding ANSI > D:\MyFolder\Tracks.txt
State=Hide
DynamicVariables=1
The Tracks.txt file is created into the D:\MyFolder folder. The command used into the RunCommand plugin measure being in fact a cmd command, you can create the file anywhere you want on any of the accessible drives.
CodeCode wrote: March 7th, 2023, 10:23 am The path would be taken from the playertype=file which captures the path of the currently playing mp3 file
So for instance from a NowPlaying measure, having a PlayerType=Cover option? If the option returns a folder (the above measure doesn't do this, it returns the path of an image, but with substitution for example, this can be done), using this measure to specify the path where the file will be created is definitely possible.
Another example:

Code: Select all

[MeasurePlayer]
Measure=NowPlaying
PlayerName=WMP
PlayerType=Cover
RegExpSubstitute=1
Substitute="(.*)\\.*\..*":"\1"

[mMakeText]
Measure=Plugin
Plugin=RunCommand
Parameter=echo Enter the desired info and save with encoding ANSI > [MeasurePlayer]\Tracks.txt
State=Hide
DynamicVariables=1
The Tracks.txt file is created in the folder returned by the [MeasurePlayer] measure, which has a substitution to eliminate the name of the file. This way the measure returns the path of a folder and the new Tracks.txt file is created in this folder, when you click (obviously you have to have somewhere the LeftMouseUpAction=[!CommandMeasure "mMakeText" "Run"] option, to can get the measure executed and the file created).