| View previous topic :: View next topic |
| Author |
Message |
Andi
Joined: 11 Feb 2005 Posts: 157 Location: Germany, Niestetal
|
Posted: Fri Feb 11, 2005 6:05 am Post subject: Strg+C and Strg+V on one key |
|
|
Short but useful...
| Code: |
;Puts Strg+C and Strg+V on one key. The AppsKey is the rarely used key that invokes the right-click context menu.
;A marked text is always copied to the clipbord
;To insert the clipboard again, no text must be selected, otherwise the new selection is copied to the clipboard
*AppsKey::
If Clip =
{
send ^c
Clip = 1
}
If Clip = 1
{
send ^v
Clip =
}
return
|
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Fri Feb 11, 2005 12:30 pm Post subject: |
|
|
| Nice. I can see that this would be quite useful for certain specialized tasks. |
|
| Back to top |
|
 |
Andi
Joined: 11 Feb 2005 Posts: 157 Location: Germany, Niestetal
|
Posted: Sat Feb 12, 2005 5:10 am Post subject: |
|
|
All the time I was thinking about, why this works.
My primary idea as I wrote the script was an other: When it is invoked the first time it should send Strg+c, the second time Strg+v, the third time Strg+c again etc. The comical is, that I forgot the return in the first if statement to end the script after sending Strg+c
The script below even does the same, but in a smarter way as I intended. It copies selected text to the clipboard and sends it out when not text is marked. It works because the selected text ist replaced at once by itself. When you paste it again a Strg+c has no effect to the clipboard, when no text is selected so then following Strg+v is working now.
Looks funny, but it works wonderful.
| Code: |
*AppsKey::
send ^c
send ^v
return
|
Last edited by Andi on Sat Feb 12, 2005 5:20 am; edited 1 time in total |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Sat Feb 12, 2005 5:17 am Post subject: |
|
|
I was a bit confused about "Strg" until the almighty Google granted me the light of understanding:
Control (Eng) - Steuerung (Deu)
I was also confused about your script... it didn't look like it would work, it seemed a paradox to send both at the same time, but then I thought about it a bit more and I was again struck with a wonderful revelation. Only problem is it conflicts with one of PSPad's features and if you want to replace the selection with the clipboard, it won't work.
P.S. If you like shortening scripts, how's this?
| Code: | | *Appskey::send,^c^v |
|
|
| Back to top |
|
 |
Andi
Joined: 11 Feb 2005 Posts: 157 Location: Germany, Niestetal
|
Posted: Sat Feb 12, 2005 6:02 am Post subject: |
|
|
Sorry I didn't think to the english keyboard layout.
Now it looks really short.
I think if you want to replace the selection with the clipboard, you need two keys again... or perhaps one could take a double-click functionality... |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Feb 12, 2005 11:57 pm Post subject: |
|
|
Here is my Version with Doubleclick, which also replaces selected text with the Content of the Clipboard.
When you have marked a text, just press the right Shift-Key once and the text is copied to the clipboard. The special effect is, when you select the text by pressing the right Shift-Key together with one of the Arrow- Keys, the Text is automatically copied to the clipboard.
To paste it somewhere again, press the right Shift-Key twice. (ctrl-V is send)
When you want to select a Text without copying automatically to the clipbord, you must take the left Shift-Key with one of the Arrow-Keys or you have to make the Selection with the mouse.
I haven't tried out, if this is suitable in rough everyday life.
| Code: | ~RShift::
keywait, RShift
keywait, RShift, d t0.5
if errorlevel ;Only a single press was made
{
send, ^c
return
}
;now there was a Double-Click
send, ^v
return |
|
|
| Back to top |
|
 |
Andi
Joined: 11 Feb 2005 Posts: 157 Location: Germany, Niestetal
|
Posted: Sun Feb 13, 2005 6:14 am Post subject: |
|
|
One thought came me to Ctrl+X.
| Quote: |
...when you select the text by pressing the right Shift-Key together with one of the Arrow- Keys, the Text is automatically copied to the clipboard.
|
...when you select the Text in this way, pressing the Delete Key has the the same effect as Ctrl+X.
p.s. I forgot to mention that automate way of course also works with following Keys:
RArrow + Home
RArrow + End
RArrow + PgUp
RArrow + PgDn
(sorry for writing anonymous...I forgot to log in ) |
|
| Back to top |
|
 |
|