Anyway, I was writing a script that copies a line in Notepad++ and sets it as a variable, then goes up two lines, and sets another as another variable. But, when I do this it sets them both as the second variable.
Code: Select all
!+1::
WinActivate, ahk_exe notepad++.exe ; open Notepad++
Sleep, 50
Send, ^{numpad3} ; navigate to relevant tab
Sleep, 20
Send, {Down 100} ; ensure that cursor is at the bottom
Sleep, 10
Send, ^+x ; Notepad++ shortcut to copy text of current line
Sleep, 20
var1 = %clipboard% ; set clipboard contents as variable
Sleep, 10
Send, {Up 2} ; navigate two lines up
Sleep, 10
Send, ^+x ; copy this line
Sleep, 20
var2 = %clipboard% ; set clipboard contents as second variable
Sleep, 10
WinMinimize, ahk_exe notepad++.exe ; minmize Notepad++
return
Using MsgBox to display var1 and var2 afterwards, I can't get the first line that is copied to appear. Anytime the second variable is set to the clipboard contents, it overwrites it. I would imagine that this is because it is thinking var1 = %clipboard%, and %clipboard% = var2, therefore var1 = var2, but I don't know how to tell AHK that the contents of the clipboard have changed and that they are not equal to each other.