| View previous topic :: View next topic |
| Author |
Message |
azure
Joined: 07 Jun 2007 Posts: 694
|
Posted: Sun Jul 01, 2007 2:22 am Post subject: duplicate line |
|
|
hello
in my text editor, the hotkey ctrl+y duplicates the current line
is it possible to do it globally?
thanks |
|
| Back to top |
|
 |
Conquer
Joined: 27 Jun 2006 Posts: 385 Location: Canada
|
Posted: Sun Jul 01, 2007 4:20 am Post subject: |
|
|
globally?
Well heres some code to produce the same effect, if thats what you're after:
| Code: |
^y::
SetKeyDelay, -1
Temp := ClipboardAll
Clipboard =
Send {End}+{home}^c
ClipWait, 2
Send {End}{Enter}%Clipboard%
Clipboard := Temp
return |
Untested but I'm sure it'll work fine |
|
| Back to top |
|
 |
azure
Joined: 07 Jun 2007 Posts: 694
|
Posted: Sun Jul 01, 2007 4:53 pm Post subject: |
|
|
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! |
|
| Back to top |
|
 |
polyethene
Joined: 11 Aug 2004 Posts: 5248 Location: UK
|
Posted: Sun Jul 01, 2007 5:18 pm Post subject: |
|
|
| azure wrote: | | but as you can see, it doesnt repaste the ! | Put {Raw} before the %Clipboard% part in Send. _________________ GitHub • Scripts • IronAHK • Contact by email not private message. |
|
| Back to top |
|
 |
svi
Joined: 09 Oct 2006 Posts: 236 Location: Finland
|
Posted: Sun Jul 01, 2007 5:22 pm Post subject: |
|
|
| azure wrote: | | but as you can see, it doesnt repaste the !, dunno why | It's because ! is interpretted as Alt (as + is Shift or ^ is Ctrl).
So use SendRaw: | Code: | Send {End}{Enter}
SendRaw %Clipboard% |
| azure wrote: | | also, it doesnt work when the cursor is at the begining of the line | In Notepad, Notepad++ or WordPad no problems ...
Edit:
Titan was little faster  _________________ Pekka Vartto |
|
| Back to top |
|
 |
azure
Joined: 07 Jun 2007 Posts: 694
|
Posted: Sun Jul 01, 2007 5:23 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Sukarn
Joined: 16 Jun 2007 Posts: 35
|
Posted: Sun Jul 01, 2007 5:38 pm Post subject: |
|
|
| azure wrote: |
also, can you tell me please how to make it not to work in specific windows |
use IfWinActive? |
|
| Back to top |
|
 |
Alexander
Joined: 01 Jul 2007 Posts: 17
|
Posted: Sun Jul 01, 2007 6:56 pm Post subject: |
|
|
| 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... |
|
| Back to top |
|
 |
YMP
Joined: 23 Dec 2006 Posts: 418 Location: Russia
|
Posted: Mon Jul 02, 2007 4:34 am Post subject: |
|
|
| azure wrote: |
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. |
|
| Back to top |
|
 |
azure
Joined: 07 Jun 2007 Posts: 694
|
Posted: Mon Jul 02, 2007 5:22 am Post subject: |
|
|
yes, switching language before copying works, but its waste of time to do it each time
is there any workaround? |
|
| Back to top |
|
 |
Tarch
Joined: 23 Jun 2007 Posts: 87
|
Posted: Mon Jul 02, 2007 7:22 am Post subject: |
|
|
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!  |
|
| Back to top |
|
 |
Tarch
Joined: 23 Jun 2007 Posts: 87
|
Posted: Mon Jul 02, 2007 7:36 am Post subject: |
|
|
Btw,
look here
Bye!  |
|
| Back to top |
|
 |
YMP
Joined: 23 Dec 2006 Posts: 418 Location: Russia
|
Posted: Mon Jul 02, 2007 7:51 am Post subject: |
|
|
| azure wrote: | 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.
| Code: |
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}
Return
|
The 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):
| Code: |
F11::
SetFormat, Integer, H
WinGet, WinID,, A
ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0)
InputLocaleID:=DllCall("GetKeyboardLayout", "UInt", ThreadID)
MsgBox, %InputLocaleID%
Return
|
|
|
| Back to top |
|
 |
svi
Joined: 09 Oct 2006 Posts: 236 Location: Finland
|
Posted: Mon Jul 02, 2007 9:21 am Post subject: |
|
|
I didn't first notice it, but now I wonder why Conquer used Clipboard instead of normal Paste key combination Ctrl+V?
Using | Code: | | Send {End}{Enter}^v | you don't need to use raw and also Greek chars gets copied like normally  _________________ Pekka Vartto |
|
| Back to top |
|
 |
azure
Joined: 07 Jun 2007 Posts: 694
|
Posted: Mon Jul 02, 2007 9:43 am Post subject: |
|
|
| svi wrote: | I didn't first notice it, but now I wonder why Conquer used Clipboard instead of normal Paste key combination Ctrl+V?
Using | Code: | | Send {End}{Enter}^v | you 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? |
|
| Back to top |
|
 |
|