For example, try this skin to understand the difference in code and expected behavior:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
---Measures---
[MeasureRunHidden]
Measure=Plugin
Plugin=RunCommand
Parameter=cscript.exe #@#Scripts\HelloWorld.vbs
State=Hide
OutputType=ANSI
---Meters---
[MeterRunHidden]
Meter=String
FontSize=16
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
Y=0R
AntiAlias=1
Text=Click to Run using RunCommand - hidden
LeftMouseUpAction=[!CommandMeasure MeasureRunHidden "Run"]
[MeterRunDirectly]
Meter=String
FontSize=16
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
Y=0R
AntiAlias=1
Text=Click to Run directly - briefly visible
LeftMouseUpAction=["cscript.exe" "#@#Scripts\HelloWorld.vbs"]
This assumes you have a
HelloWorld.vbs file the above skin's
Resources folder, with the following contents:
So, basicaly, what you have now is a measure that does what
[MeterRunDirectly] does in the LeftMouseUpAction option (albeit based on a condition and such). You'd need to create a RunCommand measure (see the link in my previous reply for details) like the above
[MeasureRunHidden] that does pretty much the same thing but hidden (while taking care to use the same arguments in the Parameter option, as in the original code), and of course to replace the line that calls the VB script with something similar to what the LeftMouseUpAction option from
[MeasureRunHidden] contains. Then, try the new code and hope it would work (which it will, if the focus issue is because of the script execution itself, and not because of some other thing hidden in the script code).
P.S. I used
cscript.exe in this scenario only to force a console / STDOUT output instead of a Windows message box when using the default
wscript.exe handler for the .vbs extension. It is there for demonstration purposes only, probably not required in your scenario.