Closed LeonCheung closed 2 years ago
Hi, I'm glad you found it helpful. For point 1 I assume you are referring to the text that is copied to the clipboard, you must modify the 2nd line to add the '"' to indicate that the entire text is a single argument. i.e. as follows:
mp.commandv("run", "powershell", "set-clipboard", '"' + text + '"');
Where 'text' is the string with spaces what you want.
For point 2 I could not replicate it, it works fine for me. Maybe you can give me more information about it.
Oh that's really nice that it solves the first problem, thank you for the tip!
As for the second issue, I tested it on two Win10 PCs and one Win11 VM. Both PCs got the problem as shown in the video below, while the VM works fine, so strange, Do you have any clues maybe?
https://user-images.githubusercontent.com/494788/157161750-a4611b47-9906-4c1b-a14c-8d69ed2f1456.mp4
Here is the edited copyTime.js: copyTime.txt
Hi this script works fine for me. I think the problem is in:
mp.commandv("run", "powershell", "set-clipboard", '"' + text + '"')
Remember that the script does not wait for a response. You should look for the reason why powershell is slow, maybe it is due to your antivirus.
Hmm, I think you are right. After disabling my antivirus software, it somehow works great. And after restarting, it works fine with antivirus again. And finally it turns out it's about the Windows realtime Defender switch in system settings.
As for another one (an Intel Compute Stick), I tried to remove every other software, and it was indeed faster than before, but not as instant as the current PC, I guess it's may be because of the low performance, after all, it's a mini tiny compute stick. Anyway, I think we figured it out. Thanks again for saving my life!!
Hi, I'm glad you found this helpful. You could try this change, see if it gives you better performance.
mp.commandv("run", "cmd", "/C", "echo " + text + "|clip.exe" )
OMG! What magic it is! Problem completely solved! You are my hero, Arieleg, thank you sooooo much!!!
Just one more thing, It seems now an auto-return has been added after each copy. Is there a way for not adding it please?
UPDATE: Strange thing happens again. In MS Word, no auto-return added, but in text editors like Sublime Text or NP++, it does.
Hi, glad to hear that had a better performance.
The newline problem is due to ECHO, you can fix it by making the following change:
mp.commandv("run", "cmd", "/C", "echo|set /P=" + text + "|clip.exe" )
Thanks a lot, Arieleg. You saved me a bunch of time. I wanna donate a bit for your great help. Do you have PayPal?
I'm glad to hear it was helpful. My friend, your thanks is enough for me. If you want to invite me to something anyway, my paypal is arielgamboa@outlook.com.
Got it. Just wanna buy you a beer. XD Check it out. Cheers! Closing.
Hi, this is a really helpful script, thank you so so so much for sharing this! Just two questions, maybe you could help some:
How to add something like space in the final text, like: "The time is HH:MM:SS." ? I tried to edit the js script, it works but no spaces are generated, not sure why. I mean, my result keep being "ThetimeisHH:MM:SS.".
When it's working, I don't know why but I have to wait for about 2~3 secs until the new copied text finally replace the previous one. I mean, how to speed up the process a bit?
Thanks again for these great scripts!