It is currently April 20th, 2024, 10:35 am

Kind of an issue with run command plugin

Get help with creating, editing & fixing problems with skins
User avatar
LGP123
Posts: 60
Joined: November 5th, 2016, 12:15 pm

Kind of an issue with run command plugin

Post by LGP123 »

So I am currently re-creating my sys-info skin modules and I want for my drive's module to get the current drives available.
To do this, I use the Run Command plugin with the parameter wmic logicaldisk get caption.
The probleme here is that, probably because my current applocale is in japanese, when I use the !log bang or simply a string meter with the string value to get (and check if it works) of the Run Command measure, it gives me : 慃瑰潩ഠ਍㩃†††ഠ਍㩄†††ഠ਍㩅†††ഠ਍㩆†††ഠ਍㩇†††ഠ਍഍. So yeah something is clearly wrong here.
Also when I make the Parameter be wmic logicaldisk get caption > Output.txt (so that it should output the "logs" in the file "output.txt") it gives me what I want.

The problem here is that I know that if I change back to an english applocale it should fix the issue but I want to tell that It can cause incompatibility issue (so the skin doesn't work properly) with applocales like japanese.

So here is my little test skin :

Code: Select all

[Rainmeter]
Update=1000
OnrefreshAction=!commandMeasure "MeaRunCommand" "Run"

[MeaRunCommand]
Measure=Plugin
Plugin=RunCommand
FinishAction=!log [MeaRunCommand]
DynamicVariables=1
Parameter=wmic logicaldisk get caption

[MeStr]
Meter=STRING
MeasureName=MeaRunCommand
FontSize=20
H=50
W=200
SolidColor=000000FF
FontColor=FFFFFF
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: Kind of an issue with run command plugin

Post by SilverAzide »

LGP123 wrote:So I am currently re-creating my sys-info skin modules and I want for my drive's module to get the current drives available.
To do this, I use the Run Command plugin with the parameter wmic logicaldisk get caption.
The probleme here is that, probably because my current applocale is in japanese, when I use the !log bang or simply a string meter with the string value to get (and check if it works) of the Run Command measure, it gives me : 慃瑰潩ഠ਍㩃†††ഠ਍㩄†††ഠ਍㩅†††ഠ਍㩆†††ഠ਍㩇†††ഠ਍഍. So yeah something is clearly wrong here.
Also when I make the Parameter be wmic logicaldisk get caption > Output.txt (so that it should output the "logs" in the file "output.txt") it gives me what I want.

The problem here is that I know that if I change back to an english applocale it should fix the issue but I want to tell that It can cause incompatibility issue (so the skin doesn't work properly) with applocales like japanese.
I ran into this recently also. This is a known issue with the command processor and also applies to PowerShell, in that neither support Unicode properly. I believe the upcoming Windows 10 update will include an enhancement that will finally correct this issue.

If you want to use WMI to get the labels, try changing to PowerShell, which will allow you to change the encoding. Change your RunCommand measure to something like this:

Code: Select all

[MeasureRunGetLabel]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "[Console]::OutputEncoding = New-Object -TypeName System.Text.UnicodeEncoding; Get-WmiObject -Class Win32_LogicalDisk | Select Name | Format-Table -AutoSize""
OutputType=UTF16
State=Hide
Timeout=-1
Substitute="#CRLF#":""
You can add the -HideTableHeaders switch after -AutoSize if you want to hide the header and just get the drives.
Gadgets Wiki GitHub More Gadgets...
User avatar
LGP123
Posts: 60
Joined: November 5th, 2016, 12:15 pm

Re: Kind of an issue with run command plugin

Post by LGP123 »

SilverAzide wrote:If you want to use WMI to get the labels, try changing to PowerShell, which will allow you to change the encoding. Change your RunCommand measure to something like this:
Gosh I never thought about this, it is really smart ! Thanks for the tip.

I also tried to use a luascript wich would read the output.txt file as an alternative, but unfortunately it doesn't work.
If I print it, it says C;
if I read the file and then output it right away it makes that :

Code: Select all

Caption  
਍䌀㨀       ഀഀ
D:       
਍䔀㨀       ഀഀ
F:       
਍䜀㨀       ഀഀ
.

So yeah rainmeter has some improvement to do with alternative locales :3.
Anyway I'll go with powershell.