Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v2) • Re: Is there a way to copy-on-select without sending ^c ?

$
0
0
@lexikos - thanks for those hints; it's gotten me a bit closer to my goal :-)

Apparently, we can use https://www.autohotkey.com/docs/v2/lib/PostMessage.htm to trigger the copy without the ^C key hack... except not all applications process that (Notepad etc - yes - but VS-Code's vim editor, sadly, no...)

my test, if anyone's interested. Use Spy++ to get the HWND ( c:/Program Files/Microsoft Visual Studio/2022/Community/Common7/Tools/spyxx.exe )

CODE:

#!/usr/bin/env python

__version__ = '1.0.0' # Major.Minor.Patch

# This is free and unencumbered software released into the public domain
# under "The Unlicense" terms: https://choosealicense.com/licenses/unlicense/

"""
=head1 arrange.py - rectangle-based part distribution algorithm


=cut
"""


import win32con, win32gui, sys,os



def main():
if len(sys.argv) < 2:
print("Usage: {} hex_handle".format(sys.argv[0]))
sys.exit(1)

#hwndControl = sys.argv[1] # The handle to the control with selected text
hwndControl = int(sys.argv[1], 16) # The handle to the control with selected text
win32gui.SendMessage(hwndControl, win32con.WM_COPY, 0, 0)

print("Send WM_COPY to {}".format(hwndControl))
sys.exit(0)


if __name__ == '__main__':
main()

Statistics: Posted by cnd — Today, 16:34



Viewing all articles
Browse latest Browse all 579

Trending Articles