ReClip; a Text Reformatting and Clip Management Utility

Post your working scripts, libraries and tools
TAC109
Posts: 287
Joined: 02 Oct 2013, 19:41
Location: New Zealand

ReClip; a Text Reformatting and Clip Management Utility

16 Feb 2017, 19:28

Introduction
ReClip uses the clipboard to perform a variety of different text reformatting tasks, and also includes clip management facilities. It was convenient to place these rather different roles in the same program so that Windows clipboard changes that were caused by the reformatting side, could be locked out of the clip management part of the program and not appear in the historical list of clips.

If you wish to only use some of the facilities of ReClip, just ignore the parts you're not interested in.

Reformat Text
This feature works in conjunction with any text editor, on selected text. It allows for a variety of different text formatting options, etc. Below is a summary of the options available. More detailed information is in the ReClip built-in help.
  • Mono-spaced text in selected paragraphs can be reformatted to fit within a fixed number of columns. Formatting options here include ragged right, justified, centred, or unformatted. (See the 'Change options' screen shot, and this post for an example.)
  • Selected lines of text can be examined for over-long lines, showing a report highlighting lines found.
  • A variety of different case-conversions may be performed on the selected text. (See the 'Extra facilities' screen shot. The algorithm used for capitalising sentences is described in this post.)
  • You can centre text within repeating characters on lines, with optional insertion of source code comment tokens at the start of each line.
  • Selected text can be wrapped within a duplicated character. For example if the selected text was 'word' (without the quotes) and the character was %, the replaced text would be %word%. The various brackets are handled intelligently. (Thanks to davebrny and guest3456 for the idea.)
The overall hotkey used by ReClip can be changed in the Extra facilities window (see the screen shot below), and defaults to CapsLock. It is used in various combinations with the Windows, Shift, Ctrl, and Alt keys to trigger the various activities.

In addition, right-clicking the system tray icon will give access to all ReClip's features. For touch screen friendliness you can also set a default item to be actioned by double (or single) clicking the tray icon.

As a safety measure, ReClip will also monitor the Control+Z hotkey when sent to Windows File Explorer. For further information on this see the 'Help' screen shot.

Screen shots:-

Clip Management
This feature is very light on resources used, and makes use of in-memory indexes to locate a particular clip or list of clips quickly. The normal Windows clipboard hotkeys and menu items work in the standard way and are not monitored by ReClip.

When there is a new clip in the Windows clipboard, ReClip records a copy, assigns a name to the clip, writes both to disk, and adds the name to the top of its main list. Any old same-named clip in the main list is deleted.

The clips in the main list are temporary and age down as new clips are recorded. However when one of these temporary clips is accessed, it is moved back to the top of the list. The clips at the bottom of the main list will be deleted when the total number exceeds the maximum defined by the user in the settings. (See the 'Other settings' section of the 'Extra facilities' screen shot above.)

In addition to the main list, you can create folders to hold permanent clips, and manage the clips in these folders. (In the screen shots below, the 'Kept', 'Special', etc. folders have been set up to demonstrate this feature.)

To see a menu of previous clips, press the appropriate hotkey, or select 'Access clips' from the ReClip tray menu. Paste a clip via the clipboard by left-clicking with the mouse, or right-click to see an additional menu for managing this clip.

To help find a particular clip, you can specify a simple filter by clicking on the menu header. The list shown will then only include clips which contain that filter in the name.

For more information, see the ReClip built-in help.

Screen shots:-

Download
ReClip can be downloaded from here. The zip file includes source and executable.

Update History
Last edited by TAC109 on 23 Dec 2018, 18:57, edited 7 times in total.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
Helgef
Posts: 3703
Joined: 17 Jul 2016, 01:02
Contact:

Re: ReClip; a Text Reformatting and Clip Management Utility

18 Feb 2017, 17:19

I find the reformatting very useful, eg

Code: Select all

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam scelerisque maximus laoreet. Morbi in feugiat metus. Donec ut congue ligula. Cras dui eros, facilisis sed bibendum eget, fringilla id dui. Nulla ultricies tempor magna, quis dictum urna vehicula eget. Praesent sed lorem nec nisi aliquam maximus. Cras sem orci, rhoncus sed dui at, fringilla dictum risus. Cras mattis ante et ex malesuada vehicula. Cras lobortis mi sed mi lobortis porta. Curabitur rhoncus, ante ut dictum pretium, leo elit ullamcorper ante, quis condimentum velit nisi at nibh. Curabitur sem risus, convallis at eros dapibus, fringilla vehicula velit. Suspendisse quis convallis mi.
to

Code: Select all

Lorem ipsum dolor sit  amet,  consectetur  adipiscing  elit.  Etiam  scelerisque
 maximus laoreet. Morbi in feugiat metus. Donec ut congue ligula. Cras dui eros,
 facilisis  sed  bibendum  eget, fringilla id dui. Nulla ultricies tempor magna,
 quis dictum urna vehicula eget. Praesent sed lorem nec  nisi  aliquam  maximus.
 Cras  sem orci, rhoncus sed dui at, fringilla dictum risus. Cras mattis ante et
 ex malesuada vehicula. Cras  lobortis  mi  sed  mi  lobortis  porta.  Curabitur
 rhoncus,  ante  ut  dictum pretium, leo elit ullamcorper ante, quis condimentum
 velit nisi at nibh. Curabitur sem risus, convallis at eros  dapibus,  fringilla
 vehicula velit. Suspendisse quis convallis mi.

Is there a hotkey for invoking the Extras? Eg capitalise sentence.
I get a question I don't understand when capitalising sentences.
capsentence.png
capsentence.png (3.77 KiB) Viewed 3354 times
I press yes and the sentence is capitalised just fine.

Very good job, thanks for sharing! :thumbup:
guest3456
Posts: 2528
Joined: 09 Oct 2013, 10:31

Re: ReClip; a Text Reformatting and Clip Management Utility

18 Feb 2017, 17:40

Some editors (Vim) can do a lot of these reformatting features built-in. But I understand not everyone wants to learn new stuff ;)

TAC109
Posts: 287
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ReClip; a Text Reformatting and Clip Management Utility

18 Feb 2017, 18:12

@helgef Thanks for your kind words - I'm pleased you're finding ReClip useful.

To use item on the 'Extras' window you need to first select your text, then use the 'Extras' hotkey (or select from the tray menu), then choose the required radio button, then press ok. It seemed impractical to assign a different hot key to each of the 7 options. You can select items on the 'Extras' window by accelerator key (on many systems you need to hold the 'alt' key to see them). (Items on all ReClip windows and menus can be selected by an accelerator key, except tray items.)

Regarding the 'Capitalise sentence' prompt; after much research (googling) when writing this code, I determined that it is apparently very difficult to accurately predict the start of a sentence. In the end I coded a relatively simple algorithm which detects the end of a sentence by looking for ? ! or . followed by white-space, ignoring any other special characters. If the next character is lower case, the code shows the 'Capitalise sentence' confirmation prompt. (This prompt is also displayed for the start of the selected text in case the user's selection was not at a sentence start.)

An example of a difficult phrase is I visited the Dr. and he prescribed some medicine. In this case, the algorithm would incorrectly select the 'a' of 'and' as a candidate for capitalisation.

So the code prompts in each case to confirm whether the 'double dagger' is at a sentence break before optionally capitalising the next character.

Thanks again for trying ReClip.

[Edited 'Capitalise sentence' information for clarity]
Last edited by TAC109 on 11 Jul 2017, 22:33, edited 6 times in total.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
Helgef
Posts: 3703
Joined: 17 Jul 2016, 01:02
Contact:

Re: ReClip; a Text Reformatting and Clip Management Utility

18 Feb 2017, 18:47

I found !#CapsLock opens the extras menu, that is satisfactory. I cannot remember many hotkeys anyways :shock:
I disabled the mb for the capitalise sentence.

Cheers!
TAC109
Posts: 287
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ReClip; a Text Reformatting and Clip Management Utility

18 Feb 2017, 20:01

That's fine. This option was designed to work on a large block of text containing a number of sentences, and where you may not have started your selection at a sentence start.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
TAC109
Posts: 287
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ReClip; a Text Reformatting and Clip Management Utility

18 Mar 2017, 17:16

19 March 2017 - Updated download link.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
Helgef
Posts: 3703
Joined: 17 Jul 2016, 01:02
Contact:

Re: ReClip; a Text Reformatting and Clip Management Utility

07 May 2017, 11:01

Is/would it be possible to format source code commented text such that, eg

Code: Select all

; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam scelerisque maximus laoreet. Morbi in feugiat metus. Donec ut congue ligula. Cras dui eros, facilisis
; sed bibendum eget, fringilla id dui. Nulla ultricies tempor magna, quis dictum urna vehicula eget. Praesent sed lorem nec nisi aliquam maximus. Cras sem orci, rhoncus sed dui at, 
; fringilla dictum risus. Cras mattis ante et ex malesuada vehicula. Cras lobortis mi sed mi lobortis porta. Curabitur rhoncus, ante ut dictum pretium, leo elit ullamcorper
; ante, quis condimentum velit nisi at nibh. Curabitur sem risus, convallis at eros dapibus, fringilla vehicula velit. Suspendisse quis convallis mi.
would become,

Code: Select all

; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam scelerisque
; maximus laoreet. Morbi in feugiat metus. Donec ut congue ligula. Cras dui eros,
; facilisis sed bibendum eget, fringilla id dui. Nulla ultricies tempor magna,
; quis dictum urna vehicula eget. Praesent sed lorem nec nisi aliquam maximus.
; Cras sem orci, rhoncus sed dui at,  fringilla dictum risus. Cras mattis ante et
; ex malesuada vehicula. Cras lobortis mi sed mi lobortis porta. Curabitur
; rhoncus, ante ut dictum pretium, leo elit ullamcorper  ante, quis condimentum
; velit nisi at nibh. Curabitur sem risus, convallis at eros dapibus, fringilla
; vehicula velit. Suspendisse quis convallis mi.
Note that there is no ; inside the new text. Sorry for being lazy ;)

Cheers.
TAC109
Posts: 287
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ReClip; a Text Reformatting and Clip Management Utility

07 May 2017, 18:38

No need to apologise :)

Actually, that facility has already been provided for (if I understand you correctly).

If you look at the 'Change options' window (default hotkey Window+Ctrl+Capslock), there is a 'Data at left to skip' field. If you insert in there '; ' (i.e. semicolon followed by space), this should achieve what you want.

In more detail:- The contents of this field will be removed from the start of reformatted lines before reformatting, if present. Then after the reformat has taken place the contents of this field are placed at the start of each newly formatted line. (The resulting line will be no longer than defined in the 'Max number of columns' field defined in the same window.) If the second line of the original text has the same indent as the first line, as it does in your example text, then the output text will line up the same. (This is true for all text reformatted by this function.)

I've tried to document this in the help pages; please let me know if this needs clarification. I find that it is often difficult to create a clear description of code that I am too familiar with.

Thanks for using ReClip.

(Edited reply to be more exact.)
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
Helgef
Posts: 3703
Joined: 17 Jul 2016, 01:02
Contact:

Re: ReClip; a Text Reformatting and Clip Management Utility

08 May 2017, 10:04

Awsome! Thanks :dance:
I find that it is often difficult to create a clear description of code that I am too familiar with.
+1
Helgef
Posts: 3703
Joined: 17 Jul 2016, 01:02
Contact:

Re: ReClip; a Text Reformatting and Clip Management Utility

08 May 2017, 10:18

Slight problem, consider this,

Code: Select all

; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam scelerisque maximus laoreet. Morbi in feugiat metus. Donec ut congue ligula. Cras dui eros, facilisis
; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam scelerisque maximus laoreet. Morbi in feugiat metus. Donec ut congue ligula. Cras dui eros, facilisis
I get:

Code: Select all

; Lorem ipsum dolor sit amet, consectetur  adipiscing  elit.  Etiam  scelerisque
; maximus  laoreet.  Morbi  in  feugiat  metus. Donec ut congue ligula. Cras dui
; eros, facilisis Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam
; scelerisque maximus laoreet. Morbi in feugiat metus. Donec ut  congue  ligula.
; Cras dui eros, facilisis
Perfect!, but when the comment is indented, like this,

Code: Select all

	; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam scelerisque maximus laoreet. Morbi in feugiat metus. Donec ut congue ligula. Cras dui eros, facilisis
	; Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam scelerisque maximus laoreet. Morbi in feugiat metus. Donec ut congue ligula. Cras dui eros, facilisis
i get

Code: Select all

;        ; Lorem ipsum  dolor  sit  amet,  consectetur  adipiscing  elit.  Etiam
;        scelerisque  maximus  laoreet.  Morbi in feugiat metus. Donec ut congue
;        ligula. Cras  dui  eros,  facilisis  ;  Lorem  ipsum  dolor  sit  amet,
;        consectetur  adipiscing  elit. Etiam scelerisque maximus laoreet. Morbi
;        in feugiat metus. Donec ut congue ligula. Cras dui eros, facilisis
I am useing these settings,
reclipComment.png
reclipComment.png (30.21 KiB) Viewed 2877 times
Edit: I work around by alt+select in notepad++, main place of usage anyways.
TAC109
Posts: 287
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ReClip; a Text Reformatting and Clip Management Utility

08 May 2017, 16:55

Yes, if you include the 4 leading spaces in the 'data at left to skip' field it will work as expected.

I guess my comment about indent in my previous post is over-simplified. :oops:

In fact the rules about indents are applied after the 'data at left to skip' field has been removed from the start of line(s), if present. The newly reformatted data (with indents) will then have the 'data at left to skip' field inserted at the start of each line.

Hope this is usable for you.

[Edited for clarity]
Last edited by TAC109 on 11 Jul 2017, 21:41, edited 2 times in total.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
Helgef
Posts: 3703
Joined: 17 Jul 2016, 01:02
Contact:

Re: ReClip; a Text Reformatting and Clip Management Utility

08 May 2017, 17:09

TAC109 wrote: Hope this is usable for you.
; Thank you for taking the time to explain. It is very useful, I've used
; it several times today already, I'm just irritated I didn't realise this
; feature was available earlier.

Cheers :D
TAC109
Posts: 287
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ReClip; a Text Reformatting and Clip Management Utility

22 Jul 2017, 22:37

Update 23 July 2017 -
  • Enhanced tray menu access to be more touch screen friendly.
  • The 'wrap text' facility will now detect the error condition 'nothing selected' immediately.
  • Updated the ReClip icon.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts
TAC109
Posts: 287
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ReClip; a Text Reformatting and Clip Management Utility

07 Sep 2017, 20:31

Updated 8 September 2017 -
Fixed the formatting of some windows when screen DPI was other than 96.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts

Return to “Scripts and Functions”

Who is online

Users browsing this forum: EvilLynx, Odlanir and 35 guests