Copy/Paste

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dellarocco88
Posts: 35
Joined: 07 Apr 2022, 01:34

Copy/Paste

Post by dellarocco88 » 17 May 2022, 11:44

Trying to create a copy/paste tool, but with a meny that shows what words are copied.
But I can't get the text to write in the GUI. Can anyone help?

Code: Select all

Main:
Gui, Font, s10 Bold

Gui, Add, Text, x20 y20, 1: %Clip1%
Gui, Add, Text, x20 y50, 2: %Clip2%
Gui, Add, Text, x20 y80, 3: %Clip3%

Gui, +AlwaysOnTop
Gui, Show, x500 y500 w200 h150, Box

^1::
Send ^c
ClipWait
Clip1 := ClipBoardAll
return
!1::
ClipBoard := Clip1
Send ^v
return

^2::
Send ^c
ClipWait
Clip2 := ClipBoardAll
return
!2::
ClipBoard := Clip2
Send ^v
return

^3::
Send ^c
ClipWait
Clip3 := ClipBoardAll
return
!3::
ClipBoard := Clip3
Send ^v
return

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Copy/Paste

Post by mikeyww » 17 May 2022, 11:51

After the GUI is displayed, you can use :arrow: GuiControl to change values in controls. In your testing, I would use Clipboard rather than ClipboardAll.

dellarocco88
Posts: 35
Joined: 07 Apr 2022, 01:34

Re: Copy/Paste

Post by dellarocco88 » 18 May 2022, 15:16

If I want to add a row of text like the code below, when the Ctrl + 4 i down.
Is the code correct? Were should I place the code?

Code: Select all

If (GetKeyState("Ctrl") && GetKeyState("4"))
	{
	Gui, Font, s9
	Gui, Add, Text, x10 y170, Hello World
	}

User avatar
mikeyww
Posts: 26599
Joined: 09 Sep 2014, 18:38

Re: Copy/Paste

Post by mikeyww » 18 May 2022, 19:27

I suggest backing up first, to create a simple test. The test will do two things: first, display a GUI; second, change a control.

Code: Select all

Gui, Font, s10
Gui, Add, Text, w230 vt1, Test1
Gui, Show
F3:: GuiControl,, t1, Test2
Read GuiControl. See if the script works. See if you understand it. It can then form a basis for expanding to do what you need.

Next: display a GUI; add a control.

Code: Select all

Gui, Font, s10
Gui, Add, Text, w230 vt1, Test1
Gui, Show

^4::
Gui, Font, s9
Gui, Add, Text,, Hello World
Gui, Show, h70
Return

Post Reply

Return to “Ask for Help (v1)”