Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

NEW:clipboardMenu0.8:paste,edit,save last 20 clipboard items


  • Please log in to reply
48 replies to this topic
kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
if you use it, please send comments and suggestions.
The hotkey to show the menu is WIN+SPACE
The hotkey to switch between modes is CTRL+WIN+C
To paste an item simple click that item in the menu.
To work with paste/edit/save mode(PES mode) select this mode from tray menu or use the hotkey. Then, when selecting an item from clipboard menu, another menu will let you past, edit or save that item. To quickly paste an item in PES mode, just double click that item

new( 0.8 ):
- now in paste only mode you can edit a clip by holding down CTRL while selecting an item, or save a clip by holding SHIFT key, or preview an item by holding WIN key
- now copying the same clip more times should not put more than one item
- thanks to Anonymous90210 for feedback on "features"
- thanks to missdipsy for feedback on "exit function"

new(0.7):
-choose if to work in paste only mode, or paste/edit/save mode (default is paste only mode)
-CTRL+WIN+C lets you switch between modes

new(0.6):
-customize number of items
-numbers for saved clips

new(0.5):
-when selecting an item from the menu, decide if to paste,edit or save(permanently) it.Pasting is quite like before, only you must double click the item (seeingit it's easier than explaning)
PLEASE TELL ME IF THIS VERSION IS BETTER OR IF YOU PREFERE 0.4.


new(0.4):
-Item show "start...end" of the clipboard if this is too long

tip(0.4):
-if you copy a file: in explorer you will paste the file,
in an editor you will paste the file path


new(0.3):
-it looks better
-files saved on txt files to use them if you want
-support for files(beta)

fixed(0.3):
-now all items paste correctly(before some items around 15 didn't work)

;                                                                                                                     ;                 
;           author:Salvatore Agostino Romeo - [email protected]                     
;                                                                                                                   
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/*                                                                                                                     
          kiu-clipSave - It keeps trace of last 20(or customize it)
          text (or files) items copied on clipboard and                     
          shows them in a menu to quickly paste, edit               
          or save something later. Now you can choose
          if to work in paste only mode, or paste/edit/save mode.
          CTRL+WIN+C lets you switch between modes
          
					New in version 0.8:
					In Paste only mode:
					-if you hold down CTRL while clicking on an item, you will edit that item
					-if you hold down SHIFT key while clicking on an item you'll be able to save it.
					-if you hold down LWIN key while clicking on an item you'll be able to preview it 
					 on a tooltip(press LButton to unshow the tooltip)
					                                                    
          Version: 0.8                                                                             
          License:GPL                                                                                 
          Note: sub-project of kiu-radialM                                               
*/                                                                                                                     
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;         USER SETTINGS
numberOfElements:=20
;         END


#Persistent
#SingleInstance force

previousClip=
clipIndex:=0
pom=enabled
menu, tray, NoStandard
menu, tray, add, Paste Only mode, pom
menu, tray, add, Paste/Edit/Save mode,pesm
menu, tray, add, Display features, features
menu, tray, add, Exit,exitapplication
Menu,kiu2,add,Paste,clipPaste
Menu,kiu2,add,Edit,clipPaste
Menu,kiu2,add,Save,clipPaste
IfNotExist, data
   FileCreateDir, data
IfNotExist, data\saved
   FileCreateDir, data\saved
return



^#c::
   if(toggleMode())
      pom=enabled
   else
      pom=disabled
return

pom:
   pom=enabled
return

pesm:
   pom=disabled
return

#Space::
clipMenu()
return

OnClipboardChange:
   if(A_EventInfo=1)
      {
         currentClip=%clipboard%
         currentClip_b=%clipboardall%
         IfEqual,currentClip, %previousClip%
            return
         else
            previousClip=%clipboard%
      }
   saveClip()
return

clipMenu()
   {
      global
      startIndex:=clipIndex
      Menu,kiu,add
      Menu,kiu,DeleteAll
      Loop,%numberOfElements%
         {
            zero=
            puntini=
            if(StrLen(startIndex)=1)
               zero=0
            FileReadLine, filec, data\%zero%%startIndex%.txt, 1
            FileReadLine, filec, data\%zero%%startIndex%.txt, 1
            if(StrLen(filec)>35)
               {
                        toCut:=StrLen(filec)-18
                        StringMid, itemTemp1, filec, 1, 12
                  StringTrimLeft, itemTemp2, filec, %toCut%
                  itemTemp=%itemTemp1%...%itemTemp2%
                     }
            else
               itemTemp=%filec%
            if(A_Index<10)   
               Menu,kiu,add,%A_Space%%A_Space%%A_Index%. %itemTemp%,clipSelect
            else
               Menu,kiu,add,%A_Index%. %itemTemp%,clipSelect
            startIndex--
            if(startIndex=0)
               startIndex:=numberOfElements
         }
      Menu,kiu,add
      Menu,kiuSaved,add
         Menu,kiuSaved,deleteAll
         Loop,data\saved\*.txt               
               {
                  if(StrLen(A_Index)=1)
               zero=0
                  Menu,kiuSaved,add,%zero%%A_Index%. %A_LoopFileName%,clipSaved
               }
      Menu,kiuSaved,add,Cancel,Cancel
         Menu,kiu,add,Saved Clips, :kiuSaved
         Menu,kiu,add,Cancel,Cancel
      Menu,kiu,show
      return
   }
saveClip()
   {
      global
         currentIndex()
      FileDelete, data\%clipIndex%.txt
      FileAppend, %currentClip%, data\%clipIndex%.txt
      FileDelete, data\%clipIndex%_b.txt
      FileAppend, %currentClip_b%, data\%clipIndex%_b.txt
      return
   }
;index of the clip.This is done to implement a sort of queue structure
currentIndex()
   {
      global
      clipIndex++
      If(clipIndex=21)
         clipIndex=1
      if(StrLen(clipIndex)=1)
         clipIndex=0%clipIndex%
      return
   }

Cancel:
return   

clipSaved:
   StringTrimLeft, OutputVar, A_ThisMenuItem, 4
   Run,data\saved\%OutputVar%
return
clipSelect:
   if(pom="enabled")
      {
         clipSelectedItemPos:= A_ThisMenuItemPos
         goto,clipPaste
      }
   else
      {
         MouseGetPos, x, y
         clipSelectedItemPos:= A_ThisMenuItemPos
         inX:=x-25
         inY:=y-10
         Menu,kiu2,show, %inX%, %inY%
      }
return
;when pressing an item of a menu
clipPaste:
   fileNum := clipIndex - clipSelectedItemPos + 1
   if(fileNum < 0)
      fileNum := numberOfElements + fileNum
  if(StrLen(fileNum)=1)
         fileNum=0%fileNum%
   selection=%A_ThisMenuItemPos%
   if(pom="enabled")
   {
			if(GetKeyState("CTRL" , "P"))
			  {
			     Run,data\%fileNum%.txt
			     return
			  }
			if(GetKeyState("Shift" , "P"))
			  {
			     InputBox, name, Name of the clip, Select the name for the clip
			     FileCopy,data\%fileNum%.txt,data\saved\%name%.txt
			     return
			  }
			if(GetKeyState("LWIN" , "P"))
			  {
			     FileRead, content, data\%fileNum%.txt
			     tooltip, %content%
			     KeyWait, LButton, D
			     tooltip,
			     return
			  }
	 }
	 else
      {   
         if(selection=2)
            {
               Run,data\%fileNum%.txt
               return
            }
         if(selection=3)
            {
               InputBox, name, Name of the clip, Select the name for the clip
               FileCopy,data\%fileNum%.txt,data\saved\%name%.txt
               return
            }
      }
  FileRead, clip, data\%fileNum%.txt
  clipboard=
  clipboard=%clip%
  Send,^v
  SetTitleMatchMode, 2
  IfWinExist, xplore
         IfWinActive, xplore
            {
               FileRead,clip_b, *c data\%fileNum%_b.txt
               clipboard=%clip_b%
               Send,^v
            }
   IfWinExist, ahk_class ExploreWClass
         IfWinActive, ahk_class ExploreWClass
            {
               FileRead,clip_b, *c data\%fileNum%_b.txt
               clipboard=%clip_b%
               Send,^v
            }
return

toggleMode()
{
 static m
 m := !m
 Return, m
} 


features:
msgbox, 
(
Clipboardmenu's features:
The hotkey to show the menu is WIN+SPACE .
To paste an item simple click that item in the menu. If you hold down CTRL while clicking 
on an item, you will edit that item. If you hold down SHIFT key while clicking on an item 
you'll be able to save it.

ClipboardMenu support another working mode called Paste/Edit/Save mode.
This will let you paste/edit/save your clips using mouse only.
The hotkey to switch between modes is CTRL+WIN+C .

To work with paste/edit/save mode(PES mode) select this mode 
from tray menu or use the hotkey. Then, when selecting an item 
from clipboard menu, another menu will let you past, edit or 
save that item. To quickly paste an item in PES mode, just 
double click that item.

If you copy a file: in explorer you will paste the file, 
in an editor you will paste the file path
)
return

exitapplication:
exitapp
return


____________________
______________________
kiu - www.romeosa.com

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
note:every item is saved in data\NUM.kiu file so you can restart your PC and all items are always present, or you may want to save your data permanently
____________________
______________________
kiu - www.romeosa.com

garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005
kiu, very nice
if you want , for comments can use /* */ instead of many commas ;
/*
remark one
remark two
remark three
*/


kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
:p oh yes
____________________
______________________
kiu - www.romeosa.com

EXtes
  • Members
  • 7 posts
  • Last active: Apr 07 2012 11:31 AM
  • Joined: 01 Oct 2005
I tried many clipboard managers with AHK.
I Think i will prefer this.
Thanks for sharing it.

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
Thank you so much :p .
____________________
______________________
kiu - www.romeosa.com

Baro
  • Guests
  • Last active:
  • Joined: --
keep up the good scripts :D

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
new version. See first post
Always send feedback
Thanks to all people replies: only when I see that someone is interested in a script, I'll be glad to post new versions
:wink:
____________________
______________________
kiu - www.romeosa.com

badbox
  • Members
  • 3 posts
  • Last active: Jul 06 2006 08:46 PM
  • Joined: 22 Nov 2005
Is there possibility to add function for last 20 files that are marked as copy? (copy selected ITEM (file) to clipboard)?

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
just change clipbaoard --> clipboardAll in lines 28,32
and FileRead, clip, data\%fileNum%.txt --> FileRead, clip, *c data\%fileNum%.txt in line 90.

But in this way you can't see the item names anymore. I'll work on this later
____________________
______________________
kiu - www.romeosa.com

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
better solution published on first post.
It works for Explorer, xplorer2 and should work for any file manager that contains the word "xplore" in its title
____________________
______________________
kiu - www.romeosa.com

garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005
thank you kiu, works fine
a question:
I saved 2 marked text,when I press win+space I see the next 18 lines with contents from 01.txt (2kB)
should they (the next 18 ) be empty ?
for what is the second file (01_b.txt, 15kB) ?

  • Guests
  • Last active:
  • Joined: --
You see the next 18 lines with contents from 01.txt because there are only two item in data folder. When you have pasted more than 19 clips, you will see all 20 different items

The file *_b.txt contains informations about non text clipboard, like files or formatted text.

Thank you for replying

TheLeO
  • Members
  • 264 posts
  • Last active: Jan 02 2012 01:51 AM
  • Joined: 11 Jun 2005
super, you are a star :)
::
I Have Spoken
::

kiu
  • Members
  • 234 posts
  • Last active: Oct 10 2010 07:30 PM
  • Joined: 18 Dec 2005
new version on first post.

I'm working to a new release. This will add these option:
1)a tooltip will show a preview of the clip item under mouse(when moving the mouse over the menu)

2)submenu at the end of the menu for "saved clips"

3)different actions when selecting a menu item with a mouse button:
-left mouse button will paste the clipboard item(like now)
-middle mouse button will save this clipboard item in
a separate folder(and this item will be present on
"saved clips" submenu)
-right mouse button will allow to edit a clipboard item

I don't know if these options can be implemented in AHK with the use of Menu and I've not much time to spend now on this work. I say that cause I noticed when a menu is called everything is frozen in the script(hotkey,tooltip,....). Maybe this can be solved by manipulating thread priorities, but I don't know absolutly how this works(and I can't study it for now). If the option above can't be implemented with the use of the Menu command, maybe I will use ListView to create a menu on the next release.
If someone can give me elucidations about, please post them here

Sorry for language mistakes(please let me note these too)
____________________
______________________
kiu - www.romeosa.com