Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screenshot created but not copied to clipboard #13

Closed
1 of 3 tasks
Justtaway opened this issue Apr 4, 2024 · 10 comments · Fixed by #14
Closed
1 of 3 tasks

Screenshot created but not copied to clipboard #13

Justtaway opened this issue Apr 4, 2024 · 10 comments · Fixed by #14
Labels
bug Something isn't working

Comments

@Justtaway
Copy link

Script(s)

clipshot.lua

Description

Image is created in temp folder, but doesn't go to clipboard.
I have Win11x64 22631.3296.

I tried enabling logs and got this, the most relevant line, as I believe, is:
[ 15.820][e][cplayer] Starting subprocess failed: init
Here is full logs:
output.txt

I tried another script at https://github.com/zc62/mpv-scripts/blob/master/screenshot-to-clipboard.js and it does work.

Possible Fix

Steps to Reproduce

  1. Open video file
  2. Press any clipshot hotkey (c, C, Alt+c)
  3. See OSD message about screenshot being copeid to clipboard
  4. Check clipboard (via Clipdiary, Windows stock clipboard manager or just pasting into any app)
    Expected result: screenshot can be pasted from clipboard to any app
    Actual result: there is no screenshot in clipboard, but file is created in temp folder. Tried changing jpeg to png, same result.

Operating System(s)

  • Windows
  • Linux
  • macOS

MPV version

mpv.net 7.1.1.0 (03.02.2024), mpv v0.37.0-152-gbd5d8e41 (11.01.2024)

Lua version

5.4.4

@Justtaway Justtaway added the bug Something isn't working label Apr 4, 2024
@ObserverOfTime
Copy link
Owner

ObserverOfTime commented Apr 4, 2024

This is the command that the script tries to run on Windows:

"powershell" "-NoProfile" "-Command" "& {
            Add-Type -Assembly System.Windows.Forms;
            Add-Type -Assembly System.Drawing;
            $shot = [Drawing.Image]::FromFile(\"C:\\\\Users\\\\cuzzo\\\\AppData\\\\Local\\\\Temp\\\\mpv-screenshot.jpeg\");
            [Windows.Forms.Clipboard]::SetImage($shot);
        }"

Can you run it (either in cmd or powershell) and see if there's an error?

@Justtaway
Copy link
Author

Can you run it (either in cmd or powershell) and see if there's an error?

How do I do it properly? Open mpv, copypaste enitre script in powershell? Or line by line?

@ObserverOfTime
Copy link
Owner

Just open powershell and copy paste the whole thing (assuming the file is still there).

@Justtaway
Copy link
Author

This is what I get, sorry for russian, tried to make it English but couldn't
image

@ObserverOfTime
Copy link
Owner

At least translate it…

@Justtaway
Copy link
Author

Justtaway commented Apr 4, 2024

PS C:\Users\cuzzo> "powershell" "-NoProfile" "-Command" "& {
>> Add-Type -Assembly System.Windows.Forms;
>> Add-Type -Assembly System.Drawing;
>> $shot = [Drawing.Image]::FromFile(\"C:\\\\Users\\\\cuzzo\\\\AppData\\\\Local\\\\Temp\\\\mpv-screenshot.jpeg\");
>> [Windows.Forms.Clipboard]::SetImage($shot);
>> }"
string:1 character:14
+ "powershell" "-NoProfile" "-Command" "& {
+ ~~~~~~~~~~~~
The unexpected token ""-NoProfile"" in an expression or operator.
line:1 character:27
+ "powershell" "-NoProfile" "-Command" "& {
+ ~~~~~~~~~~
The unexpected token ""-Command"" in an expression or operator.
line:1 character:38
+ "powershell" "-NoProfile" "-Command" "& {
+ ~~~~
Unexpected token ""&{
Add-Type -Assembly System.Windows.Forms;
Add-Type -Assembly System.Drawing;
$shot = [Drawing.Image]::fromFile(\"" in an expression or operator.
line:4 sign:49
+ ... :FromFile(\"C:\\\\Users\\\\cuzzo\\\\AppData\\\\Local\\\\Temp\\\\mpv-s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An unexpected token "C:\\\\Users\\\\cuzzo\\\\AppData\\\\Local\\\\Temp\\\\mpv-screenshot .jpeg\");
[Windows.Forms.Clipboard]::SetImage($shot);
}"" in an expression or operator.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken

PS C:\Users\cuzzo>

@ObserverOfTime
Copy link
Owner

Does it work if you run it from cmd instead?

@Justtaway
Copy link
Author

No, cmd can't even recognize those commands.

@ObserverOfTime
Copy link
Owner

ObserverOfTime commented Apr 5, 2024

I could not reproduce the error in my VM but it should be fixed by 342c256.

@Justtaway
Copy link
Author

I could not reproduce the error in my VM but it should be fixed by 342c256.

The funny thing is, the fix doesn't work for me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants