I would like to make a function that copies highlighted text, but cannot use ^c because that is a defined hotkey, and I don't want to trigger it. If you instead have an idea of how to do that instead, that'd be great, but keep in mind:
- I can't use $^c because I DO want other parts to trigger the ^c hotkey
- I can't use SendPlay ^c because that does nothing
- I can't use #InputLevel/SendLevel because I want ^c on level 0.
I figured I need something like the following:
Code: Select all
DllCall("user32.dll\OpenClipboard", "Ptr", 0)
DllCall("user32.dll\EmptyClipboard")
VarSetCapacity(txt, some_number)
DllCall("user32.dll\SetClipboardData", "UInt", 1, "UPtr", &txt)
DllCall("user32.dll\CloseClipboard")
- I think I need to set a capacity for txt before I call SetClipboardData, but I have no idea how to know how long the copied string is before I copy it.
- Looking at the documentation of SetClipboardData, it looks like both the second parameter and the return value are the same thing. Please correct me if I'm wrong.
- Even after using some dummy number for some_number and checking both txt AND the return value, I still get nothing promising.
- A_LastError turns out to be 6. I have no idea what that means or how to figure it out.
- I'm not sure if I need an additional parameter for the DllCall for SetClipboardData. Using something like "UPtr" doesn't seem to change the output at all.