Results 1 to 5 of 5

Thread: Looking for a macro creating tool like: autohotkey for automating text file editing

  1. #1
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    503

    Default Looking for a macro creating tool like: autohotkey for automating text file editing

    Hi,
    i am looking for a macro/scripting tool that allows me to automate repetitive tasks, similar to the windows tool: autohotkey.
    Basically i just need it because i have to a bunch of text files, and the process is always the same (i use joe):
    - move text cursor to startpositon
    - type '<ENTER>', '#', '<CTRL>+x'
    - for (n=1; n<10; n++); do
    type '<ENTER>', <SPACE>, '$n', '<CTRL>+x', '<CTRL>+x'
    done
    - type '<ENTER>', '$n', '<CTRL>+x', '<CTRL>+x', '<ENTER>', '<ENTER>'

    the last step would be copying the created text block and paste it to another file, but i would do that manually that is no problem.

    Surly one could write a bash script for that too, but that would be unnecessary complicated if there is an alternative, because it is always the same keys to be pressed
    only the start position changes.

  2. #2
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,649

    Default Re: Looking for a macro creating tool like: autohotkey for automating text file editing

    probably use sed in a bash script

    man sed for details

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,859

    Default Re: Looking for a macro creating tool like: autohotkey for automating text file editing

    I think you should take care of those people here who have no Windows experiencce, let alone of a thing called "hotkey".

    I assume those things you describe that should be done, are supposed to be done within an editor. But you fail to explain which editor. Or do you mean that what you describe is what you should do in an editor in Windos (when yes, which one, or is there only one editor in Windows?).

    Maybe you better describe what you would like to be done to such a file then those obscure keystrokes to let us guess what they do in an editor we may not know.

    In other words, better describe the goal, not the means.

    And yes, repetitive actions are normaly better programmed (often a bash script). For text editing within a script sed (stream editor) comes to my mind.
    Last edited by hcvv; 23-Aug-2016 at 05:45.
    Henk van Velden

  4. #4
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    503

    Default Re: Looking for a macro creating tool like: autohotkey for automating text file editing

    Thanks, i am only a beginner with sed but i found a solution using awk in a bash script.

    edit: the editor iam using is called "joe", but i did mentioned that in my post
    what i posted was some kind of pseudo code for the repetitive task i want to automate, independent from any editor, sorry if that was not clear enough.

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,859

    Default Re: Looking for a macro creating tool like: autohotkey for automating text file editing

    Quote Originally Posted by sabo007 View Post
    Thanks, i am only a beginner with sed but i found a solution using awk in a bash script.

    edit: the editor iam using is called "joe", but i did mentioned that in my post
    what i posted was some kind of pseudo code for the repetitive task i want to automate, independent from any editor, sorry if that was not clear enough.
    I do understad you better now. I didn't know of the existance of an editor named "joe"

    Very good you found an awk solution. Yes, sed and awk are powerfull tools.
    Henk van Velden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •