 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
kiu
Joined: 18 Dec 2005 Posts: 229 Location: Italy - Galatro(RC)
|
Posted: Mon Feb 06, 2006 9:48 pm Post subject: NEW:clipboardMenu0.8:paste,edit,save last 20 clipboard items |
|
|
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
Last edited by kiu on Sun Dec 10, 2006 12:02 am; edited 22 times in total |
|
| Back to top |
|
 |
kiu
Joined: 18 Dec 2005 Posts: 229 Location: Italy - Galatro(RC)
|
Posted: Tue Feb 07, 2006 12:14 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1033 Location: switzerland
|
Posted: Tue Feb 07, 2006 1:13 pm Post subject: |
|
|
kiu, very nice
if you want , for comments can use /* */ instead of many commas ;
| Code: | /*
remark one
remark two
remark three
*/
|
|
|
| Back to top |
|
 |
kiu
Joined: 18 Dec 2005 Posts: 229 Location: Italy - Galatro(RC)
|
Posted: Tue Feb 07, 2006 5:17 pm Post subject: |
|
|
oh yes _________________ ____________________
______________________
kiu |
|
| Back to top |
|
 |
EXtes
Joined: 01 Oct 2005 Posts: 5
|
Posted: Thu Feb 09, 2006 9:39 am Post subject: |
|
|
I tried many clipboard managers with AHK.
I Think i will prefer this.
Thanks for sharing it. |
|
| Back to top |
|
 |
kiu
Joined: 18 Dec 2005 Posts: 229 Location: Italy - Galatro(RC)
|
Posted: Thu Feb 09, 2006 8:42 pm Post subject: |
|
|
Thank you so much . _________________ ____________________
______________________
kiu |
|
| Back to top |
|
 |
Baro Guest
|
Posted: Sat Feb 11, 2006 8:41 am Post subject: |
|
|
keep up the good scripts  |
|
| Back to top |
|
 |
kiu
Joined: 18 Dec 2005 Posts: 229 Location: Italy - Galatro(RC)
|
Posted: Sat Feb 11, 2006 5:06 pm Post subject: |
|
|
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
 _________________ ____________________
______________________
kiu |
|
| Back to top |
|
 |
badbox
Joined: 22 Nov 2005 Posts: 3
|
Posted: Sat Feb 11, 2006 9:03 pm Post subject: |
|
|
| Is there possibility to add function for last 20 files that are marked as copy? (copy selected ITEM (file) to clipboard)? |
|
| Back to top |
|
 |
kiu
Joined: 18 Dec 2005 Posts: 229 Location: Italy - Galatro(RC)
|
Posted: Sat Feb 11, 2006 11:53 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
kiu
Joined: 18 Dec 2005 Posts: 229 Location: Italy - Galatro(RC)
|
Posted: Sun Feb 12, 2006 12:06 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1033 Location: switzerland
|
Posted: Sun Feb 12, 2006 10:22 am Post subject: |
|
|
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) ? |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Feb 12, 2006 10:39 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
TheLeO
Joined: 11 Jun 2005 Posts: 161 Location: England ish
|
Posted: Sun Feb 12, 2006 1:52 pm Post subject: |
|
|
super, you are a star  _________________ And i say: where there is a problem , there is a solution.(well some where that is.)
::
I Have Spoken
:: |
|
| Back to top |
|
 |
kiu
Joined: 18 Dec 2005 Posts: 229 Location: Italy - Galatro(RC)
|
Posted: Mon Feb 13, 2006 3:45 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|