It is currently September 21st, 2019, 1:41 am

Changing mouse sensitivity

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

Re: Changing mouse sensitivity

jsmorley » January 17th, 2018, 4:37 pm

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
Posts: 575
Joined: March 23rd, 2015, 5:26 pm

Re: Changing mouse sensitivity

SilverAzide » January 17th, 2018, 5:15 pm

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.)
DeviantArt Gadgets More...
User avatar
jsmorley
Developer
Posts: 19467
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

jsmorley » January 17th, 2018, 6:13 pm

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
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing mouse sensitivity

balala » January 17th, 2018, 6:15 pm

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: 19467
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

jsmorley » January 17th, 2018, 6:21 pm

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: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing mouse sensitivity

balala » January 17th, 2018, 6:24 pm

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: 19467
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

jsmorley » January 17th, 2018, 6:27 pm

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: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing mouse sensitivity

balala » January 17th, 2018, 6:28 pm

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: 19467
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing mouse sensitivity

jsmorley » January 17th, 2018, 6:40 pm

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: 8631
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing mouse sensitivity

balala » January 17th, 2018, 6:45 pm

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.