Punkt eingabe mit Tastatur

Eine .NET-Klasse zur Simulation von Tastatureingaben
This commit is contained in:
Timur 2024-06-26 06:52:22 +00:00
parent bad4e35050
commit 012e02195a

26
dot.script.ps1 Normal file
View file

@ -0,0 +1,26 @@
# Erstelle eine .NET-Klasse zur Simulation von Tastatureingaben
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Keyboard
{
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
private const int KEYEVENTF_KEYUP = 0x0002;
public const int VK_DECIMAL = 0x6E; // VK_DECIMAL ist der virtuelle Tastencode für '.'
public static void SendKey(byte keyCode)
{
keybd_event(keyCode, 0, 0, 0); // Drückt die Taste
keybd_event(keyCode, 0, KEYEVENTF_KEYUP, 0); // Lässt die Taste los
}
}
"@
# Endlosschleife zur Eingabesimulation alle 3 Minuten
while ($true) {
[Keyboard]::SendKey([Keyboard]::VK_DECIMAL)
Start-Sleep -Seconds 180
}