It is currently May 25th, 2019, 2:22 pm

Issue with spaces with RunCommand?

Report bugs with the Rainmeter application and suggest features.
soyelrafa
Posts: 73
Joined: March 1st, 2017, 3:09 pm

Issue with spaces with RunCommand?

soyelrafa » May 1st, 2019, 3:44 pm

Hello! I think I found a little bug in the last release with RunCommand (or maybe I'm doing something wrong?).

If the path have spaces the runcommand will fail, at least with notepad. I created two folders, "Test" and "This is a Test", and placed a .txt inside both folders. With "test" folder I don't have any issue, but with "This is a Test" doesn't appear the txt. And I don't get any warning or anything in the logger.

Test skin that doesn't work:

Code: Select all

[Rainmeter]
Update=-1
OnRefreshAction=[!CommandMeasure "Test" "Run"]

[Test]
Measure=Plugin
Plugin=RunCommand
Parameter="E:\This is a Test\test.txt"
State=Show
OutputFile=
FinishAction=[]
Test skin that works:

Code: Select all

[Rainmeter]
Update=-1
OnRefreshAction=[!CommandMeasure "Test" "Run"]

[Test]
Measure=Plugin
Plugin=RunCommand
Parameter="E:\Test\test.txt"
State=Show
OutputFile=
FinishAction=[]
Rainmeter data:
Rainmeter 4.3.0.3298 (64-bit)
Language: Spanish (3082)
Build time: 2019-03-18 11:00:34
Commit Hash: 3593c281
Windows 10 Pro 1809 64-bit (build 17763) - Spanish (3082)
Path: C:\Program Files\Rainmeter\
SkinPath: C:\Users\User\Documents\Rainmeter\Skins\
SettingsPath: C:\Users\User\AppData\Roaming\Rainmeter\
IniFile: C:\Users\User\AppData\Roaming\Rainmeter\Rainmeter.ini
Regards.
Last edited by soyelrafa on May 1st, 2019, 5:22 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 19245
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Issue with spaces with RunCommand?

jsmorley » May 1st, 2019, 3:49 pm

soyelrafa wrote:
May 1st, 2019, 3:44 pm
Hello! I think I found a little bug in the last release with RunCommand (or maybe I'm doing something wrong?).

If the path have spaces the runcommand will fail, at least with notepad. I created two folders, "Test" and "This is a Test", and placed a .txt inside both folders. With "test" folder I don't have any issue, but with "This is a Test" doesn't appear the txt. And I don't get any warning or anything in the logger.
Yes, "quotes" at the beginning and end of any Rainmeter option value are always stripped off when the option value is read. In order to pass literal "quotes" to your command, you will need two sets of "quotes" on the option value:

Parameter=""E:\This is a Test\test.txt""


https://docs.rainmeter.net/manual/plugins/runcommand/
Note: Because Rainmeter strips any quotes from the start and end of an option if both exist, it is important to double double-quote the Program and Parameter options If the overall command or parameter requires both starting and ending quotes.
soyelrafa
Posts: 73
Joined: March 1st, 2017, 3:09 pm

Re: Issue with spaces with RunCommand?

soyelrafa » May 1st, 2019, 3:57 pm

jsmorley wrote:
May 1st, 2019, 3:49 pm
Yes, "quotes" at the beginning and end of any Rainmeter option value are always stripped off when the option value is read. In order to pass literal "quotes" to your command, you will need two sets of "quotes" on the option value:

Parameter=""E:\This is a Test\test.txt""


https://docs.rainmeter.net/manual/plugins/runcommand/
WTF?

This doesn't work for me: Parameter=""E:\This is a Test\Test\test.txt""

But what do you writes does work: Parameter=""E:\This is a Test\test.txt""

Did you use another type of double-qoutes?

In my defense I should say I tested too with double quotes, but didn't work haha.
User avatar
jsmorley
Developer
Posts: 19245
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Issue with spaces with RunCommand?

jsmorley » May 1st, 2019, 4:00 pm

soyelrafa wrote:
May 1st, 2019, 3:57 pm
WTF?

This doesn't work for me: Parameter=""E:\This is a Test\Test\test.txt""

But what do you writes does work: Parameter=""E:\This is a Test\test.txt""

Did you use another type of double-qoutes?

In my defense I should say I tested too with double quotes, but didn't work haha.
Uhm... No. I only have " on my keyboard...
User avatar
jsmorley
Developer
Posts: 19245
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Issue with spaces with RunCommand?

jsmorley » May 1st, 2019, 4:03 pm

soyelrafa wrote:
May 1st, 2019, 3:57 pm
WTF?

This doesn't work for me: Parameter=""E:\This is a Test\Test\test.txt""

But what do you writes does work: Parameter=""E:\This is a Test\test.txt""

Did you use another type of double-qoutes?

In my defense I should say I tested too with double quotes, but didn't work haha.
This:
Parameter=""E:\This is a Test\Test\test.txt""

And this:
Parameter=""E:\This is a Test\test.txt""

Are entirely different things...
soyelrafa
Posts: 73
Joined: March 1st, 2017, 3:09 pm

Re: Issue with spaces with RunCommand?

soyelrafa » May 1st, 2019, 4:29 pm

jsmorley wrote:
May 1st, 2019, 4:03 pm
This:
Parameter=""E:\This is a Test\Test\test.txt""

And this:
Parameter=""E:\This is a Test\test.txt""

Are entirely different things...
Yeah, sorry, that was my fault then. But my original issue still persist, with more information though. Now I know it's a lua issue then, probably mine:

Code: Select all

function Initialize
testing = "E:\\Test\\test.txt"
SKIN:Bang(('[!SetOption "Test" "Parameter" "%s"]'):format(testing)
SKIN:Bang('[!CommandMeasure "Test" "Run"]')
end
This works, but if I add the double double quotes on %s rainmeter logger says "!SetOption: Skin "E:\Test\test.txt" not found"
User avatar
jsmorley
Developer
Posts: 19245
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Issue with spaces with RunCommand?

jsmorley » May 1st, 2019, 4:34 pm

Dunno... I do see mismatched (parentheses) here:

SKIN:Bang(('[!SetOption "Test" "Parameter" "%s"]'):format(testing)
User avatar
jsmorley
Developer
Posts: 19245
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Issue with spaces with RunCommand?

jsmorley » May 1st, 2019, 4:39 pm

You might try escaping the embedded "double quotes" \" in the bang in Lua, so Lua doesn't try to treat them as functional quotes in context of the string.

SKIN:Bang('[!SetOption \"Test\" \"Parameter\" \"\"%s\"\"]'):format(testing)
User avatar
jsmorley
Developer
Posts: 19245
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Issue with spaces with RunCommand?

jsmorley » May 1st, 2019, 4:45 pm

The format of the Bang() function you are using is wrong.

https://docs.rainmeter.net/manual/lua-scripting/#Bang
User avatar
jsmorley
Developer
Posts: 19245
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Issue with spaces with RunCommand?

jsmorley » May 1st, 2019, 4:48 pm

I would try:

SKIN:Bang('!SetOption', 'Test', 'Parameter', '\"\"%s\"\"'):format(testing)

I have no idea if the format() function can be used/passed to a SKIN:Bang() function that way, maybe, maybe not.