Jump to content

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

ClipStep - Step through multiple clipboards using Ctrl-X-C-V


  • Please log in to reply
39 replies to this topic
slmndr
  • Members
  • 2 posts
  • Last active: Mar 20 2007 05:40 AM
  • Joined: 13 Mar 2007
I am trying to add a suspend and a close command to this script, so I can have it running with others that won't work with it.

I tried adding these lines
!`::Suspend
^!=::ExitApp
When I run the script with the above lines, I get "No Clip Exists" when I press Ctrl-C to create a new clip and when I press Ctrl-V to paste.

Any ideas why my Suspend and ExitApp hotkeys would break the script?

Thanks.
slmndr

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
Where did you put those lines?

slmndr
  • Members
  • 2 posts
  • Last active: Mar 20 2007 05:40 AM
  • Joined: 13 Mar 2007

Where did you put those lines?


In the wrong place. :wink:

It's always the last place you look isn't it?
Moved them to here (red):
$^v::
If numofclips<1
{
  tooltip=No clip exists
  Gosub,TOOLTIP
  delete=no
  paste=yes
  Return
}
If paste<>no
  Gosub,FINDNEXT
Gosub,SHOWCLIP
delete=no
paste=paste
Return

[color=red]!`::Suspend
^!=::ExitApp[/color]

ADDCLIP:
readclip=filearray1
readclip:=%readclip%
lastclip=%readclip%
lastclip+=1
numofclips+=1
activeclip=1
IfExist,%lastclip%.clip
  FileDelete,%lastclip%.clip
FileAppend,%ClipboardAll%,%lastclip%.clip
Return
After all the Ctrl- combo handlers and just before the subroutines.

Everything works great now.

slmndr

drmurdoch
  • Members
  • 111 posts
  • Last active: Oct 28 2013 09:52 PM
  • Joined: 10 Nov 2006

ClipStep - Control multiple clipboards using only the keyboard's Ctrl-X-C-V

Select some text, press Ctrl-C to copy it to multiple new clipboards.
Now hold down Ctrl and press V repeatedly to step through the clipboards. C steps backwards.
When you've got the clipboard you want, release Ctrl to paste.
To delete a clipboard, hold down Ctrl, press V followed by X twice to delete, three times to delete all, or once to cancel. Release Ctrl to accept.

The clipboards are saved to separate files, so place the script in it's own folder.

Skrommel


Without this explanation, a user would be unable to use the clipstep.exe from this website.

<!-- m -->http://www.donationc...tware/Skrommel/<!-- m -->

There is no explantion. A user would have to get lucky and find this thread.

I have another suggestion ... it would be nice if the "Copy" command from selecting text ... right clicking on text and selecting "copy" was supported.

My brain seems to copy with the right click method for URLs in browsers and filenames in Windows Explorer. I don't know why :)

Cereal
  • Members
  • 45 posts
  • Last active: Apr 17 2009 01:36 AM
  • Joined: 17 Mar 2007
awesome script!!!, i was going to make something similar still might, but i work for online tech support and i contastly have to switch between windows to move information over this will save me alot of time and effort TY VM

soggos
  • Members
  • 129 posts
  • Last active: Nov 30 2012 10:35 AM
  • Joined: 27 Mar 2008
:D Really Ilike this made of way; At the beginning it's so strange. And After so good so well so merveillouse!
great thanks for skrommel
PS:It's very interressant, i don(t understand everything,but it's so practical!
I wan't to work with this way of doing :)

gpfsmurf
  • Guests
  • Last active:
  • Joined: --
Very old thread, but I still find this very useful...

If I hit ctrl+c on a file, I get the tooltip "empty selection", where as if I use ctrl+x, it saves it as a clip and I can then paste it (works as it does in windows).

Currently, copying files with ctrl+c is effectively broken while running the script, but I can use the ctrl+insert and shift+insert mentioned by peepsalot. I had no clue those shortcuts existed.


To correct this bug, simply add "ClipWait,1" after the "Send,^c" line, like it's done for Ctrl-X. The file will then be copied properly.

Goodies
  • Guests
  • Last active:
  • Joined: --
Old topic I know but I've just discovered this awesome script. So simpel yet so effective. THANKS!

Should be standard in windows.

risingevil
  • Members
  • 42 posts
  • Last active: Oct 14 2011 05:33 PM
  • Joined: 28 Jul 2010
I add this:

clip2:=ClipboardAll
If clip1<>%clip2%
{
Gosub,ADDCLIP
Gosub,INDEX
}
clip1:=clip2

to the beginning of $^v::, in hopes of adding anything that is copied to the clipboard via the context menu copy/cut. So, it adds the text to the clip database, but if i press the hotkey again, it'll add the same text. Did I miss something, or does my last line and the if statement i copied from $^c:: not handle repeated test.

thanks in advance.

lastnikita
  • Guests
  • Last active:
  • Joined: --
You should use ClipWait.

Here's a script I threw up quickly, I think it does a much better job.
Handles anything copied to clipboard (not only via Ctrl-V)

You can retrieve clipboard number, active app when it was created and content via Shift-Ctrl-V

You can set how much clipboard you want to store in the first lines of script (max).

Unfortunately, it crashes from time to time :(
If someone is able to spot why (or can optimize it any way), well great !!

Enjoy ;)


#SingleInstance force
#Persistent
#NoEnv
Menu, TRAY, icon, %A_WinDir%\system32\SHELL32.dll, 48
SetWorkingDir %A_ScriptDir%
SetBatchLines, -1
max = 4
Return

OnClipboardChange:
If nochange or !A_EventInfo
    nochange=0
Else {
    num3=0    
    num++
    If num=%max%
        num=1        
    WinGet, app%num%, ProcessName, A
    IfInString, app%num%, .exe
    {
        StringGetPos, pos, app%num%, .exe
        StringLeft, app%num%, app%num%, pos
    }
    clip%num% := ClipboardAll
}
Return

^+v::
if !num3
    num2 := num
num3 = 1
num2--
If !num2
    num2:=max-1
nochange=1
clipboard := clip%num2%
StringLeft,clip0,Clipboard,200
If (StrLen(Clipboard) > 200)
    clip0=%clip0%...
texte = % "#" . num2 . " - " . app%num2% . ":`n" . clip0
ToolTip, %texte%
SetTimer, TT, 2000
Return

TT:
SetTimer, TT, Off
ToolTip
Return


lastnikita
  • Guests
  • Last active:
  • Joined: --
Also, if someone knows how to retrieve the file content type (picture, audio, etc.), that would be a nice addition as well.

DeWild1
  • Members
  • 369 posts
  • Last active: Feb 28 2014 08:15 PM
  • Joined: 30 Apr 2006

While reading another topic, I'd forgotten about the script above so wrote the below. Here it is in case it's of use to anyone or if there's anything of merit that can be combined with the one above:

; This script keeps a record of the clipboard contents so that in effect, you have
; more than one clipboard.  To restore the old clipboards (one by one), press the
; Win+Space or Shift+Win+Space hotkeys (or other hotkeys as configured below).
; The script give you feedback about what's on the clipboard via Tooltips.

; CONFIGURATION SECTION. SET YOUR PREFERENCES HERE:
MaxClipboards = 5  ; How many clipboards to maintain in the list.
HotkeyBack = #space  ; Hotkey to move backward through the list of clipboards.
HotkeyFwd = #+space  ; Hotkey to move forward through the list of clipboards.

; END OF CONFIGURATION SECTION

Hotkey, %HotkeyBack%, HotkeyBack
Hotkey, %HotkeyFwd%, HotkeyFwd

#Persistent
ClipIndex = 0
ClipIndexToRestore = 0

OnClipboardChange:
if (A_EventInfo = 0 OR NoSaveClipboard)
	return  ; Empty or the hotkey told us not to save its own change to the clipboard.
; Check if what's on the clipboard now exactly matches the previously saved item. If it
; does, don't save it.  This solves the fact that some apps save each clipboard twice.
if ClipIndex > 0
{
	ClipSavedTemp := ClipboardAll  ; ...because can't compare directly to ClipboardAll.
	if ClipSaved%ClipIndex% = %ClipSavedTemp%  ; Must be old-style if-statement.
		return
}
ClipIndex += 1  ; Move to the next slot.
if (ClipIndex > MaxClipboards)  ; Wrap back around to the beginning.
	ClipIndex = 1
ClipIndexToRestore := ClipIndex  ; Reset the hotkey's bookmark each time a save occurs.
ClipSaved%ClipIndex% := ClipboardAll  ; Save the current contents of the clipboard.
ToolTip, %ClipIndex%, A_CaretX, A_CaretY  ; Briefly notify the user of the item number.
SetTimer, ToolTipOff, 1000
return

HotkeyBack:
HotkeyFwd:
if ClipIndexToRestore = 0  ; No saved clipboards yet.
	return
if (A_ThisHotkey = HotkeyBack)
{
	ClipIndexToRestore -= 1  ; Move backward through the list.
	if ClipIndexToRestore <= 0  ; Wrap around to the tail end of list.
		ClipIndexToRestore := MaxClipboards
}
else  ; (A_ThisHotkey = HotkeyFwd)
{
	ClipIndexToRestore += 1  ; Move forward through the list.
	if ClipIndexToRestore > %MaxClipboards%  ; Wrap around to beginning or list.
		ClipIndexToRestore := 1
}
if StrLen(ClipSaved%ClipIndexToRestore%) = 0  ; Nothing saved, so don't do it.
{
	ToolTip Restored Clipboard #%ClipIndexToRestore% is empty., A_CaretX, A_CaretY
	SetTimer, ToolTipOff, 2000
	return
}
NoSaveClipboard := true  ; Tell OnClipboardChange not to save our clipboard change.
Clipboard := ClipSaved%ClipIndexToRestore%
ToolTip Restored Clipboard #%ClipIndexToRestore%:`n%Clipboard%, A_CaretX, A_CaretY
SetTimer, ToolTipOff, 2000
Sleep 30  ; This gives the OnClipboardChange subroutine an opportunity to run.
NoSaveClipboard := false
return

ToolTipOff:
ToolTip
SetTimer, ToolTipOff, Off
return


Ya know what???
I would kill or die to see a combo of these two scripts.. Chris's and the first post here.
Chris's does it upon clipboard change. Very smart, not limited to Ctrl C. (I use the mouse half the time)
Chris's also shows more of what is on the clipboard.
The first post is more user friendly. Just Ctrl V and scroll through, (oh wait, I use the mouse too sometimes, what then? :roll: .. Oh well, I could get used to using only Ctrl V so I can scroll, but Chris's Copy from anything in the clipboard is better.)

But, yes, after using it for a few min, I realized that it is very important to add the clip file whenever and however a clipboard is added, but the Ctrl V is most user friendly.

Does anyone know how to combine the two?
Chris's is well documented but the other is not and I am not that smart. So any help would be much loved. :wink:

lastnikita
  • Guests
  • Last active:
  • Joined: --
well, what about mine, in the post just above yours ;)

Morpheus
  • Members
  • 463 posts
  • Last active: Today, 10:37 AM
  • Joined: 31 Jul 2008
I modified Chris' script to only rotate through used clips up to MaxClipboards.

; This script keeps a record of the clipboard contents so that in effect, you have
; more than one clipboard.  To restore the old clipboards (one by one), press the
; Win+Space or Shift+Win+Space hotkeys (or other hotkeys as configured below).
; The script give you feedback about what's on the clipboard via Tooltips.

; CONFIGURATION SECTION. SET YOUR PREFERENCES HERE:
MaxClipboards = 5  ; How many clipboards to maintain in the list.
HotkeyBack = #space  ; Hotkey to move backward through the list of clipboards.
HotkeyFwd = #+space  ; Hotkey to move forward through the list of clipboards.

; END OF CONFIGURATION SECTION

HotkeyBack:
HotkeyFwd:
if ClipIndexToRestore = 0  ; No saved clipboards yet.
   return
   [color=red]MaxClipIndex := ClipIndex > MaxClipboards ? ClipIndex : MaxClipboards[/color]
if (A_ThisHotkey = HotkeyBack)
{
   ClipIndexToRestore -= 1  ; Move backward through the list.
   if ClipIndexToRestore <= 0  ; Wrap around to the tail end of list.
      [color=red]ClipIndexToRestore := MaxClipIndex[/color]
}
else  ; (A_ThisHotkey = HotkeyFwd)
{
   ClipIndexToRestore += 1  ; Move forward through the list.
   [color=red]if ClipIndexToRestore > %MaxClipIndex%[/color] ; Wrap around to beginning or list.
      ClipIndexToRestore := 1
}
if StrLen(ClipSaved%ClipIndexToRestore%) = 0  ; Nothing saved, so don't do it.
{
   ToolTip Restored Clipboard #%ClipIndexToRestore% is empty., A_CaretX, A_CaretY
   SetTimer, ToolTipOff, 2000
   return
}
NoSaveClipboard := true  ; Tell OnClipboardChange not to save our clipboard change.
Clipboard := ClipSaved%ClipIndexToRestore%
ToolTip Restored Clipboard #%ClipIndexToRestore%:`n%Clipboard%, A_CaretX, A_CaretY
SetTimer, ToolTipOff, 2000
Sleep 30  ; This gives the OnClipboardChange subroutine an opportunity to run.
NoSaveClipboard := false
return

ToolTipOff:
ToolTip
SetTimer, ToolTipOff, Off
return


risingevil
  • Members
  • 42 posts
  • Last active: Oct 14 2011 05:33 PM
  • Joined: 28 Jul 2010
I've compiled the original ClipSteop so that I can run it om my USB flash drive. However, I noticed something very strange. The data files that holds the multiple clipboards (1.clip 2.clip .... whatever number pieces of info you have copied) are not saved in the save directory as the script.

Basically I use a program called restart_on_crash to start and maintain some of my background apps, but instead of saving the clipboard data in the script directory, it is saved in restart_on_crash's directory. So the data is saved in the directory of the program that launches the script. This greatly confuses me since all restart_on_crash does is check if if a given program(s) is running/responding, and if not, kills that program(s) and then execute a command, which most people choose to be the program that was just closed.

Any suggestions on how to fix this is appreciated.