AutoHotkey Community

It is currently May 27th, 2012, 6:47 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 49 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: February 6th, 2006, 9:48 pm 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
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)

Code:
;                                                                                                                     ;                 
;           author:Salvatore Agostino Romeo - romeo84@gmail.com                     
;                                                                                                                   
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/*                                                                                                                     
          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


Last edited by kiu on December 10th, 2006, 12:02 am, edited 22 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2006, 12:14 pm 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2006, 1:13 pm 
Offline

Joined: April 19th, 2005, 10:26 am
Posts: 2249
Location: switzerland
kiu, very nice
if you want , for comments can use /* */ instead of many commas ;
Code:
/*
remark one
remark two
remark three
*/


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2006, 5:17 pm 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
:P oh yes

_________________
____________________
______________________
kiu - www.romeosa.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2006, 9:39 am 
Offline

Joined: October 1st, 2005, 12:53 pm
Posts: 7
I tried many clipboard managers with AHK.
I Think i will prefer this.
Thanks for sharing it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2006, 8:42 pm 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
Thank you so much :P .

_________________
____________________
______________________
kiu - www.romeosa.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2006, 8:41 am 
keep up the good scripts :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2006, 5:06 pm 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2006, 9:03 pm 
Offline

Joined: November 22nd, 2005, 10:47 pm
Posts: 3
Is there possibility to add function for last 20 files that are marked as copy? (copy selected ITEM (file) to clipboard)?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2006, 11:53 pm 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2006, 12:06 am 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
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


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

Joined: April 19th, 2005, 10:26 am
Posts: 2249
Location: switzerland
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) ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2006, 10:39 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2006, 1:52 pm 
Offline

Joined: June 11th, 2005, 9:34 am
Posts: 264
Location: England ish
super, you are a star :)

_________________
::
I Have Spoken
::


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2006, 3:45 pm 
Offline

Joined: December 18th, 2005, 5:40 pm
Posts: 234
Location: Italy - Galatro(RC)
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 49 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Google [Bot], jepjep24 and 20 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