-
Notifications
You must be signed in to change notification settings - Fork 456
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
ScriptError "TypeError Property 'text' Exit code 4" #2520
Comments
Changed The error has also changed: But if I explicitly insert the URL into the code, like this |
Through trial and error, it was found that if the link is opened in this format But in this case So, in some incomprehensible way, |
@hluk
Add URL label & Add URL label (Edge) (click to open)
Open in &Browser (click to open)
So, for some unknown reason, the script Add URL label & Add URL label (Edge) adds
But most likely there is some bug in CopyQ, which is causing such behavior. Therefore, it would be better if the error itself is fixed, rather than using such workarounds. |
There is no attribute
It looks like the original data contains trailing null character. I can reproduce this from shell: # Web browser opens: https://github.com/hluk/CopyQ/issues/2520%00
❯ printf "%s\0" "https://github.com/hluk/CopyQ/issues/2520" | copyq 'open(input())'
true
# ByteArray with null character converted to string still contains the null (bellow is the hexadecimal representation of the string)
❯ printf "HELLO\0" | copyq 'str(input())' | xxd
00000000: 4845 4c4c 4f00 0a HELLO..
# Here is the input without null
❯ printf "HELLO" | copyq 'str(input())' | xxd
00000000: 4845 4c4c 4f0a HELLO. It seems that the following works well, provided the input is in Latin1 encoding (the standard ISO 8859-1 character set): var url = input().toLatin1String() The question is why the item note contains the null character. I assume that the clipboard content might have been misinterpreted by CopyQ or the underlying Qt framework (which handles most of the clipboard data transformations/representation). Which app did you copy the URL from? |
I didn't copy the URLs themselves, I copied the texts from the aforementioned Firefox, Edge and Chrome and after that "Add URL label & Add URL label (Edge)" did all the rest of the work on adding URLs to the "Note" fields of the clips. |
I cannot reproduce the trailing null character when copying from Firefox. I think this could be a problem in the source application. Probably not worth adding a workaround in CopyQ for this. |
Let me know if you can reproduce it (and how) when copying from the source app. I would prefer to have a proper fix in CopyQ if that will be possible. |
Here is the most common process of copying text in Firefox: CopyQ-Copying-NULL-Video_2023-10-31_162525.webm |
Oh, the item notes with URL are created automatically with a command. Can you share the command code here with "Copy Selected" button? BTW, thanks for posting the screencasts - very useful! |
Under the "Copy Selected" button, do you mean this one? This is an external application - SnipDo, an analogue of Popclip on MacOS. All the work is done by CopyQ using the two scripts I mentioned above #2520 (comment)
You are welcome, and thank you for your work, and I, as a user, just try to convey information about the problem as clearly as possible so as not to force you to develop telepathy as well. |
I mean this process: https://copyq.readthedocs.io/en/latest/faq.html#how-to-load-shared-commands-and-share-them
And paste the command into a comment in this issue. |
Oh, I see.
This one, which supposed to work in Edge and Chrome, doesn't work in either of them.
PS. Please take a look at my screencast on the more troubling issue of not being able to copy images from browsers. |
I tested it on Linux with Firefox 118.0.2 and there is no trailing null character in the URL:
I also checked Chromium but it does not seem to provide the URL in clipboard. You can check the formats by copying from the web browser and opening Clipboard Content dialog in CopyQ (Ctrl+Shift+C). |
It seems, this command doesn't work in Windows. Regarding trailing NULL in URLs As you can see, the trailing NULL character appears before the URL is recorded into Note. ( PS. I apologize, but I didn't quite understand what was meant by CopyQ-Clipboard-Contnet-formats-Video_2023-11-01_182429.webm |
The console output on Windows does not work for GUI apps unfortunately (#349). You can use the Action dialog (F5 shortcut) in CopyQ instead with "Store standard output" set to "text/plain" to store the command output to new item.
More specifically: Use the Clipboard Content to figure out the format name containing URL for the current system clipboard content visible by CopyQ. It should list |
CopyQ-Notes-issue-Video_2023-11-03_014635_part1.webmCopyQ-Notes-issue-Video_2023-11-03_014635_part2.webm |
Describe the bug
When I try to execute script the error " TypeError: Property 'text' Exit code: 4" appears.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Opening the URL located in the clip note in the browser.
Screenshots
CopyQ-Open-in-Browser-Video_2023-10-27_073333.webm
Version, OS and Environment
The text was updated successfully, but these errors were encountered: