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 

DualClip

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
apocalypse~r



Joined: 21 Jun 2007
Posts: 24

PostPosted: Thu Jan 10, 2008 4:10 am    Post subject: DualClip Reply with quote

its a simple application that creates a second clipboard.
hotkeys:
CTRL + X: cut to clipboard
CTRL + C: copy to clipboard
CTRL + V: paste from clipboard
WIN + X: cut to other clipboard
WIN + C: copy to other clipboard
WIN + V: paste from other keyboard
WIN + S: switch the contents between the clipboards
in theory, you could make many more clipboards, until you run out of hotkeys. It copies and pastes everything, including text, pictures, binary stuff, files, etc. etc. The cut function works fine too, but cannot be used on files because when the info leaves the actual clipboard windows stops thinking that the file is being cut. (just use copy instead) When run, it creates a monitor window that can be made visible by choosing "show" in its tray menu. closing this window does not exit the program.

NOTE: when the program exits, everything in the second clipboard (altclipboard) is lost.

heres the code:
Code:
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Built for WinXP
; Author:         Apocalypse~R apocalypse-r@lycos.com
;
; Script Function:
;   Provides a mirror clipboard
;
;SCRIPT CONTENTS:
;vars:
;   clip, altclip, clipboard, clipboardall, altclipboard, altclipboardall, temp, tempall
;subroutines:
;   clear, altclear, swap, guiclose, show, exit
;hotkeys:
;   CTRL+C, CTRL+X, CTRL+V, WIN+C, WIN+X, WIN+V, WIN+S,

#NoEnv
SendMode Input

;gets monitor dimensions to determine where to place window
sysget, monitor, monitorworkarea
low := monitorbottom - 233
right := monitorright - 281

;creates the window but doesnt show it
menu, File, add, Close Window, guiclose
menu, File, add, Exit, exit
menu, TRAY, add, Show, show
menu, mainmenu, add, File, :File
gui, menu, mainmenu
gui, add, text, x3 y3 w51 h13, Clipboard:
gui, add, edit, x4 y18 w195 h54 vclip, %clipboard%
gui, add, text, x4 y74 w61 h13, AltClipboard:
gui, add, edit, x4 y89 w195 h54 valtclip,
gui, add, button, x201 y17 w72 h50 gclear, Clear
gui, add, button, x201 y94 w72 h50 galtclear, Clear
gui, add, button, x201 y67 w72 h27 gSwap, Swap
winset, alwaysontop, on, Copypad

;updates the edits on the window
loop
{
  sleep, 1000
  guicontrol, , clip, %clipboard%
  guicontrol, , altclip, %altclipboard%
}

;WIN + X hotkey
#x::
hotkey, ^x, , off
tempall := clipboardall
clipboard =
send, ^x
altclipboard := clipboard
altclipboardall := clipboardall
clipboard =
clipboard := tempall
hotkey, ^x, , on
return

;normal CTRL + X hotkey
$^x::send, ^x

;WIN + C hotkey
#c::
hotkey, ^c, , off
tempall := clipboardall
clipboard =
send, ^c
altclipboard := clipboard
altclipboardall := clipboardall
clipboard =
clipboard := tempall
hotkey, ^c, , on
return

;normal CTRL + C hotkey
$^c::send, ^c

;WIN + V hotkey
#v::
hotkey, ^v, , off
tempall := clipboardall
clipboard := altclipboardall
clipboard := altclipboardall
send, ^v
sleep 500
clipboard =
clipboard := tempall
hotkey, ^v, , on
return

;normal CTRL + V hotkey
$^v::send, ^v

;Swap hotkey
#s::goto, swap

;clears the clipboard and the associated edit control
clear:
clipboard =
guicontrol, , clip,
return

;clears the other clipboard and the associated edit control
altclear:
altclipboard =
altclipboardall =
guicontrol, , altclip,
return

;switches the contents of the clipboard and the other clipboard between the two
swap:
temp := clipboard
tempall := clipboardall
clipboard := altclipboardall
altclipboard := temp
altclipboardall := tempall
guicontrol, , clip, %clipboard%
guicontrol, , altclip, %altclipboard%
return

;hides the window and adds the show option in the tray menu when window is closed
guiclose:
gui, hide
menu, TRAY, add, Show, show
return

;shows the window
show:
menu, tray, delete, show
gui, show, w275 h147 x%right% y%low%, Copypad
return

;exits the script
exit:
msgbox, 4, DualClip, Exiting the program will cause the`ncontents of the second clipboard to be lost.`ncontinue anyways?
ifmsgbox, yes
  exitapp
else
  return
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   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