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

Post your working scripts, libraries and tools.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

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

Post by TheArkive » 29 May 2021, 03:17

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
Last edited by TheArkive on 22 Jul 2023, 11:45, edited 2 times in total.
User avatar
JoeSchmoe
Posts: 129
Joined: 08 Dec 2014, 08:58

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

Post by JoeSchmoe » 04 Jul 2021, 20:51

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!
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

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

Post by TheArkive » 05 Jul 2021, 03:36

Very cool man! :) Thanks for the feedback!
User avatar
JoeSchmoe
Posts: 129
Joined: 08 Dec 2014, 08:58

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

Post by JoeSchmoe » 18 Mar 2023, 22:58

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?
gregster
Posts: 9021
Joined: 30 Sep 2013, 06:48

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

Post by gregster » 19 Mar 2023, 02:48

@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.
User avatar
JoeSchmoe
Posts: 129
Joined: 08 Dec 2014, 08:58

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

Post by JoeSchmoe » 19 Mar 2023, 09:43

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.)
User avatar
JoeSchmoe
Posts: 129
Joined: 08 Dec 2014, 08:58

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

Post by JoeSchmoe » 19 Mar 2023, 12:34

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!
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

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

Post by TheArkive » 19 Mar 2023, 18:31

@JoeSchmoe

Thanks. Done.
tbfaulk
Posts: 2
Joined: 21 Jul 2023, 15:55

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

Post by tbfaulk » 21 Jul 2023, 16:09

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?
Attachments
Screenshot 7-21-2023 - 000.png
Screenshot 7-21-2023 - 000.png (105.95 KiB) Viewed 1996 times
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

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

Post by TheArkive » 22 Jul 2023, 11:06

Ok, I'll look into this and see if I can figure out what's going on.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

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

Post by TheArkive » 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.
tbfaulk
Posts: 2
Joined: 21 Jul 2023, 15:55

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

Post by tbfaulk » 24 Jul 2023, 15:05

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.
User avatar
tdalon
Posts: 44
Joined: 21 Apr 2017, 07:19
Location: Germany
Contact:

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

Post by tdalon » 11 Apr 2024, 00:47

Just wanted to say THANKS @TheArkive for sharing 👍
Post Reply

Return to “Scripts and Functions (v2)”