topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday October 5, 2024, 8:32 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: IDEA: Simple line by line truncator  (Read 48564 times)

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
IDEA: Simple line by line truncator
« on: November 23, 2008, 03:21 AM »
This is what I usually do at the office, I copy text and I would like to truncate every line down to about # characters… Doing it manually is really a tedious and error prone process, a lot of time is wasted doing this, I should have saved a lot of time if I have a tool to  help me do the task that I may I do other things in the office… please make my life easier…

Example: (I copy pasted the text into the text box)
From:

before.png

(Example I prefer the length of 7 characters and click the submit button and the textbox content will change into this)
Into:

after.png

Result:
-7 Characters which I chose
-without whitespaces


Can someone please make me a simple software that truncates everyline with a customizable length and automatically removes the whitespace… Please help me I know It will be easy for you guys to make one! Thanks ahead!  :)
« Last Edit: November 23, 2008, 03:50 AM by usemyname »

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,543
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #1 on: November 23, 2008, 04:50 AM »
That's interesting. I recall coming across something being able to do this years ago in a text editor built-in to a proggy that I used (in DOS). I think it may have been in Lotus Magellan or 4DOS. I remember thinking at the time "I wonder who could make use of this?" (I couldn't). You selected the text as a block, using the cursor and mouse keys, copied it, and the copy just excluded everything outside the block. It left embedded spaces intact, if they were included in the block.

Update 2009/07/01:
I have just found that you have this same feature in MS Word.
Refer "The 10 most useful Word shortcuts" http://blogs.techrep....com/10things/?p=475
- esp. see point #10 (Alt+Drag vertically)
« Last Edit: July 01, 2009, 01:50 AM by IainB »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #2 on: November 23, 2008, 06:45 AM »
This is a perfect example of a good coding snack request:
  • clearly described
  • simple functionality which shouldn't be too hard to implement
  • not an abundance of existing free tools to do it already
  • posted in the correct forum section

Which is why it will never be implemented.

Just kidding, i'm sure someone will whip this up in short order  :Thmbsup:

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #3 on: November 23, 2008, 08:14 AM »
I guess the following may not be that useful but FWIW, I used to do something w/ similar results using the commands kill-rectangle and yank-rectangle in Emacs.

agentsteal

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 75
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #4 on: November 23, 2008, 09:20 AM »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #5 on: November 23, 2008, 11:16 AM »
ahahahhahaha i love it  :-* :-* :-*
you even used his numbers from the mockup..  :Thmbsup: :Thmbsup: :Thmbsup:

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #6 on: November 23, 2008, 11:55 AM »
WOW! That was Fast! Thank You so much Guys especially to you Sir agentsteal! Like Sir Mouser said I LOVE IT!  :-* :-* :-* hahaha!

I tried it and it worked flawlessly! but… may I have a little more request Sir agentsteal that will enhance the software? This is the list…  :P

  • Make the remaining line breaks after the last character of the last line disappear
  • Shortcuts: Tab + Enter = Submit Button; Ctrl + C = Copy to Clipboard Button and Ctrl + N = Clear everything
  • Make the length option to be editable ex. click the # and type 6 for 6 characters length
  • Cannot Ctrl + A to select all in the text box, but if the Ctrl + C is implemented that would be enough
  • When resizing window the text box inside doesn’t resize…

BTW Sir, say for example I want to truncate "aaaa  a" and choose 6 as the length of the characters it turns into "aaaa  ", there's still a white space… can you make it disappear if every line has included white spaces at the end of every line?  :-[

I’m really thankful to all of you guys, that was a very quick response! This will be very useful to me, I assure you, I will use this software daily!  ;)  :Thmbsup: :Thmbsup: :Thmbsup:

Thanks again Sir agentsteal and to all!  :)
« Last Edit: November 23, 2008, 12:16 PM by usemyname »

agentsteal

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 75
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #7 on: November 23, 2008, 01:58 PM »
* blank lines are now erased
* Tab + Enter = Submit Button
* Ctrl + C = Copy to Clipboard Button
* Ctrl + N = Clear everything
* the length option is now editable
* Ctrl + A = select all in the text box
* When resizing window the text box inside now resizes
* trailing white space is now erased
http://agentsteal.110mb.com/LineTruncator.zip

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #8 on: November 23, 2008, 02:18 PM »
Wow! Thanks a lot! I’m very much satisfied with the improvements you’ve made Sir Agentsteal!  :Thmbsup: :Thmbsup: :Thmbsup:

Here’s my new list that I hope you can do something about in your free time Sir…  :-[

  • I hope the text box is the active GUI not the Submit Button for easy alt tab and pasting
  • You can definitely add a credit to You and Donationcoder.com  :)
  • Sir can you change Tab + Enter Shortcut for Submit into just simple Ctrl + Enter? I think that would be much faster
  • A little "Shortcuts List" help at the top will help others who will use this software much faster

Whenever someone ask me where I got this I will always point it at donationcoder and give you credit Sir Agentsteal, That’s all I can do to repay you Sir! Thanks again!  :)
« Last Edit: November 23, 2008, 02:35 PM by usemyname »

agentsteal

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 75
    • View Profile
    • Donate to Member

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #10 on: November 23, 2008, 04:11 PM »
That’s great especially when you changed Tab + Enter into Ctrl + Enter Shortcut, Sir forgive me for repeatedly asking for improvements… here is my new list during my testing…

  • The About and Shortcuts button were not affected when I resize the window
  • Can you make the Ctrl + Enter usable even if the active UI is the length option (Very Helpful)

 :-[ Thanks again Sir, You can do it anytime you want… I’m already excited to use your software at the office!  :)

agentsteal

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 75
    • View Profile
    • Donate to Member

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #12 on: November 23, 2008, 05:31 PM »
Thank You so much kind Sir! I am very much satisfied with your work, Now I can sleep… I’ll use it later this night, I need to rest… Thanks so much for your Very BIG Help Sir Agentsteal…  :)  :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup:

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #13 on: November 23, 2008, 06:09 PM »
What a terrific example of DonationCoder at is best

!

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #14 on: November 23, 2008, 06:16 PM »
The thread keeps getting better, it's rare that *I* get to correct chris on a typo; 99% of the time it's the other way around:

DonationCoder at is best

Or maybe this is some strange Canadian expression..  :-\

cranioscopical

  • Friend of the Site
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,776
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #15 on: November 23, 2008, 08:35 PM »
The thread keeps getting better, it's rare that *I* get to correct chris on a typo...
DonationCoder at is best
Well, it's rumoured that you consume too much t but... I am humbled! I grovel and eat dirt.
(Proper nouns do insist on a capital letter, however.)

Or maybe this is some strange Canadian expression..  :-\
There are no strange Canadians.


Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,930
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #16 on: November 23, 2008, 10:06 PM »
Yeah, you kick any strange Canadian over your southern border, is it not?   :P

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #17 on: November 24, 2008, 05:09 PM »
Please excuse my interruption…  :-[

Sir Agentsteal I tried the program at our office and I encountered a problem but it’s my fault sir, I forgot to mention that the line must be cleared of whitespaces at the beginning of every line before truncating it

Example I opted for a length of 7 characters it will turn like in the example below, from…
6541843212 werljlkj kljwler lkjwerl werlejrlwekr kljwlekrewr
   46544521  sdflkfdjl lksdjklfjdslk fkjkdk kjk jjjdksfwer
 234655  jldskfjd ksjfkfj kkdjdkfkd
123456789 jkdshkf khsdkjfhjkdsf

Into…
6541843
4654452
234655
1234567

And Sir may I add one more thing can you delete any characters separated from the truncated line? Please see example below…

Example I opted for a length of 7 characters it will turn like in the example below, from…
12345 extra words blah blah blah blah
1234567 blah blah blah blah blah
1234 extra extra read all about it
12345678 long numbers blah blah blah

Into
12345
1234567
1234
1234567

Line 1: The letter 'e' that was included in the block but separated was deleted as well
Line 2: Normal truncation
Line 3: The characters 'ex' that was included in the block but separated was deleted as well
Line 4: Normal truncation and removes any extra line breaks and white spaces at the end

One more thing Sir… can you make it automatically process and copies the result text to the Clipboard when you press Ctrl + Enter?

Thanks a lot Sir Agensteal for helping me out… Take your time Sir… I can assure you a lot of people in the office will benefit from this software Sir… Any feedbacks for the coming version will be reported to you ASAP Sir, Thanks again!  :)
« Last Edit: November 24, 2008, 06:10 PM by usemyname »

agentsteal

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 75
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #18 on: November 24, 2008, 06:09 PM »
* Whitespace is now deleted from the beginning of the line
* Ctrl-Enter now also copies the truncated text
I'm not sure what you mean by deleting the separated characters: do you mean that only the first word in each line is included or that the 2nd word is only included if it's not partially truncated?

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #19 on: November 24, 2008, 06:17 PM »
Thank You Sir I've been waiting for you… :)

What I mean is to delete any characters that was separated from truncation…

Ex.
123456789
123 this is not needed anymore blah blah
1234567

When I opted for a length of 7 the result should be…
1234567
123
1234567

Note that on line 2 the result was "123" instead of "123 thi" because the "thi" was separated from the first group of characters…

Thanks again!  :)

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #20 on: November 24, 2008, 06:26 PM »
And Sir, can you make the Shortcuts global or work regardless of what UI is active? that would really be helpful Sir… Thanks!  :)

agentsteal

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 75
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #21 on: November 24, 2008, 06:41 PM »
Done:
http://agentsteal.110mb.com/LineTruncator.zip

Btw, can I ask what you're using this for?

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #22 on: November 24, 2008, 06:48 PM »
I’m going to try it out Sir…  :Thmbsup:

I used this at the office to filter out order numbers, the order numbers are always on the left side and other informations are on the right side but we only care about the order numbers, after I use the Line Truncator, I will be pasting it to a spreadsheets…

Thanks again Sir! going to try it out now…  :)

usemyname

  • Participant
  • Joined in 2008
  • *
  • Posts: 24
    • View Profile
    • Donate to Member
Re: IDEA: Simple line by line truncator
« Reply #23 on: November 24, 2008, 06:55 PM »
It works perfectly Sir! just one more thing! Undo process function will be great! I Love this program!  :-* I’m going to try it out again this night Sir, I’ll just wait for the version with the Undo function, I’m going to get some sleep for now…

BTW, if you can make use of the icon of Toad of Supermario, I really would appreciate it! Thanks a lot!  :)

Goodmorning and Goodnight everyone… See you all tomorrow… Thanks again Sir Agentsteal! I’ll post any feedback tomorrow after I use it at the office… bye for now…  ;) :Thmbsup:
« Last Edit: November 24, 2008, 07:27 PM by usemyname »

agentsteal

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 75
    • View Profile
    • Donate to Member