It is currently March 29th, 2024, 5:25 am

RunCommand

Share and get help with Plugins and Addons
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - WIP

Post by moshi »

Brian wrote:Actually this way is highly inefficient anyway. It is often forgotten that when DynamicVariables is defined, the meter/measure will read all of its values on every update.
thanks for the information.
Brian wrote:@mgp123.exe: I am not entirely sure how that programs works. If the program expects input (even to close), then it won't play well with this plugin at all. I noticed you did a control-C to exit that program, so I am not sure if it will work or not. I can try to play with that program later.
i was kinda expecting that. the program doesn't close itself, but keeps streaming. i was hoping to get the metadata of the single tracks (similar to a tail command). WebParser is kinda pointless for this without hammering the server every few seconds or so, seems i have to look harder in the mpg123 documentation.



i noticed there are still hiccups. it seems that sometimes when the action is finished, the output is not fetched (this does not happen very often, maybe one out of forty times):
Untitled-1.jpg
this skin uses three RunCommand measure for three months. i have attached it.
You do not have the required permissions to view the files attached to this post.
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - WIP (0.0.0.2)

Post by Brian »

Version 0.0.0.2 is now available. This version adds Unicode support (at least in most cases, I hope). Get it here.

moshi wrote:i was kinda expecting that. the program doesn't close itself, but keeps streaming. i was hoping to get the metadata of the single tracks (similar to a tail command). WebParser is kinda pointless for this without hammering the server every few seconds or so, seems i have to look harder in the mpg123 documentation.
If the program could close itself, you could set up a timer to run the program every second or two and parse the output, but that isn't a great solution either (even if it is possible).

moshi wrote:i noticed there are still hiccups. it seems that sometimes when the action is finished, the output is not fetched (this does not happen very often, maybe one out of forty times):
Could you try this with version 0.0.0.2? Before the plugin would wait for up to 100ms when waiting for the FinishAction to "finish". I increased that to 200ms.


It should also be noted that output files will now be saved in UTF-16LE encoding.

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

Re: RunCommand - WIP (0.0.0.2)

Post by moshi »

Brian wrote:Could you try this with version 0.0.0.2? Before the plugin would wait for up to 100ms when waiting for the FinishAction to "finish". I increased that to 200ms.
it still happens, but not as often as before (and no longer when the computer is running normal). as expected this happens frequently when the computer is busy, like on a !RefreshAll with a few complex skins for example.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - WIP (0.0.0.2)

Post by moshi »

Brian wrote:Update: I have made some progress with Unicode for the plugin, however, it has introduced some other problems that I am still working out. Hopefully a solution presents itself.
indeed. if you want to see something weird then try the calendar skin i attached above and set your system time to a different year. refresh the skin ...
the cal application works flawlessly in the console of course. this did not happen in the first version if i remember correctly.

even more interesting: set your system time to January 2014. December 2013 (previous month) on the left will be displayed fine, the other two months are the weirdest gibberish i have seen yet.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - WIP (0.0.0.2)

Post by moshi »

not sure if this is useful for you. this produces gibberish as well:

Code: Select all

[Command]
Measure=Plugin
Plugin=RunCommand
Program=
Parameter=wmic process where name="rainmeter.exe" get /format:rawxml
State=Hide
what i found interesting is that the first part is a varying amount of gibberish while the rest of the measure string is just as it should be.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - WIP (0.0.0.2)

Post by moshi »

moshi wrote:not sure if this is useful for you. this produces gibberish as well:

Code: Select all

[Command]
Measure=Plugin
Plugin=RunCommand
Program=
Parameter=wmic process where name="rainmeter.exe" get /format:rawxml
State=Hide
what i found interesting is that the first part is a varying amount of gibberish while the rest of the measure string is just as it should be.

even weirder thing is: other process names produce no gibberish at all.

and just like with the cal.exe mentioned above there should be no unicode character in the output at all.

clueless thought: is it certain character combinations that trigger this?
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - WIP (0.0.0.2)

Post by Brian »

moshi wrote:clueless thought: is it certain character combinations that trigger this?
The problem lies when certain control characters combined with ascii characters produce valid Unicode. In fact in all your examples, if you save the file and open in a hex editor, the text is correct.

I have already semi-fixed this issue for the next version. Also, I will be introducing a new option called OutputType that defaults to "Auto" and has options "Ansi" and "Unicode". I think rather than spending so much time "auto-detecting", I will just transfer the power to the author and give them a choice.

The next version will also close any program that is running if the skin and/or Rainmeter is closed. This should fix any hidden programs from running beyond the scope of the skin or Rainmeter itself.

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

Re: RunCommand - WIP (0.0.0.2)

Post by moshi »

Brian wrote:Also, I will be introducing a new option called OutputType that defaults to "Auto" and has options "Ansi" and "Unicode". I think rather than spending so much time "auto-detecting", I will just transfer the power to the author and give them a choice.
good idea.
Brian wrote:The next version will also close any program that is running if the skin and/or Rainmeter is closed. This should fix any hidden programs from running beyond the scope of the skin or Rainmeter itself.
good for hidden programs. not good for the other states.
User avatar
Brian
Developer
Posts: 2674
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - WIP (0.0.0.3)

Post by Brian »

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

This version adds an option "OutputType". This option represents what you expect the output to be (not what you want it to be).

Options include:
Auto - This will attempt to detect what type of output the program produces and encode the OutputFile accordingly.
Ansi - This assumes the output is ANSI encoded. The OutputFile will also be ANSI encoded.
Unicode - This assumes the output is Unicode encoded. This OutputFile will be UTF-16LE encoded.

This version also will close the Program when closing the skin and/or Rainmeter. This only applies to programs started in the hidden state.

moshi wrote: it still happens, but not as often as before (and no longer when the computer is running normal). as expected this happens frequently when the computer is busy, like on a !RefreshAll with a few complex skins for example.
I increased this "timeout" value to 500ms. I really don't want to go beyond that because technically this pauses Rainmeter until it the FinishAction is done. If this continues to be a problem, I can try some other things.

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

Re: RunCommand - WIP (0.0.0.3)

Post by moshi »

Brian wrote:I increased this "timeout" value to 500ms. I really don't want to go beyond that because technically this pauses Rainmeter until it the FinishAction is done. If this continues to be a problem, I can try some other things.
it still happens.
i am just guessing. might it be a reason for the hiccups that in the calendar skin above it executes the same command (with different parameters) three times?
i am starting them one after another using FinishAction, but that doesn't really make a difference.