It is currently April 27th, 2024, 11:18 pm

RunCommand parameter weirdness

Report bugs with the Rainmeter application and suggest features.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

RunCommand parameter weirdness

Post by mak_kawa »

Really weird for me as a Rainmeter novice. When I "run" this plugin measure, Whole Rainmeter is closed silently with no error/message.

Code: Select all

[EraseDataFile]
Measure=Plugin
Plugin=RunCommand
Parameter=erase %TEMP%\Test.txt
Why? I have thoroughly no idea for the reason. I tentatively used (double) quotation marks around the parameter, but no luck.

For reference, [cmd.exe /c erase %TEMP%\Test.txt] action works fine, but it is a bit annoying that a command prompt window blinks in a moment.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RunCommand parameter weirdness

Post by jsmorley »

I have no idea. This works perfect fine for me:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeterErase]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Click Me
LeftMouseUpAction=[!CommandMeasure EraseDataFile "Run"]

[EraseDataFile]
Measure=Plugin
Plugin=RunCommand
Parameter=erase %TEMP%\Test.txt
You need to be sure that Test.txt (or whatever it really is) isn't "locked" for some reason, perhaps by whatever process is creating it. No reason to think that would crash Rainmeter, but something about your situation is different than mine.

4.0.0 beta r2627 64-bit (Sep 12 2016)
Windows 10 Pro 64-bit (build 14393)
Path: C:\Program Files\Rainmeter\
IniFile: C:\Users\Jeffrey\AppData\Roaming\Rainmeter\Rainmeter.ini
SkinPath: C:\Users\Jeffrey\Documents\Rainmeter\Skins\

%TEMP% = C:\Users\Jeffrey\AppData\Local\Temp
User avatar
balala
Rainmeter Sage
Posts: 16182
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: RunCommand parameter weirdness

Post by balala »

As jsmorley said, it also works perfectly for me too.
But mak_kawa, if the [cmd.exe /c erase %TEMP%\Test.txt] command works for you, you could use jsmorley's code and replace the Parameter option of the [EraseDataFile] measure with Parameter=cmd.exe /c erase %TEMP%\Test.txt. This way you'll avoid the blinking of the command prompt.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: RunCommand parameter weirdness

Post by mak_kawa »

Hi jsmorley and balala. Thank you for spending time on testing based on my code.

It is now realized by subsequent testing that my issue occurs only in OnCloseAction. In other action, LeftMouseUpAction for example, there is no problem. Surprised, and it is really a mystery for me.

4.0.0 beta r2627 64-bit (Sep 12 2016)
Windows 10 Home 64-bit (build 14393)
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: RunCommand parameter weirdness

Post by mak_kawa »

Test result;

OnCloseAction=[!CommandMeasure EraseDataFile "Run"] -> Rainmeter closed
OnCloseAction=[cmd.exe /c erase d:\work\Test.txt] -> works fine
LeftMouseUpAction=[!CommandMeasure EraseDataFile "Run"] -> works fine
LeftMouseUpAction=[cmd.exe /c erase d:\work\Test.txt] -> works fine

That is...the problem is only seen in run CommandMeasure in OnCloseAction.
User avatar
Brian
Developer
Posts: 2688
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand parameter weirdness

Post by Brian »

This is indeed a bug in the plugin.

[Technical details]
The problem is basically OnCloseAction happens just before the skin is completely unloaded and the measures are destroyed. However, since the plugin is ran just as that happens, there is a chicken/egg problem where the thread is launched to execute the command, however just before it starts (on some systems) the measure tries to destroy itself and is looking for the the newly created process to terminate...but since it hasn't started yet, there is no process to terminate and an invalid parameter is sent to the terminate system command. So, its basically a timing issue. Some systems will execute the thread faster then the measure is destroyed...and some will not.

Anyway, this will be fixed in the next beta release. Thank you for reporting.

-Brian
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: RunCommand parameter weirdness

Post by mak_kawa »

Hi Brian
Really appreciate your confirmation about this issue.
I am looking forward to the fix. Thank you.
User avatar
Brian
Developer
Posts: 2688
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand parameter weirdness

Post by Brian »

@mak_kawa: We may not be releasing a public beta for a little while, so if you would like a fixed version of the RunCommand plugin, you can use this beta that has all the fixes: https://builds.rainmeter.net/Rainmeter-4.0-r2637-beta.exe

Be sure to report back if this did not fix your problem, although I believe it does. I was able to replicate the problem and this version fixes it for me.

-Brian
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: RunCommand parameter weirdness

Post by mak_kawa »

Hi Brian.

Thank you for quick response. Really appreciated.

But...unfortunately r2637 beta does not work properly. RunCommand dosen't do nothing both in LeftMouseUpAction and OnCloseAction.

There are warning messages in log window -> Warning: CommandMeasure not supported. Probably "Run" command failed.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RunCommand parameter weirdness

Post by jsmorley »

mak_kawa wrote:Hi Brian.

Thank you for quick response. Really appreciated.

But...unfortunately r2637 beta does not work properly. RunCommand dosen't do nothing both in LeftMouseUpAction and OnCloseAction.

There are warning messages in log window -> Warning: CommandMeasure not supported. Probably "Run" command failed.
Yes, something has come off the rails with this fix. We will look at it and get back to you later today.