beje gal kam pades, reikia pasikooreguoti scripta savo reikmem
# Function to check microphone input level
Function Get-MicrophoneLevel {
$microphone = Get-WmiObject Win32_SoundDevice | Where-Object {$_.ProductName -like "*Microphone*"}
$level = $microphone.Properties | Where-Object {$_.Name -eq "Volume"}
return $level.Value
}
# Function to turn off the display
Function Turn-OffDisplay {
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class PowerManagement {
[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);
public const int HWND_BROADCAST = 0xffff;
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MONITORPOWER = 0xf170;
public const int MONITOR_OFF = 2;
public static void TurnOffDisplay() {
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_OFF);
}
}
"@
[PowerManagement]::TurnOffDisplay()
}
# Function to turn on the display
Function Turn-OnDisplay {
# You may need to implement a method to turn on the display based on your system's configuration
# This can vary depending on your hardware and operating system
# For example, you might need to simulate keyboard input or use other system commands
}
# Threshold for microphone input level (adjust as needed)
$threshold = 50
# Main loop
while ($true) {
$micLevel = Get-MicrophoneLevel
Write-Host "Microphone level: $micLevel"
if ($micLevel -gt $threshold) {
Write-Host "Turning off display..."
Turn-OffDisplay
}
else {
Write-Host "Turning on display..."
Turn-OnDisplay
}
# Wait for a short interval before checking again
Start-Sleep -Seconds 5
On 3/19/24 21:39, Zanas wrote:
> radau varianta, shell script,
> 2 variantai mazinti ekrano ryskuma iki 0 arba nusiusti monitoriu i sleep.
> > isgirdo vaikas apie tai netycia, kaip ir garso jau nera, gal ir nereikes > :) :) :)
> > > On 3/19/24 21:27, zZz wrote:
>> Nu jo.. :)))
>> Bet kodėl gi ne? Pažiūrėk, ar mikrofono lygio nepaima Performance Monitor
>>
>> On 2024-03-19 17:04, Zanas wrote:
>>> Sveiki, ar yra koks nors softas windowsam, jei mikrafono db lygis >>> pasiekia tam tikra reiksme ekrana kad uzrakintu?
>>>
>>> problema tokia kad vaikas kai issijaucia zaisdamas daznai prapeda >>> klykauti, man reikia kad uzrakintu ekrana arba padarytu juoda tarkim >>> kokim 5-10 sekundem, jei garsas is mic per didelis.
>>
>