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 

Deluxe Clipboard
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Iwanttolearneverything



Joined: 06 Jun 2006
Posts: 1

PostPosted: Tue Jun 06, 2006 6:36 am    Post subject: Question regarding this script Reply with quote

Okay, how would I go about copying text information, and assign them to specific names that will never change (thus needed as part of the script) , and then SendInput this information into other windows at a later time in (my) script? Any help would be greatly appreciated. Sorry if this is the wrong forum Very Happy
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Tue Jun 06, 2006 2:01 pm    Post subject: Reply with quote

Read the AHK help for HotKey and HotString. I have a master script, which I run at startup. It includes dozens of HotString definitions with my addresses, phone numbers, job info. When I need them, in any application, I just type , e.g. ph1 for my first phone number, st1 for my street address, etc.
Back to top
View user's profile Send private message
scottmattes



Joined: 21 May 2007
Posts: 98
Location: USA

PostPosted: Wed Nov 14, 2007 8:27 pm    Post subject: Can a named clipboard preview be added? Reply with quote

Laszlo,
I have tried twice to add a preview of the contents of the named clipboard and while I can add the edit to show what is going to be put into the named clipboard (for copy and append) I haven't had success in showing what will be pasted (especially switching between named clipboards).

Is this even possible?

Thank you for this very useful script!
_________________
-------------
Scott Mattes

My small, but growing, collection of scripts.
Back to top
View user's profile Send private message Visit poster's website
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Wed Nov 14, 2007 9:21 pm    Post subject: Reply with quote

Showing the text content of any named (private) clipboard is easy. Non-text information, like formatted texts, tables, graphics, pictures… are difficult, because the receiving application is supposed to render the image. You can pick and show a few standard clipboard formats, like formatted text - and show it in a richtext control, or HTML Internet Explorer Control. They require that your GUI contains the corresponding control. Transfering there a private clipboard has to be done via the Windows clipboard (sending Ctrl-V).
Back to top
View user's profile Send private message
scottmattes



Joined: 21 May 2007
Posts: 98
Location: USA

PostPosted: Thu Nov 15, 2007 8:07 pm    Post subject: Reply with quote

I hadn't even gotten to the part about non-text clipboard contents! but thanks for reminding me.

I set up gComboBoxChange on the ComboBox add line like so

ComboBoxChange:
guicontrolget, name,, name

hexname := string2hex(name)

Clip =

Loop % %HexName%_0
{ ; load clipboard from array
Clip := %HexName%_%A_Index%
}

msgbox, %Clip% ; this shows blank on paste
msgbox % %Clip% ; this shows a big AHK warning about name being too long
return

the intent is that on clipboard name change a text item would be set with the contents (granted, I'll have to code for non-text contents).
Back to top
View user's profile Send private message Visit poster's website
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Fri Nov 16, 2007 6:49 pm    Post subject: Reply with quote

The problem is that the contents of private clipboards are binary, and so when you assign them to Clip, they get truncated at the first NUL. Only the variable Clipboard is treated in a special way: when it is assigned to an AHK variable, the non-text content is stripped. Your code needs to be:
Code:
ComboBoxChange:
   GuiControlGet name,,Name
   Hexname := String2Hex(name)
   Clip =
   Loop % %HexName%_0            ; load all ClipBoards from array
      ClipBoard := %HexName%_%A_Index%, Clip .= ClipBoard
   MsgBox %Clip%
Return
Back to top
View user's profile Send private message
scottmattes



Joined: 21 May 2007
Posts: 98
Location: USA

PostPosted: Sun Nov 18, 2007 2:22 am    Post subject: Reply with quote

Thank you, that is helpful. I was hoping to not have to modify the clipboard each time, but if that is what is needed...

where in the help can I read about ", Clip .= ClipBoard" syntax? In particular the "," between 2 commands and what the ".=" means?
_________________
-------------
Scott Mattes

My small, but growing, collection of scripts.
Back to top
View user's profile Send private message Visit poster's website
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Sun Nov 18, 2007 3:03 am    Post subject: Reply with quote

In the Help, under Expressions, Assign you find that “.=” means to append the right hand side to the content of the variable on the left hand side.

The MsgBox, showing the clipboard content always when a new name is selected, is distractive. You could show its beginning in a ToolTip instead, for a few seconds, or in the TrayTip (which automatically disappears after several seconds).

Another alternative is to have an extra button for the user to manually request showing the content of the current named private clipboard. Something like this:
Code:
AutoTrim Off
names =                          ; | after each name, || after last used (default)

#SingleInstance Force
SetCapslockState AlwaysOff       ; Needed for CapsLock & ... hotkeys.
^CapsLock::                      ; Control-Capslock = Toggle CapsLock
   GetKeyState t, CapsLock, T
   IfEqual t,D, SetCapslockState AlwaysOff
   Else SetCapslockState AlwaysOn
Return

CapsLock & c::WINDOW("&Copy")    ; COPY to private clipboard
CapsLock & v::WINDOW("&Paste")   ; PASTE from private clipboard
CapsLock & x::WINDOW("&Cut")     ; CUT to private clipboard
CapsLock & a::WINDOW("&Append")  ; APPEND to private clipboard
CapsLock & y::WINDOW("Cut&Append") ; CUT+APPEND to private clipboard

WINDOW(Actn) {
   Global
   Gui 3:Destroy                 ; needed for 2nd hotkey while 1st is active
   WinGet CallerID, ID, A        ; save caller's ID as the window to return to

   Gui 3:Font, s10, Arial        ; ADJUST BELOW FOR YOUR SCREEN RESOLUTION
   Gui 3:Add, Text,    x028 y14 w220 h40, Private clipboard name:
   Gui 3:Add, ComboBox,x026 y44 w220 h20 r5 Sort vName, %names%
   Gui 3:Add, Button,  x026 y84 w70  h30  Default, %Actn%
   Gui 3:Add, Button,  x101 y84 w70  h30, &Show
   Gui 3:Add, Button,  x176 y84 w70  h30, Cancel
   Gui 3:Show, h133 w271 Center, Deluxe Clipboard
}

3ButtonShow:
   GuiControlGet name,,Name
   hexname := String2Hex(name)
   Clip =
   Loop % %HexName%_0            ; load all ClipBoards from array
      ClipBoard := %HexName%_%A_Index%, Clip .= ClipBoard
   MsgBox %Clip%
Return

3GuiClose:
3GuiEscape:
3ButtonCancel:
   Gui 3:Destroy
Return

3ButtonCopy:
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   Loop % %HexName%_0
      %HexName%_%A_Index% =      ; clear memory used by the array, if any
   %HexName%_0 = 1               ; chain length = 1
   ClipBoard0  = %ClipBoardAll%  ; save original clipboard
   ClipBoard   =
   Send ^c                       ; copy new data to clipboard
   ClipWait 2, 1                 ; wait up to 2 seconds or until clipboard contains data
   %HexName%_1 = %ClipBoardAll%  ; transfer new clipboard to array
   ClipBoard   = %ClipBoard0%    ; restore original clipboard
Return

3ButtonPaste:
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   ClipBoard0 = %ClipBoardAll%   ; save original clipboard (ClipBoardAll)
   Loop % %HexName%_0
   {                             ; load clipboard from array
     Clipboard =
     Clipboard := %HexName%_%A_Index%
     ClipWait 3                  ; wait for new ClipBoard content
     Send ^v                     ; paste data to window
   }
   ClipBoard  = %ClipBoard0%     ; restore original clipboard
return

3ButtonCut:
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   Loop % %HexName%_0
     %HexName%_%A_Index% =       ; clear memory used by the array, if any
   %HexName%_0 = 1               ; chain length = 1
   ClipBoard0  = %ClipBoardAll%  ; save original clipboard
   ClipBoard   =
   Send ^x                       ; copy new data to clipboard
   ClipWait 2, 1                 ; wait up to 2 seconds or until clipboard contains data
   %HexName%_1 = %ClipBoardAll%  ; transfer new clipboard to array
   ClipBoard   = %ClipBoard0%    ; restore original clipboard
Return

3ButtonAppend:
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   ClipBoard0 = %ClipBoardAll%   ; save original clipboard
   ClipBoard  =
   Send ^c                       ; copy new data to clipboard
   ClipWait 2, 1                 ; wait up to 2 seconds or until clipboard contains data
   %HexName%_0++                 ; increment number of clipboards in the chain
   idx := %HexName%_0
   %HexName%_%idx%=%ClipBoardAll% ; store new clipboard at the next array location
   ClipBoard = %ClipBoard0%      ; restore original clipboard
Return

3ButtonCutAppend:
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   ClipBoard0= %ClipBoardAll%    ; save original clipboard
   ClipBoard =
   Send ^x                       ; copy new data to clipboard
   ClipWait 2, 1                 ; wait up to 2 seconds or until clipboard contains data
   %HexName%_0++                 ; increment number of clipboards in the chain, init = 1
   idx := %HexName%_0
   %HexName%_%idx%= %ClipBoardAll% ; store new clipboard at the next array location
   ClipBoard = %ClipBoard0%      ; restore original clipboard
Return

GoBack:
   Gui 3:Submit, NoHide          ; assign Gui variables
   NameError =
   IfEqual Name,, SetEnv NameError,1
   If Name contains |
      NameError = 1
   IfEqual NameError, 1, {
      WinGet GuiID, ID, A        ; save Gui ID as the window to return to
      MsgBox,,,Please provide a valid`nClipboard Name!,2
      WinActivate ahk_id %GuiID%   ; get back to GUI
      return
   }
   Gui 3:Destroy                 ; GUI's done its task
   WinActivate ahk_id %CallerID% ; get back to caller window
   StringReplace names,names,||,|  ; remove marker of last-used name
   StringGetPos Pos, names,%Name%| ; was this clipboard name used?
   if Pos < 0                    ; new name appended
      names = %names%%Name%||
   else                          ; old name marked as last used
      StringReplace names,names,%Name%|,%Name%||
   HexName := String2Hex(Name)
return

String2Hex(x) {                  ; Convert a string to hex digits
   f := A_FormatInteger
   SetFormat Integer, H
   VarSetCapacity(h, 4*StrLen(x)+1)
   h = X
   Loop Parse, x
      h .= ASC(A_LoopField)      ; 2 digit ASCII code of chars of x, 15 < ASC < 256
   StringReplace h, h, 0x,,All
   SetFormat Integer, %f%
   Return h
}
Back to top
View user's profile Send private message
superdsp



Joined: 18 Jan 2008
Posts: 6

PostPosted: Mon Jan 28, 2008 5:51 am    Post subject: Re: Deluxe Clipboard Reply with quote

Laszlo wrote:
I needed a tool to help rearranging brainstorming texts into structured documents. Named clipboards were of a great help, with instructive names like Introduction, Actions, Function, References, etc. To facilitate these I wrote the following Deluxe Clipboard AHK script. Currently it only works with text, because of the limitations of ClipBoardAll (interference with MS Word and no Append possible). With the changes indicated (and accepting unwanted Word bookmarks) the Copy, Cut and Paste functions work with any selection and clipboard content.

I tried to write the shortest and easiest to maintain script. Any suggestions for improvements?
Code:
; Deluxe Clipboard
; AutoHotkey Version: 1.0.30+
; Language:  English
; Platform:  Win2000/XP
; Author:    Laszlo Hars <www.Hars.US>
;
; Script Function:
;       Provides unlimited number of private, named clipboards to
;          Copy, Cut, Paste, Append or CutAppend of selected text
;       Private clipboard names can consist of numbers, letters, # _ @ $ ? [ ]
;          OK:  01, Greetings, gut_und_schlecht, $5
;          BAD: 1.1, You&Me, Mon Amis
;          The already used names are listed in a sorted drop down list with
;              incremental search (beginning of a name and Up or Down arrow)
;          The last-used name is pre-selected, Enter accepts
;       Repeated hotkeys provide their original functions (auto exit)
;       Esc, Click on Cancel or [x]: escapes out
;       Enter, Alt-underlined, Click: performs action with typed/selected name
;
; Limitations:
;       ClipBoardAll was not used, because
;          it interferes with MS Word (adds bookmarks)
;          non-text clipboards cannot be merged (appended)
;       Removing the Append and CutAppend functions and
;       using ClipBoardAll at the indicated places
;       makes Copy, Cut and Paste of general clipboards possible
;
; Version 1.0: 2005.03.05 Initial creation

names =                         ; | after each name, || after last used (default)

$^!c::                          ; Ctrl-Alt-C hotkey = copy to private clipboard
HKey = c
Actn = &Copy
GoTo WINDOW                     ; return from there

$^!v::                          ; Ctrl-Alt-V hotkey = paste from private clipboard
HKey = v
Actn = &Paste
GoTo WINDOW

$^!x::                          ; Ctrl-Alt-X hotkey = cut to private clipboard
HKey = x
Actn = &Cut
GoTo WINDOW

$^!a::                          ; Ctrl-Alt-A hotkey = append to private clipboard
HKey = a
Actn = &Append
GoTo WINDOW

$^!y::                          ; Ctrl-Alt-Y hotkey = cut+append to private clipboard
HKey = y
Actn = Cut&Append
GoTo WINDOW

WINDOW:
WinGetActiveTitle WinTitle      ; where was the hotkey pressed?
if WinTitle = Deluxe Clipboard
{                               ; hotkey pressed the second time
   Gui Destroy
   WinActivate ahk_id %CallerID%
   Send ^!%HKey%                ; if you change: MATCH hotkey modifiers here and at GUI Text!
   return
}
WinGet CallerID, ID, A          ; save caller's ID at first press of HotKey
Gui Font, s10, MS Sans Serif    ; ADJUST BELOW FOR YOUR SCREEN RESOLUTION
Gui Add, ComboBox,x026 y064 w220 h20 r5 Sort vName, %names%     ; 1st Gui Add = active
Gui Add, Button,  x146 y104 w100 h30, Cancel
Gui Add, Button,  x026 y104 w100 h30  Default, %Actn%
Gui Add, Text,    x028 y014 w220 h40, For Ctrl-Alt-%HKey% repeat, or`nName your private clipboard
Gui Show, h163 w271 Center, Deluxe Clipboard
return

GuiClose:
GuiEscape:
ButtonCancel:
Gui Destroy
return

ButtonCopy:
Gosub GoBack
ClipBoard0 = %ClipBoard%        ; save original clipboard (ClipBoardAll)
Send ^c                         ; copy data to clipboard
CB_%Name%  = %ClipBoard%        ; transfer new clipboard to variable (ClipBoardAll)
ClipBoard  = %ClipBoard0%       ; restore original clipboard
return

ButtonPaste:
Gosub GoBack
ClipBoard0 = %ClipBoard%        ; save original clipboard (ClipBoardAll)
Clipboard := CB_%Name%          ; set clipboard from variable
Send ^v                         ; paste data to window
ClipBoard  = %ClipBoard0%       ; restore original clipboard
return

ButtonCut:
Gosub GoBack
ClipBoard0 = %ClipBoard%        ; save original clipboard (ClipBoardAll)
Send ^x                         ; cut data to clipboard
CB_%Name%  = %ClipBoard%        ; transfer new clipboard to variable (ClipBoardAll)
ClipBoard  = %ClipBoard0%       ; restore original clipboard
return

ButtonAppend:                   ; only works with *text* clipboards
Gosub GoBack
ClipBoard0 = %ClipBoard%        ; save original clipboard (ClipBoardAll)
Send ^c                         ; copy new data to clipboard
cb := CB_%Name%                 ; get private clipboard
CB_%Name% = %cb%%ClipBoard%     ; append new clipboard to variable
ClipBoard = %ClipBoard0%        ; restore original clipboard
return

ButtonCutAppend:                ; only works with *text* clipboards
Gosub GoBack
ClipBoard0= %ClipBoard%         ; save original clipboard (ClipBoardAll)
Send ^x                         ; cut data to clipboard
cb := CB_%Name%                 ; get private clipboard
CB_%Name% = %cb%%ClipBoard%     ; append new clipboard to variable
ClipBoard = %ClipBoard0%        ; restore original clipboard
return

GoBack:
Gui Submit                      ; assign gui variables
Gui Destroy                     ; GUI's done its task
WinActivate ahk_id %CallerID%   ; get back to caller window
StringReplace names,names,||,|  ; remove last-used marker
StringGetPos Pos, names,%Name%| ; was this clipboard name used?
if Pos < 0                      ; new name appended
   names = %names%%Name%||
else                            ; old name marked as last used
   StringReplace names,names,%Name%|,%Name%||
return


Here is the latest version:
Code:
; Deluxe Clipboard
; AutoHotkey Version: 1.0.35+
; Language:  English
; Platform:  Win2000/XP
; Author:    Laszlo Hars <www.Hars.US>
;
; Script Function:
;     Provides unlimited number of private, named clipboards
;     Hotkeys = CapsLock & …
;        c: Copy, x: Cut, v: Paste, a: Append and y: CutAppend any selections
;     In applications using ^c, ^x, ^v for copy, cut, paste to/from the Windows clipboard
;     Private clipboard names consist of any ANSI characters except "|"
;        The already used names are shown in a sorted drop down list with
;            incremental search (beginning of a name and Up or Down arrow)
;        The last-used name is pre-selected, Enter accepts
;     New hotkey replaces function
;
; Version history:
;     1.0: 2005.03.05 Initial creation
;     1.1: 2005.03.07 Error check added for clipboard names
;                     Legible version of A_ThisHotKey in Gui 3:text
;                     2nd hotkey while 1st is active replaces function
;                     Repeated hotkey is detected from saved current hotkey
;     1.2: 2005.03.12 Append: by arrays of private clipboards, $ separated
;                     Paste: each entry of the array one-by-one
;                     ClipBoardAll is used
;     1.3: 2005.05.01 ClipWait up to 2s added for handling large clipboards
;                     Sleep between setup the clipboard and pasting it
;                     ClipBoardAll is used at Append and CutAppend
;     2.0: 2005.10.03 CapsLock & … hotkeys
;                     Use functions, Simplified code
;                     ClipBoard Name -> hex, avoiding naming restrictions, except "|"

#SingleInstance Force
AutoTrim Off
names =                          ; | after each name, || after last used (default)

CapsLock & c::WINDOW("&Copy")    ; COPY to private clipboard
CapsLock & v::WINDOW("&Paste")   ; PASTE from private clipboard
CapsLock & x::WINDOW("&Cut")     ; CUT to private clipboard
CapsLock & a::WINDOW("&Append")  ; APPEND to private clipboard
CapsLock & y::WINDOW("Cut&Append") ; CUT+APPEND to private clipboard

WINDOW(Actn)
{
   Global
   Gui 3:Destroy                 ; needed for 2nd hotkey while 1st is active
   WinGet CallerID, ID, A        ; save caller's ID as the window to return to

   Gui 3:Font, s10, Arial        ; ADJUST BELOW FOR YOUR SCREEN RESOLUTION
   Gui 3:Add, Text,    x028 y14 w220 h40, Private clipboard name:
   Gui 3:Add, ComboBox,x026 y44 w220 h20 r5 Sort vName, %names%
   Gui 3:Add, Button,  x146 y84 w100 h30, Cancel
   Gui 3:Add, Button,  x026 y84 w100 h30  Default, %Actn%
   Gui 3:Show, h133 w271 Center, Deluxe Clipboard
}

3GuiClose:
3GuiEscape:
3ButtonCancel:
   Gui 3:Destroy
Return

3ButtonCopy:
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   Loop % %HexName%_0
      %HexName%_%A_Index% =      ; clear memory used by the array, if any
   %HexName%_0 = 1               ; chain length = 1
   ClipBoard0  = %ClipBoardAll%  ; save original clipboard
   ClipBoard   =
   Send ^c                       ; copy new data to clipboard
   ClipWait 2, 1                 ; wait up to 2 seconds or until clipboard contains data
   %HexName%_1 = %ClipBoardAll%  ; transfer new clipboard to array
   ClipBoard   = %ClipBoard0%    ; restore original clipboard
Return

3ButtonPaste:
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   ClipBoard0 = %ClipBoardAll%   ; save original clipboard (ClipBoardAll)
   Loop % %HexName%_0
   {                             ; load clipboard from array
     Clipboard =
     Clipboard := %HexName%_%A_Index%
     ClipWait 3                  ; wait for new ClipBoard content
     Send ^v                     ; paste data to window
   }
   ClipBoard  = %ClipBoard0%     ; restore original clipboard
return

3ButtonCut:
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   Loop % %HexName%_0
     %HexName%_%A_Index% =       ; clear memory used by the array, if any
   %HexName%_0 = 1               ; chain length = 1
   ClipBoard0  = %ClipBoardAll%  ; save original clipboard
   ClipBoard   =
   Send ^x                       ; copy new data to clipboard
   ClipWait 2, 1                 ; wait up to 2 seconds or until clipboard contains data
   %HexName%_1 = %ClipBoardAll%  ; transfer new clipboard to array
   ClipBoard   = %ClipBoard0%    ; restore original clipboard
Return

3ButtonAppend:                   ; Problems with MS Office
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   ClipBoard0 = %ClipBoardAll%   ; save original clipboard
   ClipBoard  =
   Send ^c                       ; copy new data to clipboard
   ClipWait 2, 1                 ; wait up to 2 seconds or until clipboard contains data
   %HexName%_0++                 ; increment number of clipboards in the chain
   idx := %HexName%_0
   %HexName%_%idx%=%ClipBoardAll% ; store new clipboard at the next array location
   ClipBoard = %ClipBoard0%      ; restore original clipboard
Return

3ButtonCutAppend:                ; Problems with MS Office
   Gosub GoBack
   IfEqual NameError,1, Return   ; Gui remains after wrong name
   ClipBoard0= %ClipBoardAll%    ; save original clipboard
   ClipBoard =
   Send ^x                       ; copy new data to clipboard
   ClipWait 2, 1                 ; wait up to 2 seconds or until clipboard contains data
   %HexName%_0++                 ; increment number of clipboards in the chain, init = 1
   idx := %HexName%_0
   %HexName%_%idx%= %ClipBoardAll% ; store new clipboard at the next array location
   ClipBoard = %ClipBoard0%      ; restore original clipboard
Return

GoBack:
   Gui 3:Submit, NoHide          ; assign Gui variables
   NameError =
   IfEqual Name,, SetEnv NameError,1
   If Name contains |
      NameError = 1
   IfEqual NameError, 1, {
      WinGet GuiID, ID, A        ; save Gui ID as the window to return to
      MsgBox,,,Please provide a valid`nClipboard Name!,2
      WinActivate ahk_id %GuiID%   ; get back to GUI
      return
   }
   Gui 3:Destroy                 ; GUI's done its task
   WinActivate ahk_id %CallerID% ; get back to caller window
   StringReplace names,names,||,|  ; remove marker of last-used name
   StringGetPos Pos, names,%Name%| ; was this clipboard name used?
   if Pos < 0                    ; new name appended
      names = %names%%Name%||
   else                          ; old name marked as last used
      StringReplace names,names,%Name%|,%Name%||
   HexName := String2Hex(Name)
return

String2Hex(x)                    ; Convert a string to hex digits
{
   format = %A_FormatInteger%
   SetFormat Integer, H
   hex = X
   Loop Parse, x
   {
      y := ASC(A_LoopField)      ; 2 digit ASCII code of chars of x, 15 < y < 256
      StringTrimLeft y, y, 2     ; Remove leading 0x
      hex = %hex%%y%
   }
   SetFormat Integer, %format%
   Return hex
}


Terrific! Very useful!
Back to top
View user's profile Send private message
airjrdn



Joined: 25 Feb 2008
Posts: 35

PostPosted: Thu Apr 17, 2008 5:08 pm    Post subject: Reply with quote

I'm trying to consolidate functionality from multiple mini-apps into a single ahk app. So far, I've been able to combine three into one, but one of the outstanding ToDo's is to replace CLCL.

I'm pretty sure I vastly under utilize CLCL. I really only store text within it, but I do group the text into sections (javascript, sql, php, etc.). I could probably get by without that and use this, if this allowed me to retain my saved clips to a a file though.

Any plans on adding the ability to save/load stored clips?
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Thu Apr 17, 2008 5:34 pm    Post subject: Reply with quote

I did not plan saving/loading clips, because the purpose of the script was to help organize brainstorming documents. You write everything said in the meeting, but when you produce a document at the end, you want to categorize ideas. So you just move pieces around, maybe in new documents, and save the results. This use does not need saving, but it is not hard: include a few new buttons, like Save, Load, Show. Show is a bit more involved: you need to choose the application, which can handle the particular clipboard format. WordPad is often sufficient, but not always. A Rich-Text control is faster and smaller, but neither of them can show drawings...
Back to top
View user's profile Send private message
scottmattes



Joined: 21 May 2007
Posts: 98
Location: USA

PostPosted: Fri Jul 25, 2008 1:35 pm    Post subject: Reply with quote

In case anyone else likes the Show function Laszlo added (just for me, thank you), I have a mod that makes it just a tad better.

replace this

Code:

CapsLock & c::WINDOW("&Copy")      ; COPY to private clipboard
CapsLock & v::WINDOW("&Paste")     ; PASTE from private clipboard
CapsLock & x::WINDOW("&Cut")       ; CUT to private clipboard
CapsLock & a::WINDOW("&Append")    ; APPEND to private clipboard
CapsLock & y::WINDOW("Cut&Append") ; CUT+APPEND to private clipboard


with this

Code:

CapsLock & c::WINDOW("&Copy")      ; COPY to private clipboard
CapsLock & v::WINDOW("&Paste")     ; PASTE from private clipboard
CapsLock & x::WINDOW("&Cut")       ; CUT to private clipboard
CapsLock & a::WINDOW("&Append")    ; APPEND to private clipboard
CapsLock & y::WINDOW("Cut&Append") ; CUT+APPEND to private clipboard
CapsLock & s::WINDOW("&Show")      ; SHOW private clipboard


and, for the purist in me, replace this

Code:

   Gui 3:Destroy                 ; needed for 2nd hotkey while 1st is active
   WinGet CallerID, ID, A        ; save caller's ID as the window to return to

   Gui 3:Font, s10, Arial        ; ADJUST BELOW FOR YOUR SCREEN RESOLUTION
   Gui 3:Add, Text,    x028 y14 w220 h40, Private clipboard name:
   Gui 3:Add, ComboBox,x026 y44 w220 h20 r5 Sort vName, %names%
   Gui 3:Add, Button,  x026 y84 w70  h30  Default, %Actn%
   Gui 3:Add, Button,  x101 y84 w70  h30, &Show
   Gui 3:Add, Button,  x176 y84 w70  h30, Cancel
   Gui 3:Show, h133 w271 Center, Deluxe Clipboard


with this

Code:

   Gui 3:Destroy                 ; needed for 2nd hotkey while 1st is active
   WinGet CallerID, ID, A        ; save caller's ID as the window to return to

   Gui 3:Font, s10, Arial        ; ADJUST BELOW FOR YOUR SCREEN RESOLUTION
   Gui 3:Add, Text,    x028 y14 w220 h40, Private clipboard name:
   Gui 3:Add, ComboBox,x026 y44 w220 h20 r5 Sort vName, %names%
   Gui 3:Add, Button,  x026 y84 w70  h30  Default, %Actn%
   if Actn <> &Show
      Gui 3:Add, Button,  x101 y84 w70  h30, &Show
   Gui 3:Add, Button,  x176 y84 w70  h30, Cancel
   Gui 3:Show, h133 w271 Center, Deluxe Clipboard


and now you have Capslock+S to show the private clipboard contents and no redundant Show button when you do use it.
_________________
-------------
Scott Mattes

My small, but growing, collection of scripts.
Back to top
View user's profile Send private message Visit poster's website
scottmattes



Joined: 21 May 2007
Posts: 98
Location: USA

PostPosted: Fri Jul 25, 2008 2:02 pm    Post subject: Reply with quote

BTW, I have started modifying Deluxe Clipboard to use permanent private clipboards.

It isn't very fancy, there is text and a button added to Laszlo's Show MsgBox to facilitate adding text to the permanent file and each time a Capslock combo is done the list gets reloaded. The file has the name as entered by the user, an "=" and then the text (with *crlf* replacing each real CRLF).

I still have to write something to better process the permanent file (deletes have to be done with a text editor for now).
_________________
-------------
Scott Mattes

My small, but growing, collection of scripts.
Back to top
View user's profile Send private message Visit poster's website
trenton_xavier



Joined: 16 Jun 2008
Posts: 64
Location: Pittsburgh, Pennsylvania, USA

PostPosted: Fri Aug 08, 2008 2:16 pm    Post subject: Reply with quote

Is there a way to "clear" the memory used for this?

I re-use the same names, after a script reload, and sometimes when I go to paste it will be the old data. Btw, it's a picture.
Back to top
View user's profile Send private message AIM Address
Laszlo



Joined: 14 Feb 2005
Posts: 4078
Location: Pittsburgh

PostPosted: Fri Aug 08, 2008 3:40 pm    Post subject: Reply with quote

If you reload the script, the old content of the private clipboards cannot persist. Maybe, you have the picture in the clipboard? Also, some programs (MS Word) is known to mess with the clipboard, and behave differently than others. Do you see this data retention in Word?
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
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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