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

"Setting Clipboard failed" #67

Open
davidhfo opened this issue Nov 30, 2023 · 3 comments
Open

"Setting Clipboard failed" #67

davidhfo opened this issue Nov 30, 2023 · 3 comments

Comments

@davidhfo
Copy link

davidhfo commented Nov 30, 2023

I have a script that does a lot of copying to the clipboard.

Sometimes I will get a message box saying:

Runtime error in line <>:
Setting Clipboard failed.

The current thread will exit.

The console will also report:

Setting clipboard failed

Is it possible, when this comes up, for the thread to be instructed to restart automatically, rather then exiting? Or to go to a certain point to start over?

@phil294
Copy link
Owner

phil294 commented Dec 1, 2023

I have noticed this happening too yesterday for the very first time ever. Do you have an idea when or how this can happen? Like under which circumstances, is it when copying an image etc?

Apart from that, may I ask what your experiences with "a lot of copying to the clipboard" have been like? Does it always work (apart from the error message)? Because I have had scenarios where both Clipboard = ... and ClipWait somehow didn't work without notice or went into effect only delayed.

Is it possible, when this comes up, for the thread to be instructed to restart automatically, rather then exiting? Or to go to a certain point to start over?

It's a popup currently because it is essentially an unexpected internal runtime exception. But if we can't figure out a way to fix it (which it looks like there isn't), this should indeed be changed to catch the failure instead and ErrorLevel be set to some meaningful value, as is the convention in AutoHotkey's commands.

@phil294
Copy link
Owner

phil294 commented Dec 1, 2023

it seems to be related to UTF-8 so perhaps fixable after all:

(AppRun.wrapped:1099777): Gtk-WARNING **: 18:27:54.270: Error converting from UTF-8 to ASCII: Partial character sequence at end of input

(AppRun.wrapped:1099777): Gtk-WARNING **: 18:27:54.284: Error converting from text/plain;charset=utf-8 to UTF-8: invalid UTF-8

(AppRun.wrapped:1099777): Gdk-WARNING **: 18:27:54.288: Error converting selection from UTF8_STRING

(AppRun.wrapped:1099777): Gtk-WARNING **: 18:27:54.308: Error converting from text/plain;charset=utf-8 to UTF-8: invalid UTF-8

Setting Clipboard failed

@davidhfo
Copy link
Author

davidhfo commented Dec 6, 2023

Thank you for your responses. I haven't noticed any particular pattern, myself. I can do the same action fifty times in a row and it's fine, then the fifty-first gives the error. It's always just text that I'm copying.

And it was weird, when it started happening. I'm pretty sure I was doing the same action I'd done hundreds, if not thousands of times before, and never seen the error.

When this happened today, the full output of the terminal from program load until before the error was:

Gtk-Message: 14:19:56.766: Failed to load module "appmenu-gtk-module"
Gtk-Message: 14:19:56.768: Failed to load module "appmenu-gtk-module"
Gtk-Message: 14:19:56.768: Failed to load module "appmenu-gtk-module"
Gtk-Message: 14:19:56.838: Failed to load module "colorreload-gtk-module"
Gtk-Message: 14:19:56.838: Failed to load module "window-decorations-gtk-module"
Interactive AHK_X11 console (REPL). Type any command. Multi-line text not supported. Press {CTRL}+C to exit.
ahk_x11>
** (AppRun.wrapped:12675): WARNING **: 14:20:21.840: atk-bridge: get_device_events_reply: unknown signature
Setting Clipboard failed

The messages before the interactive console bit are always there though. And the atk-bridge warning appeared a few minutes before setting the clipboard failed, with quite a few successful copies in between.

I'll let you know if I notice anything specific, or receive different warnings, but it looks like you have an idea what could be going on. Are the warnings only relevant if they appear immediately before the Setting Clipboard failed?

Excluding the message box issue, I don't recall specific issues of the clipboard functionality not working. And I've really appreciated being able to use ClipWait. I'll try to keep an eye out though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants