Page 1 of 1

WinClip v2 - 2023/07/22 - v2.0.4

Posted: 29 May 2021, 03:17
by TheArkive
WinClip revived for AHK v2.

=================================================================================
Credits:

Initial AHK v2 rewrite
@egocarib: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=29314

additional contributions
@autocart: https://www.autohotkey.com/boards/viewtopic.php?p=281664#p281664

Original
Deo: https://autohotkey.com/board/topic/74670-class-winclip-direct-clipboard-manipulations/
=================================================================================

The example works fine. I could use some help with tests of the finer aspects though.

I only did a direct translation and basic trouble shooting. I'm still wrapping my head around all the clipboard functions / tricky bits.

:arrow: Download on Github

Re: WinClip v2 - 2021/06/21 - a137

Posted: 04 Jul 2021, 20:51
by JoeSchmoe
I finally got around to updating to the newest version of AHK2 (it really didn't take so long), and I finally tried this out.

It works perfectly. And so useful... You are the man!

Re: WinClip v2 - 2021/06/21 - a137

Posted: 05 Jul 2021, 03:36
by TheArkive
Very cool man! :) Thanks for the feedback!

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 18 Mar 2023, 22:58
by JoeSchmoe
Thanks again for converting this!

I've noticed that it can have difficulties extracting HTML source from copied text that involves certain emojis.

For example, try copying the heading, "High Voltage Sign Emoji ⚡," from the following page: https://symbl.cc/en/26A1/

Then run the following code:

Code: Select all

#Include lib/winclip/WinClipAPI.ahk
#Include lib/winclip/WinClip.ahk
wc := WinClip()
MsgBox wc.GetHTML()
Where the actual emoji should be, I see âš¡. However, when I paste directly from the clipboard, I get the real emoji, as illustrated above.

Any thoughts?

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 19 Mar 2023, 02:48
by gregster
@JoeSchmoe, did you save your script in UTF-8 with BOM encoding, as you should?
Edit: I guess, in AHK v2, UTF-8 should suffice - you wouldn't necessarily need the BOM.

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 19 Mar 2023, 09:43
by JoeSchmoe
gregster wrote:
19 Mar 2023, 02:48
@JoeSchmoe, did you save your script in UTF-8 with BOM encoding, as you should?
I am. It's currently UTF-8 with BOM.

(For anyone with similar issues I learned that you can check the encoding in both Scite4AutoHotkey and Notepad++. It was smart to think of encoding issues because the emoji displays as if it were rendered in a less sophisticated encoding, with multiple characters instead of one.)

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 19 Mar 2023, 12:34
by JoeSchmoe
Thanks to Nikola from Discord, who found the following solution: Try to replace all the "CP0" with "UTF-8" in your WinClip library. It worked!

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 19 Mar 2023, 18:31
by TheArkive
@JoeSchmoe

Thanks. Done.

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 21 Jul 2023, 16:09
by tbfaulk
I'm attempting to use the SetFiles method, but I'm running into all sorts of errors. I confirmed that I can use the library, as the included examples will run just fine.

My code is about as simple as can be:

Code: Select all

#Requires Autohotkey v2.0+
#SingleInstance Force
#Include WinClip.ahk
#Include WinClipAPI.ahk

wc := WinClip()
wc.SetFiles("C:\Desktop\new.txt")
[Mod edit: [code][/code] tags added.]

My end goal is to copy that text document to the clipboard - same as if you were to select it in the file explorer and press CTRL+C.

Attached are screenshots of the errors I'm seeing. Any ideas if I'm just doing something wrong?

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 22 Jul 2023, 11:06
by TheArkive
Ok, I'll look into this and see if I can figure out what's going on.

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 22 Jul 2023, 11:43
by TheArkive
@tbfaulk

I pushed a fix. I tested it on multiple files and directories. It seems to work well.

Thank for the report. Let me know if you find anything else.

Re: WinClip v2 - 2021/06/21 - beta.1

Posted: 24 Jul 2023, 15:05
by tbfaulk
Working perfectly now! Thank you so much!!!
TheArkive wrote:
22 Jul 2023, 11:43
@tbfaulk

I pushed a fix. I tested it on multiple files and directories. It seems to work well.

Thank for the report. Let me know if you find anything else.

Re: WinClip v2 - 2023/07/22 - v2.0.4

Posted: 11 Apr 2024, 00:47
by tdalon
Just wanted to say THANKS @TheArkive for sharing 👍