Visual Studio: duplicate line

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Visual Studio: duplicate line

16 Aug 2017, 11:17

I have this code to duplicate a line in Visual Studio. I was wondering if there was a way to avoid using the clipboard. Can AutoHotkey use COM to do this? (Cf. Visual Studio macros.) You can retrieve all of the text from the GUI element via AccViewer, but I'm not sure if you can get the start/end points. UI Automation? Cheers.

Code: Select all

#IfWinActive, ahk_exe WDExpress.exe
^d:: ;visual studio - duplicate line
;SendInput, {Up}{Home}+{End}^c{Down}^v ;paste text
;SendInput, {Up}^c{Down}^v ;paste text and linebreak

ClipSaved := ClipboardAll
Clipboard := ""
SendInput, {Up}{Home}+{End}^c
ClipWait, 3
SendInput, {Down}{End}^v
Sleep, 200
Clipboard := ClipSaved
return
#IfWinActive
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: aitaixy, Anput, Nerafius, RandomBoy and 185 guests