Simple Drag-Drop Text File Manipulator

  • Thread starter Thread starter Jelfish
  • Start date Start date
  • Tags Tags
    File Text
AI Thread Summary
The discussion centers on creating a program for Windows that allows users to drag and drop text files for automated manipulation, such as deleting specific text and replacing spaces with tabs. The user is seeking guidance on how to develop this program, expressing familiarity with C, Classic Fortran, and some C++, but lacking experience in creating such applications. Suggestions include using scripting languages like Perl or Python for text manipulation, as they are effective and widely supported. For implementing drag-and-drop functionality, tools like AutoHotkey or AutoIt are recommended, which can integrate with the scripts. Additionally, the use of Cygwin is mentioned for accessing Perl and Python in a UNIX-like environment, along with the potential of using command-line utilities like awk and sed for text processing. The conversation highlights the learning opportunity presented by Python for this task.
Jelfish
Messages
147
Reaction score
5
Hi

Sorry for the ambiguous title.

I am looking to write a program that, upon dragging and dropping a text file onto it in Windows, it will do some pre-determined manipulation to the text, like deleting a certain amount in the beginning, replacing spaces with tabs, etc.

If you couldn't guess, I'm working with a machine that outputs data in a difficult to use format with a lot of unneeded information. I want to be able to make a program that can quickly manipulate that data and get it into a form I can stick in Excel or Matlab. I've been doing it manually and it's a real pain, especially when I know a program could do it.

I've seen such programs before, but I don't know how to make them myself. I know C, Classic Fortran (70) and some C++, though I'm a bit rusty.

If anyone knows the easiest way to make something like this, or perhaps point me in the direction of instructions or even example code, I would most appreciate it.

Thanks in advance.

Jel
 
Technology news on Phys.org
A script in Perl or Python might be the best for the text manipulation.
Usually, one invokes this on the command line. You'll have to install a Perl or Python package.

In Windows, you can choose to open some filetypes with programs of your choosing... in addition to the default application.

If you truly want drag and drop (as opposed to right-clicking and selecting the alternate application via "Open with..."), you can try to use something that provides you with some of those GUI features, like http://www.autohotkey.com/ or http://www.autoitscript.com/autoit3/, which could call the Perl or Python script.

There are surely other methods (e.g. Visual BASIC, VBscript, Java, Javascript, etc...).. but the above tools are free, easy (for me) to use, and useful for lots of other general purpose tasks. (Cygwin provides Perl and Python packages in a UNIX-like environment... but Cygwin requires a substantial installation and some setup. Cygwin is great!)
 
Last edited by a moderator:
I actually have cygwin on my computer already so I might try it out. I've been considering learning Python. Thanks for the tips!
 
Since you have cygwin, you might also consider awk and sed. It really depends on the nature of your text manipulations.

I agree that this would be a great opportunity to learn some Python.
 
When you drop and drag an item into a program, doesn't it use that as an argument to that program?
 
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...

Similar threads

Replies
33
Views
5K
Replies
41
Views
5K
Replies
1
Views
3K
Replies
1
Views
2K
Replies
12
Views
15K
Replies
2
Views
2K
Back
Top