It is currently March 28th, 2024, 3:42 pm

Changing mouse sensitivity

Post reviews, recommendations and questions about other software.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

Post by jsmorley »

balala wrote:I'm sorry, but I have to argue this. It doesn't appear at all.
Yes, as SilverAzide pointed out, the -NonInteractive parameter keeps the console window from appearing. I have not fully explored Powershell yet, as I'm leery that the default security setting for running .ps1 scripts is "disabled", but it does have a lot of promise.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: Changing mouse sensitivity

Post by SilverAzide »

jsmorley wrote:I have not fully explored Powershell yet, as I'm leery that the default security setting for running .ps1 scripts is "disabled", but it does have a lot of promise.
Yes, it is a little confusing. The first time you run a script you may be prompted to run it as an admin and I think (??) you get prompted whether to allow scripts to run. I forget the exact process; once I answered the prompts, I don't get nagged anymore. Individual Powershell commands don't require this stuff, only scripts do.

Powershell is supposedly "secure by default". To set your script execution policy manually, open a Powershell prompt as an admin, then enter the following:

Set-ExecutionPolicy RemoteSigned

(options are: Restricted (the default), AllSigned, RemoteSigned, Unrestricted... I think RemoteSigned should be safe enough without being annoying.)

To test it, create a text file called "hello.ps1" that contains the following lines:

Write-Host "Hello, world"
Read-Host "Press Enter to continue"

Right-click the file in Explorer and select "Run with Powershell" from the context menu. If it runs without prompting, you are good to go. You can also open a command (cmd) shell and run the command powershell .\hello.ps1 and you should get pretty much the same result (running a shell inside a shell feels a little weird, but... :)). To run the script at a powershell prompt, the command is just .\hello.ps1 (or even .\hello).

Just to reiterate, all this is needed only for running scripts. Individual Powershell commands don't need any policy setting.

(Sorry for hijacking this thread, BTW.)
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

Post by jsmorley »

So this works fine...

Skin:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!CommandMeasure MeasureRun "Run"]

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
OutputType=ANSI
Parameter=PowerShell -Command ".\Test.ps1"
SubStitute="#CRLF#":""
FinishAction=[!UpdateMeter MeterGPU][!Redraw]

[MeterGPU]
Meter=String
MeasureName=MeasureRun
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=GPU Name: %1
Test.ps1:

Code: Select all

$computerVideo = Get-WmiObject Win32_VideoController
write-host $computerVideo.description
1.png
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing mouse sensitivity

Post by balala »

jsmorley wrote:Yes, as SilverAzide pointed out, the -NonInteractive parameter keeps the console window from appearing. I have not fully explored Powershell yet, as I'm leery that the default security setting for running .ps1 scripts is "disabled", but it does have a lot of promise.
No, I think it doesn't need a such parameter.
Continuing out previous discussion about the Core Temp app, I wanted to create a measure to can chekc if this app is or isn't installed. Googling the web, I figured out that a simple way to check this is though a PowerShell command (have I named it well?). I wrote the following simple RunCommand plugin measure:

Code: Select all

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName | Format-Table –AutoSize
State=Hide
OutputType=ANSI
OutputFile=#@#Res.txt
IfMatch=Core Temp
IfMatchAction=[!SetVariable Installed "1"][!UpdateMeter "StringMeter"][!Redraw]
IfNotMatchAction=[!SetVariable Installed "0"][!UpdateMeter "StringMeter"][!Redraw]
When ran, this measure executes the PowerShell with the mentioned parameter and finally it sets up the value of the Installed variable to 1, if the app is installed. But no console window is shown. And I didn't use the -NonInteractive parameter, nowhere. And also didn't use a .ps1 file. Did I do something wrong?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

Post by jsmorley »

balala wrote:No, I think it doesn't need a such parameter.
Continuing out previous discussion about the Core Temp app, I wanted to create a measure to can chekc if this app is or isn't installed. Googling the web, I figured out that a simple way to check this is though a PowerShell command (have I named it well?). I wrote the following simple RunCommand plugin measure:

Code: Select all

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName | Format-Table –AutoSize
State=Hide
OutputType=ANSI
OutputFile=#@#Res.txt
IfMatch=Core Temp
IfMatchAction=[!SetVariable Installed "1"][!UpdateMeter "StringMeter"][!Redraw]
IfNotMatchAction=[!SetVariable Installed "0"][!UpdateMeter "StringMeter"][!Redraw]
When ran, this measure executes the PowerShell with the mentioned parameter and finally it sets up the value of the Installed variable to 1, if the app is installed. But no console window is shown. And I didn't use the -NonInteractive parameter, nowhere. And also didn't use a .ps1 file. Did I do something wrong?
I would think that is fine... Looks to me like the default "Hide" state of the RunCommand measure itself will prevent the powershell console from appearing. You would likely want / need the -NonInteractive parameter if you are just directly calling a powershell command or script from an action.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing mouse sensitivity

Post by balala »

jsmorley wrote:I would think that is fine... Looks to me like the default "Hide" state of the RunCommand measure itself will prevent the powershell console from appearing. You would likely want / need the -NonInteractive parameter if you are just directly calling a powershell command or script from an action.
That's a point. But since we have the RunCommand plugin, we don't need to call it directly. My opinion...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

Post by jsmorley »

balala wrote:That's a point. But since we have the RunCommand plugin, we don't need to call it directly. My opinion...
No, not unless you just wanted the powershell command to "do something", without needing any return value. I would likely use RunCommand in any case...
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing mouse sensitivity

Post by balala »

jsmorley wrote:No, not unless you just wanted the powershell command to "do something", without needing any return value. I would likely use RunCommand in any case...
:thumbup:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

Post by jsmorley »

In digging a bit deeper, I'm not convinced the -NonInteractive parameter has anything to do with whether the console is displayed. It seems to have to do with whether or not an interactive "prompt" is displayed. In any case, with RunCommand I don't think you ever need it.

This thread is officially hijacked to death... ;-)
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing mouse sensitivity

Post by balala »

jsmorley wrote:This thread is officially hijacked to death... ;-)
Yeah, it indeed is. I'm sorry if I hijacked it, just wanted to mention something I just figured out.
Post Reply