It is currently August 9th, 2020, 8:20 am

RunCommand

Share and get help with Plugins and Addons
User avatar
Brian
Developer
Posts: 2044
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - WIP (0.0.0.3)

Post by Brian »

Moshi, could you try this version?
RunCommand - Beta_0.0.0.3b.rmskin
This version completely eliminates OutputType=Auto since there is no real way to detect if a string is UTF-8 encoded or not. So instead of auto detecting, this version requires an OutputType. Options include: ANSI, UTF8 and UTF16 (which used to be the "Unicode" option). UTF16 is the default since the default program is still "%ComSpec%" /U /C. The encoding of the OutputFile will correlate to the OutputType.

Also, I re-ordered some of the code to capture the output quicker in hopes of fixing the problem no output capture.

-Brian
You do not have the required permissions to view the files attached to this post.
User avatar
moshi
Posts: 1850
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - WIP (0.0.0.3)

Post by moshi »

Brian wrote:This version completely eliminates OutputType=Auto since there is no real way to detect if a string is UTF-8 encoded or not. So instead of auto detecting, this version requires an OutputType. Options include: ANSI, UTF8 and UTF16 (which used to be the "Unicode" option). UTF16 is the default since the default program is still "%ComSpec%" /U /C. The encoding of the OutputFile will correlate to the OutputType.
congrats! works just like it should. :bow:
i see the UTF-8 OutputFile is now encoded as "UTF-8 with BOM". so there is this control character in front. WebParser can handle this just fine. i have no idea whether Lua can deal with such files.
one thing for the distant future: recently i discovered that at least for me, that i like using the Quote plugin for local files as it is faster than the Webparser plugin. i am aware that it does not support UTF-8 of any kind. not really necessary but maybe worth a thought.
Brian wrote:Also, I re-ordered some of the code to capture the output quicker in hopes of fixing the problem no output capture.
not sure about this one. it seems a little worse than before.
User avatar
jsmorley
Developer
Posts: 21225
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: RunCommand - WIP (0.0.0.3)

Post by jsmorley »

FYI, Lua is fine with the BOM.
User avatar
moshi
Posts: 1850
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - WIP (0.0.0.3)

Post by moshi »

is it possible to pass multiple parameters containing spaces to a batch file?
what works on the command line is:

Code: Select all

mail.bat "FirstName LastName" sender@gmail.com password recipient@example.com "This is the subject" "This is the body"
i tried multiple variations of quotes with the Parameter option, but they all seem to fail.

maybe something like this would be nice:

Code: Select all

Program=mail.bat
Parameter=""FirstName LastName""
Parameter2=sender@gmail.com
Parameter3=password
Parameter4=recipient@example.com
Parameter5=""This is the subject""
Parameter6=""This is the body""
User avatar
Brian
Developer
Posts: 2044
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - WIP (0.0.0.3)

Post by Brian »

moshi wrote:i tried multiple variations of quotes with the Parameter option, but they all seem to fail.
It should be possible. I would probably do it like this:

Code: Select all

Program=mail.bat
Parameter=""FirstName LastName" "sender@gmail.com" "password" "recipient@example.com" "This is the subject" "This is the body""
Notice that I did not double quote each parameter, just the beginning and end of the Parameter option itself.

To catch the spaces inside the parameters, you may need to edit your batch file. Normally you would have %1 to represent your parameter. You can add the "~" modifier to capture parameters with spaces. You may also need to add quotes around it as well. So %1 becomes "%~1".

Someone correct me if I am wrong as it has been a while since I have done anything like that.

-Brian
User avatar
moshi
Posts: 1850
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - WIP (0.0.0.3)

Post by moshi »

works like a charm! thanks :thumbup:

did not need to edit the batch file.
actually the tilde is needed to strip the quotes

mail.bat "FirstName LastName" sender@gmail.com ...

Code: Select all

echo From: %1 ^<%2^> >mail.txt
would become

Code: Select all

From: "FirstName LastName" <sender@gmail.com>
while i what i do is

Code: Select all

echo From: %~1 ^<%2^> >mail.txt
to get

Code: Select all

From: FirstName LastName <sender@gmail.com>
User avatar
Brian
Developer
Posts: 2044
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - Beta (0.0.1.0)

Post by Brian »

Version 0.0.1.0 (Beta) is now available here: http://rainmeter.net/forum/viewtopic.php?p=92974#p92974

moshi wrote:did not need to edit the batch file.
actually the tilde is needed to strip the quotes
Yeah, you are right. Its been too long since I have programmed batch files... :?

And thanks for all the testing. I really appreciate it!

-Brian
User avatar
moshi
Posts: 1850
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - Beta (0.0.1.0)

Post by moshi »

no problem at all. i like this plugin a lot, as it makes many things easier.
using a plugin and displaying the measure is a concept even a monkey can understand, while doing the same with several scripts and reading a redirected text output takes a lot more steps.

and i already have this skin (and a few calendars) here:
SphynxMailer.jpg
works great. but it is a little scary how easy it would be to steal other people's account details.

i am just not sure whether to upload it or not. will this plugin become a part of the standard Rainmeter install? or would, if i would include the plugin, the included one overwrite an eventually already installed newer version of the plugin?
You do not have the required permissions to view the files attached to this post.
User avatar
Brian
Developer
Posts: 2044
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - Beta (0.0.1.0)

Post by Brian »

moshi wrote:will this plugin become a part of the standard Rainmeter install?
We don't have any concrete plans to add this plugin as part of the Rainmeter install at this time. jsmorley, poiru and I talked about it briefly almost 2 months ago and concluded that it might be best to release it separately for now to judge its use by others (especially from countries outside the US).

moshi wrote:if i would include the plugin, the included one overwrite an eventually already installed newer version of the plugin?
If the plugin does make it into the standard Rainmeter installation, then that is the plugin that will always be used (no matter if a separate "3rd-party" plugin gets installed). Rainmeter always uses the plugins in the "Program Files\Plugins" folder over any 3rd party plugins located in the "%AppData%\Rainmeter\Plugins" folder (even if it is the same plugin, but a different version).

If the plugin does not make it into the standard Rainmeter installation, then the plugin could get overwritten when someone installs an "older" version of the plugin. Of course the user can tell Rainmeter to not install a plugin when installing a .rmskin (they would need to uncheck the plugin checkbox) - but I doubt a regular user ever does that (or even knows about it).

moshi wrote:i am just not sure whether to upload it or not.
This is totally up to you. Since the plugin is still a "beta", you may want to wait until a final version is done (which I think will be soon!).

-Brian
User avatar
moshi
Posts: 1850
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - Beta (0.0.1.0)

Post by moshi »

Brian wrote:If the plugin does not make it into the standard Rainmeter installation, then the plugin could get overwritten when someone installs an "older" version of the plugin. Of course the user can tell Rainmeter to not install a plugin when installing a .rmskin (they would need to uncheck the plugin checkbox) - but I doubt a regular user ever does that (or even knows about it).
yeah, that's a bad situation. can hardly be solved nicely with 32 and 64 bit versions.

my biggest problem with it right now is that i can not use the value of a measure with a FinishAction.

With the Webparser plugin i can do things like:

Code: Select all

[MeasureEvi]
Measure=Plugin
Plugin=Plugins\WebParser.dll
...
FinishAction=["someapplication.exe" "[MeasureEvi]"]
would be cool if RunCommand could do the same.

an OnChangeAction wont help in the scenario i have in mind, as the value (success or error) might not change, but still something new has happened.