It is currently April 27th, 2024, 3:00 am

RunCommand

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

Re: RunCommand - Beta (0.0.1.3)

Post by moshi »

Brian wrote:I changed the behavior a little bit on this version.
it's a pity Rainmeter looses the data of the plugin at a refresh. but yes, in this case i think the changes you made are necessary.
Brian wrote:CPU usage when the program is running should be greatly diminished with this version.
very nice. this also solved the problem of the plugin not fetching output for me. :thumbup:
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - Beta (0.0.1.3)

Post by moshi »

i just noticed that Rainmeter crashes when the output is very large. (a redirected text file with the same output is about 10 KB).

not sure if there is anything that can (or even should) be done about that. maybe a short note in the docs would do.

in my case i was reading an email with cURL/IMAP. that seems to be too much for Rainmeter as soon as there are images/attachments involved. "solved" it by reading the header section only.
User avatar
Brian
Developer
Posts: 2686
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - Beta (0.0.1.3)

Post by Brian »

moshi wrote:i just noticed that Rainmeter crashes when the output is very large. (a redirected text file with the same output is about 10 KB).

not sure if there is anything that can (or even should) be done about that. maybe a short note in the docs would do.
This should be fixed in the next version. Hopefully, it won't crash anymore. With the previous version I tried to read a 2MB text file (with the "type" command), and plugin crashed Rainmeter. With the new version, the plugin read the 2MB file just fine (took a second or so). However, Rainmeter took a while to display to that amount of text (and it used a lot of memory) - but obviously this isn't a practical use of Rainmeter at all.

moshi wrote:in my case i was reading an email with cURL/IMAP. that seems to be too much for Rainmeter as soon as there are images/attachments involved. "solved" it by reading the header section only.
The next version should also help with this, at least with the "size" being read. However, I am not sure if any images/attachments are useful in the context of Rainmeter.

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

Re: RunCommand - Beta (0.0.1.3)

Post by moshi »

Brian wrote:The next version should also help with this, at least with the "size" being read. However, I am not sure if any images/attachments are useful in the context of Rainmeter.
very nice. for sure not that useful. it can never replace a mail client. but i have not figured out yet how to read header and text together without the attachments.
User avatar
Brian
Developer
Posts: 2686
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand - Beta (0.0.1.4)

Post by Brian »

Version 0.0.1.4 Beta is now available here: http://rainmeter.net/forum/viewtopic.php?p=92974#p92974
moshi wrote:i just noticed that Rainmeter crashes when the output is very large. (a redirected text file with the same output is about 10 KB).
This has been fixed in the 0.0.1.4 beta. It was a simple mistake that caused the problem (a buffer overrun).


This version also sets the number value of the measure to the "status" of plugin. You can get the number value of a measure with section variables. A status of "-1" means the command has not ran yet. A status of "0", means the command is still running. A status of "1" means the command ran without errors (errors from the plugin, not the program). When the plugin has an error, it sets the number value to its error number (starting from 100 to 106). This will allow you to use IfActions to perform different actions for different status's (see the test skin in the first post).

You can find out more here: https://github.com/brianferguson/RunCommand.dll/blob/master/README.md

This plugin now requires Rainmeter 3.0.2 (r2161) to run.

BTW - I am hoping to have this be the last beta. If there are no problems that arise, look for a final version (probably 1.0.0.0) in a few days.

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

Re: RunCommand - Beta (0.0.1.4)

Post by moshi »

Brian wrote:Version 0.0.1.4 Beta is now available here: ...
works great so far. i still experienced a few crashes when using cURL and IMAP with Gmail (Yandex.Mail and Yahoo! Mail work fine). i'd blame the substitions i use for filtering and my crappy laptop rather than your plugin though.
the sub-skin i experience the crashes is more like a proof of concept than something for daily use.
User avatar
Brian
Developer
Posts: 2686
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand 1.0

Post by Brian »

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

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

Re: RunCommand 1.0

Post by moshi »

thanks a lot for this plugin. i am using it in these skins:

http://customize.org/rainmeter/skins/65672303
a calendar that doesn't require any advanced math/coding skills.

http://customize.org/rainmeter/skins/65672304
this is a little more complex. send email via SMTP and read inboxes via IMAP.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: RunCommand - Beta (0.0.1.3)

Post by moshi »

Brian wrote: 0.0.1.3+: If the Timeout is reached, the program terminates via Close unless hidden, then via Kill. If the program is still running when the skin closed or refreshed, it terminates via Close unless hidden. If any program prevents itself from closing (like cancelling any changes in Notepad), the plugin will not keep running and stop expecting any output (the Kill or Close commands should no longer work either).
i noticed a glitch here (wouldn't call it a bug).

in a skin i use bc to convert a decimal number to binary. like this:

Code: Select all

Parameter="echo ibase=10; obase=2; [HoursMeasure] | "#@#addons\bc\bc.exe""
now when i refresh this skin a few times and then close it (i think milliseconds of timing matter here), i am likely to end up with one or more instances of bc.exe and/or cmd.exe still running.
i guess the piping is the problem here.

if you want the skin to run some tests, it is here: http://yadi.sk/d/44xeQFwaCd3iM
User avatar
Brian
Developer
Posts: 2686
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: RunCommand 1.0

Post by Brian »

Although I cannot pinpoint the problem, I do believe you are correct that a piping problem is to blame. The plugin attempts to pipe to the program which is then piping to another program. This is actually dangerous when running a program that is really expecting input (like bc.exe does).

I would suggest taking a different route to accomplish this task. Since you are just converting a decimal number to binary, I would just use Lua to do this. Here is a quick and dirty example using your skin:
Regular.ini

Code: Select all

[Rainmeter]
AppVersion=2004000
Update=1000
BackgroundMode=1
ContextTitle="Size 100%"
ContextAction=[!WriteKeyValue Variables "USERSCALE" "1.0" "#@#variables.inc"][!Refresh "#CURRENTCONFIG#"]
ContextTitle2="Size 90%"
ContextAction2=[!WriteKeyValue Variables "USERSCALE" "0.9" "#@#variables.inc"][!Refresh "#CURRENTCONFIG#"]
ContextTitle3="Size 80%"
ContextAction3=[!WriteKeyValue Variables "USERSCALE" "0.8" "#@#variables.inc"][!Refresh "#CURRENTCONFIG#"]
ContextTitle4="Size 70%"
ContextAction4=[!WriteKeyValue Variables "USERSCALE" "0.7" "#@#variables.inc"][!Refresh "#CURRENTCONFIG#"]
ContextTitle5="Size 60%"
ContextAction5=[!WriteKeyValue Variables "USERSCALE" "0.6" "#@#variables.inc"][!Refresh "#CURRENTCONFIG#"]
ContextTitle6="Size 50%"
ContextAction6=[!WriteKeyValue Variables "USERSCALE" "0.5" "#@#variables.inc"][!Refresh "#CURRENTCONFIG#"]

[Metadata]
Name=Zero Seventeen
Information=
License=
Version=1.51
Author=Alex Becherer

[Variables]
@Include="#@#variables.inc"

[MeasureTextTime]
Measure=Time
Format="%I:%M"

[MeasureTextTime2]
Measure=Time
Format="%p"

[MeasureTextTime3]
Measure=Time
Format="%d-%b"

[HoursMeasure]
Measure=Script
ScriptFile=Hours.lua
RegExpSubstitute=1
Substitute="^$":"111111","^(.)$":"0\1","^(..)$":"0\1","^(...)$":"0\1","^(....)$":"0\1","^(.....)$":"0\1","^(......)$":"2\1"
OnUpdateAction=[!UpdateMeterGroup Haloo][!Redraw]

[MinutesMeasure]
Measure=Script
ScriptFile=Minutes.lua
RegExpSubstitute=1
Substitute="^$":"111111","^(.)$":"0\1","^(..)$":"0\1","^(...)$":"0\1","^(....)$":"0\1","^(.....)$":"0\1","^(......)$":"2\1"
OnUpdateAction=[!UpdateMeterGroup Maloo][!Redraw]

[SecondsMeasure]
Measure=Script
ScriptFile=Seconds.lua
RegExpSubstitute=1
Substitute="^$":"111111","111100":"0","^(.)$":"0\1","^(..)$":"0\1","^(...)$":"0\1","^(....)$":"0\1","^(.....)$":"0\1","^(......)$":"2\1"
OnUpdateAction=[!UpdateMeterGroup Saloo][!Redraw]

[MeterBack]
Meter=Image
ImageName="#@#images\gback.png"
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
UpdateDivider=-1


[MeterHour1]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(49*(#USERSCALE#))
LineStart=(41*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(88)))
StartAngle=(RAD(270))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([HoursMeasure])/10)),1))*10)=1?0:1)
Group=Haloo


[MeterHour2]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(49*(#USERSCALE#))
LineStart=(41*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(88)))
StartAngle=(RAD(0))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([HoursMeasure])/100)),1))*10)=1?0:1)
Group=Haloo

[MeterHour3]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(49*(#USERSCALE#))
LineStart=(41*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(88)))
StartAngle=(RAD(90))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([HoursMeasure])/1000)),1))*10)=1?0:1)
Group=Haloo

[MeterHour4]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(49*(#USERSCALE#))
LineStart=(41*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(88)))
StartAngle=(RAD(180))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([HoursMeasure])/10000)),1))*10)=1?0:1)
Group=Haloo


[MeterMinutes1]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(58*(#USERSCALE#))
LineStart=(50*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(270))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([MinutesMeasure])/10)),1))*10)=1?0:1)
Group=Maloo

[MeterMinutes2]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(58*(#USERSCALE#))
LineStart=(50*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(330))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([MinutesMeasure])/100)),1))*10)=1?0:1)
Group=Maloo

[MeterMinutes3]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(58*(#USERSCALE#))
LineStart=(50*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(30))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([MinutesMeasure])/1000)),1))*10)=1?0:1)
Group=Maloo

[MeterMinutes4]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(58*(#USERSCALE#))
LineStart=(50*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(90))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([MinutesMeasure])/10000)),1))*10)=1?0:1)
Group=Maloo

[MeterMinutes5]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(58*(#USERSCALE#))
LineStart=(50*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(150))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([MinutesMeasure])/100000)),1))*10)=1?0:1)
Group=Maloo

[MeterMinutes6]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(58*(#USERSCALE#))
LineStart=(50*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(210))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([MinutesMeasure])/1000000)),1))*10)=1?0:1)
Group=Maloo

[MeterSeconds1]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(67*(#USERSCALE#))
LineStart=(59*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(270))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([SecondsMeasure])/10)),1))*10)=1?0:1)
Group=Saloo


[MeterSeconds2]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(67*(#USERSCALE#))
LineStart=(59*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(330))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([SecondsMeasure])/100)),1))*10)=1?0:1)
Group=Saloo

[MeterSeconds3]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(67*(#USERSCALE#))
LineStart=(59*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(30))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([SecondsMeasure])/1000)),1))*10)=1?0:1)
Group=Saloo

[MeterSeconds4]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(67*(#USERSCALE#))
LineStart=(59*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(90))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([SecondsMeasure])/10000)),1))*10)=1?0:1)
Group=Saloo

[MeterSeconds5]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(67*(#USERSCALE#))
LineStart=(59*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(150))
Solid=1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([SecondsMeasure])/100000)),1))*10)=1?0:1)
Group=Saloo

[MeterSeconds6]
Meter=Roundline
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
LineLength=(67*(#USERSCALE#))
LineStart=(59*(#USERSCALE#))
LineColor=00ffd2
RotationAngle=((RAD(58.5)))
StartAngle=(RAD(210))
Solid=1
UpdateDivider=-1
UpdateDivider=-1
Hidden=(((ROUND((FRAC(([SecondsMeasure])/1000000)),1))*10)=1?0:1)
Group=Saloo

[MeterTop]
Meter=Image
ImageName="#@#images\top2.png"
X=0
Y=0
W=(220*(#USERSCALE#))
H=(220*(#USERSCALE#))
AntiAlias=1
DynamicVariables=1
UpdateDivider=-1

[MeterTextTime]
Meter=String
DynamicVariables=1
X=((220*(#USERSCALE#))/2)
Y=(1.015 * ((220*(#USERSCALE#))/2))
StringAlign=CenterCenter
MeasureName=MeasureTextTime
FontColor=00ffd2
FontSize=(12*(#USERSCALE#))
FontFace=Ubuntu Light
AntiAlias=1

[MeterTextTime2]
Meter=String
DynamicVariables=1
X=((220*(#USERSCALE#))/2)
Y=(1.1445 * ((220*(#USERSCALE#))/2))
StringAlign=CenterCenter
MeasureName=MeasureTextTime2
FontColor=ffffff
FontSize=(7*(#USERSCALE#))
FontFace=Ubuntu Light
StringCase=Upper
AntiAlias=1

[MeterTextTime3]
Meter=String
DynamicVariables=1
X=((220*(#USERSCALE#))/2)
Y=(0.87 * ((220*(#USERSCALE#))/2))
StringAlign=CenterCenter
MeasureName=MeasureTextTime3
FontColor=ffffff
FontSize=(7*(#USERSCALE#))
FontFace=Ubuntu
AntiAlias=1
Hours.lua

Code: Select all

function Update()
	local t = os.date('%I')
	return bin(t)
end

function bin(dec)
	local result = ''

	repeat
		local int, frac = math.modf(dec / 2)
		dec = int
		result = math.ceil(frac) .. result
	until dec == 0

	return result
end
Minutes.lua

Code: Select all

function Update()
	local t = os.date('%M')
	return bin(t)
end

function bin(dec)
	local result = ''

	repeat
		local int, frac = math.modf(dec / 2)
		dec = int
		result = math.ceil(frac) .. result
	until dec == 0

	return result
end
Seconds.lua

Code: Select all

function Update()
	local t = os.date('%S')
	return bin(t + 1)
end

function bin(dec)
	local result = ''

	repeat
		local int, frac = math.modf(dec / 2)
		dec = int
		result = math.ceil(frac) .. result
	until dec == 0

	return result
end

Also, I took out your [MeasureFull] measure because as of Rainmeter 2.4 (r1645), Roundline's do not need to bind to a measure.
-Brian