AutoHotkey Community

It is currently May 27th, 2012, 9:27 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Muti-Clipboard
PostPosted: August 23rd, 2006, 6:31 am 
Offline

Joined: August 23rd, 2006, 6:26 am
Posts: 4
Hello

it will be useful (or not)

Code:
by1 = 0
by2 = 0
by3 = 0
by4 = 0
by5 = 0
by6 = 0
by7 = 0
by8 = 0
by9 = 0
return
^1::
If by1 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard1 = %clipboard%
by1 = 1
return
}
If by1 = 1
{
send, {Ctrl Down}v{Ctrl up}
by1 = 0
return
}
^2::
If by2 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard2 = %clipboard%
by2 = 1
return
}
If by2 = 1
{
send, {Ctrl Down}v{Ctrl up}
by2 = 0
return
}
^3::
If by3 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard3 = %clipboard%
by3 = 1
return
}
If by3 = 1
{
send, {Ctrl Down}v{Ctrl up}
by3 = 0
return
}
^4::
If by4 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard3 = %clipboard%
by4 = 1
return
}
If by4 = 1
{
send, {Ctrl Down}v{Ctrl up}
by4 = 0
return
}
^5::
If by5 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard3 = %clipboard%
by5 = 1
return
}
If by5 = 1
{
send, {Ctrl Down}v{Ctrl up}
by5 = 0
return
}
^6::
If by6 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard3 = %clipboard%
by6 = 1
return
}
If by6 = 1
{
send, {Ctrl Down}v{Ctrl up}
by6 = 0
return
}
^7::
If by7 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard3 = %clipboard%
by7 = 1
return
}
If by7 = 1
{
send, {Ctrl Down}v{Ctrl up}
by7 = 0
return
}
^8::
If by8 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard3 = %clipboard%
by8 = 1
return
}
If by8 = 1
{
send, {Ctrl Down}v{Ctrl up}
by8 = 0
return
}
^9::
If by9 = 0
{
send, {Ctrl Down}c{Ctrl up}
clipboard3 = %clipboard%
by9 = 1
return
}
If by9 = 1
{
send, {Ctrl Down}v{Ctrl up}
by9 = 0
return
}

_________________
14 years old man just like to do i can do


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 23rd, 2006, 4:26 pm 
You could shorten your script a little bit.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 23rd, 2006, 4:39 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Indeed. Use variables and loops/indexes.
And you could edit the subject of your message, unless the clipboard is really silent (mutism).

Note that there are already other clipboard managers in this section.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2006, 10:57 pm 
Offline

Joined: August 29th, 2006, 10:56 pm
Posts: 22
Maybe it could be shorter, but I quite like it...


BiB


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 30th, 2006, 12:37 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
It is a good idea, although there are few a little errors in the implementation: at the second press of Ctrl-NumberKey the current clipboard content is pasted, not the saved one. In the hotkeys ^4…^9 clipboard3 is used, not clipboard4… clipboard9. This version fixes them and it is somewhat shorter (so BigBonsai might not like it).
Code:
Loop 9
    HotKey ^%A_Index%, hotty
Return

hotty:
   StringRight i, A_ThisHotKey, 1
   by%i% := !by%i%
   If (by%i%) {
      Send ^c
      clipboard%i% = %clipboard%
   }
   Else {
      clipboard := clipboard%i%
      Send ^v
   }
Return
You could also use %ClipboardAll% in place of %Clipboard% to handle non-text selections.

The script will be more robust if you add "clipboard =" before "Send ^c" and "ClipWait 2" after it, so the script waits until Windows copies the selection to the clipboard (necessary in some applications and with large selections).


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: nomissenrojb, Stigg and 12 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