Page 1 of 1

Pasting Multi Line Texts

Posted: 14 Feb 2020, 20:46
by IAmRoot
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

Re: Pasting Multi Line Texts

Posted: 14 Feb 2020, 23:56
by Hellbent
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
}


Re: Pasting Multi Line Texts

Posted: 15 Feb 2020, 03:57
by list
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