AutoHotkey Community

It is currently May 25th, 2012, 2:48 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: February 11th, 2005, 7:05 am 
Offline

Joined: February 11th, 2005, 6:31 am
Posts: 174
Location: Germany
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



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2005, 1:30 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Nice. I can see that this would be quite useful for certain specialized tasks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2005, 6:10 am 
Offline

Joined: February 11th, 2005, 6:31 am
Posts: 174
Location: Germany
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. :wink:

Code:
*AppsKey::
   send ^c
   send ^v
return


Last edited by Andi on February 12th, 2005, 6:20 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2005, 6:17 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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? :D

Code:
*Appskey::send,^c^v


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2005, 7:02 am 
Offline

Joined: February 11th, 2005, 6:31 am
Posts: 174
Location: Germany
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2005, 12:57 am 
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. :lol:
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2005, 7:14 am 
Offline

Joined: February 11th, 2005, 6:31 am
Posts: 174
Location: Germany
One thought came me to Ctrl+X. :idea:

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 :o )


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, JamixZol and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group