Pasting Multi Line Texts

Get help with using AutoHotkey and its commands and hotkeys
IAmRoot
Posts: 1
Joined: 14 Feb 2020, 20:44

Pasting Multi Line Texts

14 Feb 2020, 20:46

Hi, I am fairly new to auto hotkey and i just got a streamdeck to help streamline my web development process. With the stream deck they have a "text" option but it types it out like a macro what I am looking for is a way to basically copy and paste code snippets without typing them because autocomplete screws that up.
How would i do multiline pasting with auto hot key, something like this

Code: Select all

axios.post('url', {
                    data: data
                }, config).then((response) => {
                    console.log(response)
                }).catch((error) => {
                    console.log(error)
                })
I tried something like this

Code: Select all

temp := clipboardall
clipboard := "axios.post(url, {
                    data: data
                }, config).then((response) => {
                    console.log(response)
                }).catch((error) => {
                    console.log(error)
                })"
sendinput, ^v
clipboard := temp
return
but ahk does not like it being multiline
User avatar
Hellbent
Posts: 1061
Joined: 23 Sep 2017, 13:34

Re: Pasting Multi Line Texts

14 Feb 2020, 23:56

You can use (forgive me if I'm saying it wrong) a Continuation Section

Here is a simple example.

The Continuation Section it self is between the two marked lines in the function and doesn't need to be in a function like I have it.

Code: Select all

numpad1::clipboard := ContinuationSection()

ContinuationSection(){
;-----------------------------------------------------------
temp = 
(% ` Join`r`n
axios.post(url, {
	data: data
}, config).then((response) => {
	console.log(response)
}).catch((error) => {
	console.log(error)
})
)
;-----------------------------------------------------------
	return temp
}

list
Posts: 195
Joined: 26 Mar 2014, 14:03
Contact:

Re: Pasting Multi Line Texts

15 Feb 2020, 03:57

If you have many of these to setup, Lintalist might be something for you to look into as you can paste many snippets either via search, hotstring or shorthand
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3378

Return to “Ask For Help”

Who is online

Users browsing this forum: tmplinshi and 40 guests