AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Muti-Clipboard

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
athiwat



Joined: 23 Aug 2006
Posts: 4

PostPosted: Wed Aug 23, 2006 5:31 am    Post subject: Muti-Clipboard Reply with quote

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
Back to top
View user's profile Send private message
Xaviar
Guest





PostPosted: Wed Aug 23, 2006 3:26 pm    Post subject: Reply with quote

You could shorten your script a little bit.
Back to top
PhiLho



Joined: 27 Dec 2005
Posts: 6836
Location: France (near Paris)

PostPosted: Wed Aug 23, 2006 3:39 pm    Post subject: Reply with quote

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.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
BigBonsai



Joined: 29 Aug 2006
Posts: 22

PostPosted: Tue Aug 29, 2006 9:57 pm    Post subject: Reply with quote

Maybe it could be shorter, but I quite like it...


BiB
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4710
Location: Boulder, CO

PostPosted: Tue Aug 29, 2006 11:37 pm    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group