Pasting Script

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
devilock666
Posts: 1
Joined: 22 Mar 2023, 02:19

Pasting Script

Post by devilock666 » 22 Mar 2023, 02:25

Can someone help me create a script with the following description:

Set a Hotkey (Maybe Ctrl+Shift+v)

Every time I press the Hotkey, the script Paste a random "Sentence" from a list that I've set.

Hope someone can help :salute:

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Pasting Script

Post by swagfag » 22 Mar 2023, 04:13

Code: Select all

#Requires AutoHotkey v2.0.2

Sentences := [
	'bla bla', 
	'abc xyz'.
	'random'
]

^+v::{
	orginalCLipboard := A_Clipboard
	
	A_Clipboard := Sentences[Random(1, Sentences.Length)]
	Send('^v')
	Sleep(100) ; give some time to the pasting operation to complete

	A_Clipboard := orginalCLipboard 
}

Post Reply

Return to “Ask for Help (v2)”