![Photo](https://secure.gravatar.com/avatar/bb2849bc27c7f15e86611c833e54ae7e?s=100&d=%2F%2Fwww.autohotkey.com%2Fboard%2Fpublic%2Fstyle_images%2Fortem%2Fprofile%2Fdefault_large.png)
duplicate line
Started by
azure
, Jul 01 2007 02:22 AM
22 replies to this topic
hello
in my text editor, the hotkey ctrl+y duplicates the current line
is it possible to do it globally?
thanks
in my text editor, the hotkey ctrl+y duplicates the current line
is it possible to do it globally?
thanks
#1
-
Posted 01 July 2007 - 02:22 AM
![duplicate line: post #1](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
globally?
Well heres some code to produce the same effect, if thats what you're after:
Well heres some code to produce the same effect, if thats what you're after:
^y:: SetKeyDelay, -1 Temp := ClipboardAll Clipboard = Send {End}+{home}^c ClipWait, 2 Send {End}{Enter}%Clipboard% Clipboard := Temp returnUntested but I'm sure it'll work fine
#2
-
Posted 01 July 2007 - 04:20 AM
![duplicate line: post #2](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
thanks, it works good!
thanks, it works good
thanks, it works good
but as you can see, it doesnt repaste the !, dunno why
also, it doesnt work when the cursor is at the begining of the line
any fixes?
PS: is it possible the script to recognize whether there is space for new line or not and only then work?
I mean, clicking ctrl+y in the address bar sends an ENTER that makes the browser visit the webpage
it should only work 1) when the cursor is vertical (text) and 2) only when it is possible to write multiple lines in the edit control
thanks!
thanks, it works good
thanks, it works good
but as you can see, it doesnt repaste the !, dunno why
also, it doesnt work when the cursor is at the begining of the line
any fixes?
PS: is it possible the script to recognize whether there is space for new line or not and only then work?
I mean, clicking ctrl+y in the address bar sends an ENTER that makes the browser visit the webpage
it should only work 1) when the cursor is vertical (text) and 2) only when it is possible to write multiple lines in the edit control
thanks!
#3
-
Posted 01 July 2007 - 04:53 PM
![duplicate line: post #3](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
It's because ! is interpretted as Alt (as + is Shift or ^ is Ctrl).but as you can see, it doesnt repaste the !, dunno why
So use SendRaw:
Send {End}{Enter} SendRaw %Clipboard%
In Notepad, Notepad++ or WordPad no problems ...also, it doesnt work when the cursor is at the begining of the line
Edit:
Titan was little faster
![:)](http://www.autohotkey.com/board/public/style_emoticons/default/happy.png)
#5
-
Posted 01 July 2007 - 05:22 PM
![duplicate line: post #5](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
Pekka Vartto
thanks
can you tell me please why it doesnt work in greek? all the scripts that copy and paste text, dont work well
εςφξεςφ εςιφξες
åòöîåòö åòéöîåò ; this is supposed to be the duplicate line of the above
also, can you tell me please how to make it not to work in specific windows
can you tell me please why it doesnt work in greek? all the scripts that copy and paste text, dont work well
εςφξεςφ εςιφξες
åòöîåòö åòéöîåò ; this is supposed to be the duplicate line of the above
also, can you tell me please how to make it not to work in specific windows
#6
-
Posted 01 July 2007 - 05:23 PM
![duplicate line: post #6](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
also, can you tell me please how to make it not to work in specific windows
use IfWinActive?
#7
-
Posted 01 July 2007 - 05:38 PM
![duplicate line: post #7](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
I've tried to tweaked the script a little and replaced the send of the enter key by a linefeed... But it still gets recognised as if you pressed enter in the IE and Firefox behavior...
#8
-
Posted 01 July 2007 - 06:56 PM
![duplicate line: post #8](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
can you tell me please why it doesnt work in greek? all the scripts that copy and paste text, dont work well
Switch the window to Greek before copying. If it helps, then it's the problem of converting from ANSI to Unicode.
Some programs, when you paste text in them, require the text from the clipboard to be in Unicode. If the text is in ANSI, Windows automatically transcodes it. In case the window where you copied the text was in Greek, the Greek codepage will be used and the Greek letters will be coded correctly. If the window was in English, Windows uses the English codepage, and the national characters are lost.
#9
-
Posted 02 July 2007 - 04:34 AM
![duplicate line: post #9](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
yes, switching language before copying works, but its waste of time to do it each time
is there any workaround?
is there any workaround?
#10
-
Posted 02 July 2007 - 05:22 AM
![duplicate line: post #10](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
Hi,
you could use a send command to switch the language because ALT-SHIFT (in the italian version, it could be different, because some hotkeys are different between versions) is the default command to switch the language. Obviously there are some problems because this depends from the language you have set and from how many languages do you use. I don't know if there is a command to switch or a function in some dll.
Hope it helps a bit!
Bye! :shock:
you could use a send command to switch the language because ALT-SHIFT (in the italian version, it could be different, because some hotkeys are different between versions) is the default command to switch the language. Obviously there are some problems because this depends from the language you have set and from how many languages do you use. I don't know if there is a command to switch or a function in some dll.
Hope it helps a bit!
Bye! :shock:
![:)](http://www.autohotkey.com/board/public/style_emoticons/default/happy.png)
#11
-
Posted 02 July 2007 - 07:22 AM
![duplicate line: post #11](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
yes, switching language before copying works, but its waste of time to do it each time
There's no need to do it manually. You can switch the language by sending the WM_INPUTLANGCHANGEREQUEST message to the window. Check if the window is in English, if so, switch it to Greek, copy (or cut), and switch back to English.
F11:: Eng=0x4090409 Greek=0x4080408 WinGet, WinID,, A ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0) InputLocaleID:=DllCall("GetKeyboardLayout", "UInt", ThreadID) if(InputLocaleID=Eng) { SendMessage, 0x50,, Greek,, A Send, ^{vk43} ; Ctrl-C SendMessage, 0x50,, Eng,, A } else Send, ^{vk43} ReturnThe code above presumes that the input locale ID for Greek is 0x4080408 and the virtual key code of C is 0x43. If not so, correct them. To find out the input locale ID, use this (the active window should be in Greek):
F11:: SetFormat, Integer, H WinGet, WinID,, A ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0) InputLocaleID:=DllCall("GetKeyboardLayout", "UInt", ThreadID) MsgBox, %InputLocaleID% Return
#13
-
Posted 02 July 2007 - 07:51 AM
![duplicate line: post #13](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
I didn't first notice it, but now I wonder why Conquer used Clipboard instead of normal Paste key combination Ctrl+V?
Using
Using
Send {End}{Enter}^vyou don't need to use raw and also Greek chars gets copied like normally
![:)](http://www.autohotkey.com/board/public/style_emoticons/default/happy.png)
#14
-
Posted 02 July 2007 - 09:21 AM
![duplicate line: post #14](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)
Pekka Vartto
I didn't first notice it, but now I wonder why Conquer used Clipboard instead of normal Paste key combination Ctrl+V?
UsingSend {End}{Enter}^vyou don't need to use raw and also Greek chars gets copied like normally
this code
^+y::
SetKeyDelay, -1
Temp := ClipboardAll
Clipboard =
Send {End}+{home}^c
ClipWait, 2
Send {End}{Enter}^v
Clipboard := Temp
return
pastes:
Send {End}{Enter}^v
Send {End}{Enter}^v
etc, not the current line
do I miss something?
#15
-
Posted 02 July 2007 - 09:43 AM
![duplicate line: post #15](http://www.autohotkey.com/board/public/style_images/ortem/icon_share.png)