Open Mark-Joy opened 3 months ago
Do win-users have the better native alternatives to powershell?
Do win-users have the better native alternatives to powershell?
Implement paste function it in C/C++, then export to lua: https://github.com/sindresorhus/windows-clipboard/blob/0ed96922fd080040135488a9b24be6992155b366/paste.c
int wpaste() {
OpenClipboard(NULL);
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
if (hData) {
wchar_t *pText = (wchar_t *) GlobalLock(hData);
if (pText) {
_setmode(_fileno(stdout), _O_U8TEXT);
fputws(pText, stdout);
GlobalUnlock(hData);
}
}
CloseClipboard();
return 0;
}
or use prebuilt-tool: windows-clipboard or only paste
Powershell likes to spin up HDDs for some ungodly reason it tries to enumerate them which wakes them up and it can take seconds. I think this is what you see.
I think it is good idea to add internal native method to get clipboard contents, generally spinning up subprocesses in scripts should be avoided, it will always be slower.
Native clipboard support is added by https://github.com/mpv-player/mpv/pull/13837. Once the API design is finalized, a win32 implementation can be added. The console then needs to update to use the new API.
mpv Information
Other Information
Reproduction Steps
Task manager
to ensure there is no process hogging CPU/Disk/Ram`
) > Paste clipboard text (Press ctrl+v)Expected Behavior
The clipboard text is pasted with a small delay, like below 1 second..
Actual Behavior
On my system, the clipboard text took 1x seconds (more than 10 seconds) to be pasted into mpv console on first run. This is because
console.lua
uses powershell command to getclipboard data. On first run, powershell can be really slow.Log File
output.txt
Sample Files
I pressed
ctrl+v
at 00:13, text showed up at 00:22https://github.com/mpv-player/mpv/assets/22109528/8ca34d29-4bfa-48c3-8f32-4c93e2acbbc3
I carefully read all instruction and confirm that I did the following:
--log-file=output.txt
.