help with script to toggle ctrl c and then ctrl v when needed Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
turbinefan
Posts: 12
Joined: 14 Jun 2022, 07:42

help with script to toggle ctrl c and then ctrl v when needed

03 May 2024, 08:36

Hi. I am trying to create an ahk script that allows me to use one key or combination to do two functions: 1) copy highlighted text to clipboard, 2) paste this when the same key/combination is pressed again

it seems simple but i can't get my head around getting this to work.

here is what i have tried so far:

Code: Select all

^v::

send ^c

sleep 50

KeyWait Ctrl, D

KeyWait Ctrl, U

KeyWait v, D

KeyWait v, U

send ^v

Return
and

Code: Select all

^v::

send ^c

sleep 50

If !GetKeyState("Ctrl", "v")

	Return

send ^v

Return
But this does not get past the send ^c part. Any help would be appreciated. thanks
User avatar
mikeyww
Posts: 28869
Joined: 09 Sep 2014, 18:38

Re: help with script to toggle ctrl c and then ctrl v when needed  Topic is solved

03 May 2024, 09:31

Code: Select all

#Requires AutoHotkey v1.1.33.11

F3::
If on := !on {
 Clipboard := ""
 Send ^c
 ClipWait 0
 If ErrorLevel {
  MsgBox 48, Error, An error occurred while waiting for the clipboard.
  on := False
 } Else {
  ToolTip % Clipboard
  SoundBeep 1500
 }
} Else {
 Send ^v
 ToolTip
}
Return
turbinefan
Posts: 12
Joined: 14 Jun 2022, 07:42

Re: help with script to toggle ctrl c and then ctrl v when needed

03 May 2024, 09:43

that is exactly what i want :D

thank you so much

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 149 guests