https://bugs.winehq.org/show_bug.cgi?id=52716
Bug ID: 52716 Summary: Sending key stroke (using [System.Windows.Forms.SendKeys]::SendWait) fails (seems to go into a loop?) Product: Wine Version: 7.4 Hardware: x86-64 URL: https://github.com/PowerShell/PowerShell/releases/down load/v7.0.3/PowerShell-7.0.3-win-x64.msi OS: Linux Status: NEW Keywords: dotnet, download Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: xerox.xerox2000x@gmail.com Distribution: ---
Created attachment 72077 --> https://bugs.winehq.org/attachment.cgi?id=72077 ps script
Hi, I have a powershell script where I need to send a keystroke to a program.
I found code snippet on the internet and made little script that I tested in windows (using powershell core) and it works.
It sends ctrp^p to notepad, and that opens the printer-dialog correctly on windows.
On wine however it doesn`t work, cpu-usage goes up so it seems to get into loop(???)
Script (also see attachment): ###################################################################
Start-Process "notepad.exe" Sleep 3
$WindowHandle = Get-Process | Where-Object { $_.MainWindowTitle -Match "Notepad" } | Select-Object -ExpandProperty MainWindowHandle
[void][System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') [System.Windows.Forms.SendKeys]::SendWait("^{p}")
#####################################################################
Steps to reproduce:
1. winetricks -q dotnet48 2. wget https://github.com/PowerShell/PowerShell/releases/download/v7.0.3/PowerShell... 3. wine PowerShell-7.0.3-win-x64.msi 4. Save the script from attachment as a.ps1 in current folder 5. wine pwsh -file ./a.ps1
Notepad opens but nothing really happens and cpu-usage goes up