Batch file to automate a task

1

I run a job that creates 35 text files. The problem is I need to transmit these files after they are created, but before I can send them I need to go into each file and remove a space in order for the file recipient to process them.

This means I need to open each text file, click on configure-block select mode, click on the visible button, put my cursor at the top line before the space and use the shift and arrow key to highlight the space, hit the delete key once it is highlighted and finally save the file. I want to create a batch file that can automate the process. How would I go about doing this?

Carl

Posted 2014-03-20T10:41:02.273

Reputation: 11

2If you haven't tried coding anything yourself yet, you should at least provide more details about the specific operation you want to perform on your textfiles. "Remove a space" is not precise enough (every space? how do you recognize the right ones?). At the moment one appropriate answer would be "Automating it sounds like a good plan!" ;-) – TheUser1024 – 2014-03-20T11:16:30.807

Is there any way to do this in source application that generates those files? That would make life a lot easier. – tumchaaditya – 2014-03-20T18:42:18.723

Answers

3

AutoIT - sounds like the good tool for this. You can make a script with this that will do same things with your files. Click, shift, delete.

Michal Sapsa

Posted 2014-03-20T10:41:02.273

Reputation: 125

Why do you think it would be "the best" tool for that purpose? I agree that it will most likely be doable using AutoIT (or batch, powershell, vbscript, c#, etc.), but "the best"? – TheUser1024 – 2014-03-20T13:55:49.187

1I didn't say its only solution. But with the way author describe the problem (click, press key, press key, double click) the AutoIT will be the best. We can make a batch script, a console c# app, but it will be clickless or will need alot of time. In AutoIT you just record what you want and vola. I edited post to be less controversial, thanks – Michal Sapsa – 2014-03-20T17:30:45.200

Please provide a detailed procedure directly answering OP's question rather than just recommending a tool. A sample script perhaps? – tumchaaditya – 2014-03-20T18:43:23.933

@MichałPółrolniczak: I think your (absolutely valid) point is, that it does not require many coding skills to do it in AutoIT, which might make it a good choice for the OP. But the clicking and keypressing is not "required" after all, it is just how he "removes the spaces" at the moment. Removing those is the "required" part of the task. So something that doesn't simulate the user but simply does the (rather simple) job will most likely be faster and more efficient. Had he provided more detailed information, there would already be two solutions here. :-) – TheUser1024 – 2014-03-20T18:57:46.080