Richard de Ree
Richard de Ree

Reputation: 2550

AHK clipboard without trimming space and tabs

I need to a change 3 small sets of html code lines in multiple webpages so I want try to use AHK to help me, with paste the code with a single keystroke, however, I don't get the code pasted well. When I use 'clipboard' it trims the tabs and when I don't use clipboard it doubles the tabs

F1::
Clipboard =
        <tr class="pure-table-odd">
        <td><label>Postcode<br><p class="kleiner"></p></td>

however, when I past this, all the tabs and spaces are trimmed

when I use

F1::
    <tr class="pure-table-odd">
    <td><label>Postcode<br><p class="kleiner"></p></td>

Anyone an idea how to handle this?

Upvotes: 0

Views: 238

Answers (2)

Richard de Ree
Richard de Ree

Reputation: 2550

There seems no way to solve this. But I found a good working alternative in which you create a multiple clipboard. You store the clipboards in variables in AutoHotKey. And paste them when needed. I found this script Where you copy the clipboard with CTRL+1 ..... CTRL+2 etc. and paste it with ALT+1 ALT+2 etc.

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

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

the original post can be found here enter link description here

Upvotes: 0

Oleg
Oleg

Reputation: 6324

You need to use a continuation section with join`r`n and use AutoTrim but it won't be enough and you still need to escape the first tab with a backtick. Full code will be:

AutoTrim, Off

Clipboard = `
(join`r`n
        <tr class="pure-table-odd">
        <td><label>Postcode<br><p class="kleiner"></p></td>
)

Upvotes: 2

Related Questions