topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Thursday December 12, 2024, 2: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: Finished Coding Snack: Organize Text  (Read 49421 times)

kalos

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,824
    • View Profile
    • Donate to Member
Finished Coding Snack: Organize Text
« on: July 10, 2010, 04:40 PM »
hello

I don't know if it is easy to do what I want or there is a tool already available... well, I have a text file with a list of sentences (each sentence seperated with a newline)

what I want is to group/organize the sentences, by cutting them and pasting them to specific text files (other that the one with the sentences list)

so I want to automatically select a sentence, cut it, and paste it in the appropriate text file by clicking a shortcut key
then select the next one, cut and paste it in the appropriate text file, etc

to choose the appropriate target text file, where I want each sentence to go, I must click the relevant shorcut key

that would be very handy for this kind of job, any suggestion??

thanks

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: organize text
« Reply #1 on: July 10, 2010, 07:23 PM »
that's an interesting idea.. i can see cases where this might be useful in different forms.

as a coding snack you might imagine a program that loaded a text file and showed each line in a list, and let you quickly tag each line by hitting a digit 1-9 or letter a-z, so you could really quickly assign a "tag" to each line (or specific lines), and then hit let you perform some actions.

actions could be things like save each tag group to a dif file, or copy all items in a specific tag group to clipboard, etc.

kalos

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,824
    • View Profile
    • Donate to Member
Re: organize text
« Reply #2 on: July 10, 2010, 07:29 PM »
I suppose we are far from implementing something like this, right?

rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 2,193
    • View Profile
    • Donate to Member
Re: organize text
« Reply #3 on: July 10, 2010, 07:50 PM »
I can see this being very useful to one text file sitting on my desktop right now.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: organize text
« Reply #4 on: July 11, 2010, 07:57 AM »
Some questions:

1) How many target text files are we talking about here?  Unlimited?

2) When you say "click a shortcut key", do you mean clicking a button on a window or do you mean pressing a hotkey combo like ctrl-1?

Paul Keith

  • Member
  • Joined in 2008
  • **
  • Posts: 1,989
    • View Profile
    • Donate to Member
Re: organize text
« Reply #5 on: July 11, 2010, 08:02 AM »
Isn't this similar to what steeladept was looking for in this topic?

https://www.donation...x.php?topic=22650.25

CCCCtrlC link

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: organize text
« Reply #6 on: July 11, 2010, 08:20 AM »
@Paul Keith: Yes, it's similar but I think kalos wants something more automated where he doesn't have to manually copy a line to the clipboard, etc.

kalos

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,824
    • View Profile
    • Donate to Member
Re: organize text
« Reply #7 on: July 11, 2010, 08:30 AM »
Some questions:

1) How many target text files are we talking about here?  Unlimited?

2) When you say "click a shortcut key", do you mean clicking a button on a window or do you mean pressing a hotkey combo like ctrl-1?

1) I want about 10-20, but practically unlimited

2) both, it would be better to have both options, but for me clicking a button on a window would be faster than a combo

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: organize text
« Reply #8 on: July 11, 2010, 11:25 AM »
1) I want about 10-20, but practically unlimited
2) both, it would be better to have both options, but for me clicking a button on a window would be faster than a combo

If you want unlimited, I don't see how you expect to create a unique hotkey combo for each destination file.  Your thoughts?  Also, did you have any sort of GUI design in mind?

ha14

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 276
    • View Profile
    • Donate to Member
Re: organize text
« Reply #9 on: July 11, 2010, 12:19 PM »
perhaps you need an automation tool where you designate a target, why you dont use a clipboard manager?

rgdot

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 2,193
    • View Profile
    • Donate to Member
Re: organize text
« Reply #10 on: July 11, 2010, 12:25 PM »
1) I want about 10-20, but practically unlimited
2) both, it would be better to have both options, but for me clicking a button on a window would be faster than a combo

If you want unlimited, I don't see how you expect to create a unique hotkey combo for each destination file.  Your thoughts?  Also, did you have any sort of GUI design in mind?

Destination files or folders can be something like Ctrl+1, Ctrl+2, Ctrl+3, etc. can't they?

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: organize text
« Reply #11 on: July 11, 2010, 01:51 PM »
Destination files or folders can be something like Ctrl+1, Ctrl+2, Ctrl+3, etc. can't they?

Sure...but what if there are, as kalos wanted, twenty destination files?  Or fifty?

kalos

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,824
    • View Profile
    • Donate to Member
Re: organize text
« Reply #12 on: July 11, 2010, 02:04 PM »
yes hotkeys, they can be anything, maybe not unlimited, let's say 10?

I don't know if a clipboard manager can do that, it would be nice, if you know one please inform me

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,205
    • View Profile
    • Donate to Member
Re: organize text
« Reply #13 on: July 11, 2010, 02:38 PM »
If you want unlimited, I don't see how you expect to create a unique hotkey combo for each destination file.

Could you do it sort-of WordStar-style, with two keys, so that you pressed say Ctrl-0 to Ctrl-9, and each one popped up its own independent list of 0-9 + A-Z channels/bins/whatever you call them?  Hard to keep track of what was supposed to go where, but fairly easy to gain a lot of targets for not many hotkeys.

ha14

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 276
    • View Profile
    • Donate to Member

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Re: organize text
« Reply #15 on: July 11, 2010, 03:01 PM »
That is totally a Vim`s arena :)

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: organize text
« Reply #16 on: July 11, 2010, 03:20 PM »
To all the folks suggesting clipboard managers, I think you're missing the point of kalos' request.  He doesn't want to MANUALLY cut/copy and paste, he wants something to automatically parse through a source text file and allow him to quickly send each line to a, potentially, different target file. 

For the sake of easier coding, let's assume a maximum of thirty targets, okay?  That way, each target can have a button as well as a hotkey:

1-10: Ctrl-1, Ctrl-2, Ctrl-3...
11-20: Ctrl-Shift-1, Ctrl-Shift-2, Ctrl-Shift-3...
21-30: Ctrl-Alt-1, Ctrl-Alt-2, Ctrl-Alt-3...
...or whichever combos you want.

Would this be acceptable?  Also, you didn't answer my question about GUI design.  What did you have in mind?  Did you want to see the whole source text file?  Or just sentence by sentence as it parses through it?  Or, did you want to leave it entirely up to me?

kalos

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,824
    • View Profile
    • Donate to Member
Re: organize text
« Reply #17 on: July 11, 2010, 03:22 PM »
For a clipboard manager
try global clipboard
http://www.techishar...l-clipboard-manager/

TenClips
http://users.skynet....finger/TenClips.html

read this also
http://office.micros...ics-HP005186111.aspx
http://office.micros...ard-HA010163602.aspx




I don't think any of these can do what I want

That is totally a Vim`s arena :)

I 've heard so many good things about vim and similar unix text editors, but have not any experience

how easy can this be done with vim?

kalos

  • Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 1,824
    • View Profile
    • Donate to Member
Re: organize text
« Reply #18 on: July 11, 2010, 03:27 PM »
To all the folks suggesting clipboard managers, I think you're missing the point of kalos' request.  He doesn't want to MANUALLY cut/copy and paste, he wants something to automatically parse through a source text file and allow him to quickly send each line to a, potentially, different target file. 

exactly

For the sake of easier coding, let's assume a maximum of thirty targets, okay?  That way, each target can have a button as well as a hotkey:

1-10: Ctrl-1, Ctrl-2, Ctrl-3...
11-20: Ctrl-Shift-1, Ctrl-Shift-2, Ctrl-Shift-3...
21-30: Ctrl-Alt-1, Ctrl-Alt-2, Ctrl-Alt-3...
...or whichever combos you want.

Would this be acceptable?  Also, you didn't answer my question about GUI design.  What did you have in mind?  Did you want to see the whole source text file?  Or just sentence by sentence as it parses through it?  Or, did you want to leave it entirely up to me?

yes, it would be acceptable, but simple letters would be nice too, where each of the letter is the initial of the target filename, anyway, that doesn't matter much

as for GUI, seeing sentence by sentence would be easier for the eyes, which won't be distracted by the above and below sentence, so it may be preferable

in case of seeing the whole source text file, there must be some way to see which sentence is about to be send to the target text file, maybe by highlighting it

JavaJones

  • Review 2.0 Designer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,739
    • View Profile
    • Donate to Member
Re: organize text
« Reply #19 on: July 11, 2010, 04:12 PM »
I don't need something like this at this exact moment, so my comments are more predictive for what I think I might want at some point. But this does seem like a useful feature, so I'll contribute my thoughts. Obviously Kalos' needs take precedence.

I think it makes most sense to take the step of making this a bit more versatile and allow it to operate not just on a single line but a selection. So I'd say show a window of the text file, but not necessarily the whole thing at once, allow for automatic single-line selection perhaps, but also click-drag selection and/or hold-shift-and-select-with-arrow-keys. The selection should be very clearly highlighted of course, maybe in yellow. But again I think the critical thing is not intentionally limiting it to a single line as that severely narrows the use of the tool in a way that I think is unnecessary to maintain the original utility needed. Clear highlighting should be enough.

- Oshyan

sword

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 200
    • View Profile
    • Donate to Member
Re: organize text
« Reply #20 on: July 12, 2010, 02:03 PM »
1. Create shortcuts to your files.
2. Place the shortcuts on your desktop and open them.
3. Open the file that you want to process and drag selections to the opened files.

vinayakjoshi

  • Participant
  • Joined in 2007
  • *
  • Posts: 14
    • View Profile
    • Donate to Member
Re: organize text
« Reply #21 on: July 15, 2010, 04:08 AM »
I think you should use Clipmate (http://www.thornsoft.com/). The PowerPaste feature can help you quickly paste a series of clips, or break apart complex data by comma, linebreak, etc.

You can copy everything in one go; explode using linebreak; and then do powerpaste in the files that you want.

Regards
Vinayak
http://www.learningconcepts.in/

Jabberwock

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 76
    • View Profile
    • Donate to Member
Re: organize text
« Reply #22 on: July 15, 2010, 04:13 AM »
Could it be a Microsoft Word macro?

The simplest way I can see is to open a document and then a selection of other documents to paste into. A macro would cut selected text and ask for user input (? in Word status bar). The user would input the filename, e.g. "1" and the text gets sent to the open "1.doc" (or "1.txt") document.

Advantages:
1. You stay in Word which might be useful for other word processing tasks you need to do with the text.
2. You have direct preview of all appended files, so you might clean them up immediately.
3. If the document names are short and easy to handle, no need to remember the shortcuts - log entries go into "Log", comments into "Comments" etc.
4. It should be simple - short code, no need for an external app to be running, etc.

Disadvantages:
1. You need Word (duh).
2. The document names may be either informative/usable etc. or easy to enter. I mean if you choose file names "1.txt", "2.txt" (for easy input) you have to rename them later anyway.

Edit: Could you describe the "automated" part of the request in more detail? What would be the criteria for parsing which you mention later (first you write about cutting etc.)?

ebs

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 12
    • View Profile
    • Donate to Member
Re: organize text
« Reply #23 on: July 16, 2010, 03:33 PM »
kalos,

I have a need for a program like this from time to time. I've been too lazy to write one, but your request made me finally go ahead and do it.
How about this?

st.jpg

It's pretty simple to use:
1. Open your input file and each line is displayed in the top list.

2. Specify your output filenames in the bottom list. You can have up to 36 output files, corresponding to tags "0" to "9" and "A" to "Z".
    Files (and the necessary folders) are created if they don't exist. You can choose to overwrite or append to existing files.

3. Tag each line of the input file for the desired output file by pressing the appropriate key.
    The highlight automatically moves down the list as each line is tagged. You can use the Shift or Ctrl key to tag multiple lines.
    If you enter an incorrect tag, just select the line (or lines) and enter the new tag.

4. When you're done tagging input lines, click the "Write Files" button and your tagged lines will be written to the specified output files.

I've got the basic application written, but I want to add the ability to save output filenames,
so they don't have to be re-entered (if you use the same files each time).

If this would be useful, I would be glad to contribute it when I'm done - let me know.

cmpm

  • Charter Member
  • Joined in 2006
  • ***
  • default avatar
  • Posts: 2,026
    • View Profile
    • Donate to Member
Re: organize text
« Reply #24 on: July 16, 2010, 06:27 PM »
Something like this possibly?

http://blogs.msdn.co...e.aspx?wa=wsignin1.0

I was looking for a way to add the "send to" command to the right click context menu after highlighting text. This is all that came close so far. To 'send to' a text file.
« Last Edit: July 16, 2010, 06:30 PM by cmpm »